Skip to content
Back to log

Debugging servers with MCP Inspector

Chainabit's Chao · · 7 min read

In short

Launch Inspector, list a server’s tools, and make a tool call to investigate connection, metadata, and NEXUS errors.

Model Context Protocol describes MCP Inspector as a developer tool for testing and debugging MCP servers. Inspector can connect to stdio and Streamable HTTP servers. It can make calls for tools, prompts, and resources and display the notification stream.

Inspector provides web, CLI, and TUI clients in a single package. The web client opens a graphical interface in your browser. The CLI runs from the command line and produces machine-readable output. The TUI provides an interactive terminal interface. Model Context Protocol recommends using Inspector to test the server independently when troubleshooting connection issues.

Launch Inspector

You can run Inspector directly with npx. To open the web interface and add a server from there, use the command provided by Model Context Protocol.

npx @modelcontextprotocol/inspector

The command prints a URL containing an API token for that launch and opens the browser. Use MCP_AUTO_OPEN_ENABLED=false to disable automatic browser opening. To launch Inspector with a local stdio server, use this command.

npx @modelcontextprotocol/inspector node path/to/server/index.js

When inspecting a published server, Model Context Protocol says you can pass the command that starts the server as an argument to Inspector. You can also point Inspector to a remote server with --server-url. The required command and arguments vary by server, so Model Context Protocol directs you to the server’s README.

To open an interactive interface in your terminal, use the TUI.

npx @modelcontextprotocol/inspector --tui node path/to/server/index.js

The three clients share a common core. According to Model Context Protocol, they handle connection transports, configuration files, and OAuth state on disk in the same way. Each client defines its own set of flags.

The Inspector launcher accepts at most one of the mode flags --web, --cli, or --tui. It recognizes mode flags at the start of the command line. From the first token that is not a mode flag onward, arguments pass to the client unchanged. The behavior of --help also depends on the mode flag. Without one, it shows launcher help. With one, it shows help for the selected client.

List tools and try a tool call

The Inspector CLI can list a server’s tools and then exit. Model Context Protocol provides this example.

npx @modelcontextprotocol/inspector --cli node path/to/server/index.js --method tools/list

Model Context Protocol also provides an example of a tool call that uses HTTP transport and pipes the result to jq.

npx @modelcontextprotocol/inspector --cli https://api.example.com/mcp --transport http \
  --method tools/call --tool-name get_weather --tool-arg city=Boston --format json | jq .result

You can also make a tool call from the web client. Model Context Protocol notes that the monitoring sidebar can display the JSON-RPC exchange. Inspector’s interactive test interface also lets you monitor the notification stream.

The Model Context Protocol debugging workflow uses Inspector for basic tests and rapid iteration during development. During integration, the workflow includes testing in the target MCP client, monitoring logs, and reviewing error handling.

Model Context Protocol directs you to restart the MCP client after changing its configuration or the server code. The guide also calls for adding logging during development.

If the server fails to start or connect

The Model Context Protocol debugging guide groups startup issues into three categories covering paths, configuration, and the environment. An incorrect path to the server executable, missing files, or permission issues can prevent startup. One troubleshooting step in the guide is to use an absolute path for command.

Invalid JSON syntax, missing required fields, or type mismatches in the configuration can also cause startup issues. Possible environment issues include missing environment variables, incorrect values, and permission restrictions.

When a client launches a stdio server from its configuration, the server’s working directory may be undefined. When you test the server directly from the command line, its working directory is where you run the command. Model Context Protocol directs you to use absolute paths in configuration and .env files.

MCP servers launched over stdio automatically inherit only a limited subset of environment variables. The subset varies by platform. Model Context Protocol notes that you can use the env key in the client configuration to override default variables or supply your own values.

If the connection fails, the guide recommends checking the client logs and verifying that the server process is running. The same workflow includes testing the server independently with Inspector and checking protocol compatibility.

Turn this insight into action.

Use the mobile app to continue with guided workflows.

Investigate protocol and metadata errors

Model Context Protocol uses server/discover to check which protocol versions the server supports. An UnsupportedProtocolVersionError has code -32022 and lists the supported versions in the data field.

According to the guide, every request must include io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in its _meta field. The guide also says clients should include io.modelcontextprotocol/clientInfo. If a required field is missing, the server rejects the request with an Invalid params error and code -32602. Other invalid inputs can produce the same code.

If the request’s clientCapabilities field omits a capability the server requires, the server returns MissingRequiredClientCapabilityError. This error has code -32021 and names the missing capabilities. To see what each side declares, Model Context Protocol directs you to check the request’s _meta field and the server/discover response.

Read logs for each transport

For a server using local stdio transport, the host application automatically captures logs written to stderr. Model Context Protocol directs local MCP servers to keep logs off stdout, since writing logs there interferes with the protocol.

For servers using Streamable HTTP transport, the client does not receive stderr output. Model Context Protocol points to server-side log collection or OpenTelemetry in this case. To inspect HTTP requests and SSE streams, you can use HTTP tools such as curl or the Network panel in your browser’s DevTools.

The guide lists startup steps, resource access, tool execution, errors, and performance metrics among the events to record while the server is running. Its security guidance also calls for removing sensitive data from logs, protecting credentials, and masking personal information during debugging.

Model Context Protocol’s logging guidance also covers using consistent formats, adding context, and tracking request IDs. For error handling, it calls for logging stack traces and error context. For performance monitoring, it calls for measuring processing time, message sizes, and latency.

Interpret responses from the NEXUS local server

When troubleshooting the local server, NEXUS directs you to first identify where the failure occurs. It can occur between the client and the local executable, between the executable and the running Nexus app, or in an individual tool call within the app. Cloud MCP uses separate credentials.

According to NEXUS, server/discover, the legacy initialize call, and ping can respond without reaching the desktop app. These calls can succeed even if tools/list or tools/call cannot reach a running workspace.

If forwarded calls return -32603, NEXUS recommends opening Nexus and checking that at least one agent exists. Then open the workspace you want to use and retry tools/list from the connected client. If the message says the stored credentials are from a previous run, quit Nexus and reopen it.

NEXUS directs you to avoid copying tokens into the client environment or manually creating a new credential file. The launcher tries an agent-specific credential first if one is available, then tries the machine credential.

NEXUS rejects unsupported protocol versions with -32022. NEXUS directs you to choose a version the client supports from data.supported. A legacy client sends the version in initialize.params.protocolVersion. A modern client includes it in params._meta on every request.

In NEXUS, -32602 can indicate invalid protocol metadata. If params._meta contains a reserved io.modelcontextprotocol/ key, it must also contain io.modelcontextprotocol/protocolVersion with a valid string value. The server does not read the modern protocol version from _meta at the JSON-RPC root.

For a tool-specific error, NEXUS directs you to check the current inputSchema in tools/list. A successful JSON-RPC response can carry an MCP tool result containing isError: true. In that case, NEXUS directs you to inspect the content of the tool result. The NEXUS quick reference advises checking that content for scope, permission, or argument errors.

Limitations and credential storage

The Model Context Protocol development workflow calls for basic tests with Inspector, testing in the target MCP client, and monitoring logs. With Streamable HTTP, log inspection is limited because the client does not receive the server’s stderr output.

Inspector manages OAuth tokens, OAuth client secrets, and stdio env: values. According to Model Context Protocol, Inspector stores them in the operating system’s keychain when available. On a machine without a keychain, Inspector saves them to ~/.mcp-inspector/secrets.json and encrypts them only if you provide a key.

Ready to start?

Download the app and continue from your phone.

End of Entry