AI
MCP Inspector and Debugging MCP Servers
How to test an MCP server with the official Inspector, where logs go, and the common path, environment and connection problems.
Last reviewed:
What the Inspector is
The MCP Inspector is the reference developer tool for testing and debugging MCP servers. It ships as one package, @modelcontextprotocol/inspector, with three clients behind one binary, all built on the same core so a connection behaves the same in each: same transports, config files and OAuth state. The package also installs mcpdo, an experimental client that keeps a connection open across many commands.
The three modes
- Web: npx @modelcontextprotocol/inspector. A full graphical inspector in the browser, the default and richest.
- CLI: add --cli. A scriptable, machine-readable client for CI, shell pipelines and coding agents.
- TUI: add --tui. An interactive terminal UI when a browser is not available or wanted.
How to start
- Run it through npx with no install. Check the Node.js requirements on the official page since they change.
- Pass the command that launches your server as arguments, or point it at a remote server with --server-url.
- Read the server's own README first, since every server needs different commands and arguments.
- Note the launcher owns only the mode flag (--web, --cli or --tui, at most one) and -h; every other flag is defined by the client.
Logging
- stdio server: everything written to stderr is captured by the host application.
- Streamable HTTP server: the client does not capture stderr. Use your own log aggregation or OpenTelemetry, and HTTP tooling such as curl and the browser DevTools Network panel for requests and SSE streams.
- Logging over the protocol (notifications/message) is deprecated in the latest protocol version per the page.
- Log: startup steps, resource access, tool execution, error conditions and performance metrics.
Common issues
- Working directory: it may be undefined (like / on macOS) when the client launches the server, so use absolute paths in config and .env files instead of ./data.
- Environment variables: stdio servers inherit only a limited platform-dependent subset; use the env key in client config for others.
- Startup: wrong executable path, missing files or permissions; try an absolute path for command.
- Configuration: invalid JSON, missing fields or type mismatches.
- Environment: missing variables, wrong values or permission limits.
When connection fails
- Check client logs.
- Verify the server process is running.
- Test the server standalone in the Inspector.
- Verify protocol compatibility: call server/discover to see which protocol versions the server supports.
Common mistakes
- Using relative paths in client config.
- Expecting the server to see all your shell's environment variables.
- Printing to stdout in a stdio server and corrupting the protocol channel. (Our tip; the official example writes to stderr.)
Next steps
- To build a server to test: the build-a-server guide.
- To inspect tool descriptions before trusting: the local server security checklist.
Latest updates
No dated update on this topic was found on the official page read on 2026-11-30. We add updates when they appear.
Similar tools
Standalone pages for similar items are added after their official sources are read. We name nothing without a full page.
Related pages
Sources
- Model Context Protocol: MCP Inspector · read on
- Model Context Protocol: Debugging · read on
Wording is ours, from the official source. Images and video belong to their owners and are credited with a link to the official page.