Skip to main content

Debugging

A practical toolkit for debugging MCP servers, clients and host configurations.

Adapted from Debugging. Pair with the MCP Inspector.

MCP Inspector UI — Source: MCP docs

Inspector is usually the first debugging stop. Source: modelcontextprotocol/docs (mcp-inspector.png).

Debugging layers

LayerSymptomsTools
ProcessServer never startsManual CLI run, env checks
TransportGarbled messages / immediate disconnectInspector, protocol version header
DiscoveryEmpty capabilitiesserver/discover, capability flags
ToolsWrong args / runtime errorsInspector Tools tab, schema review
Host configServer missing from UIJSON config, absolute paths, restart
Auth401/403 on remoteToken, OAuth redirect, scopes

Stdio-specific tips

  • Never write logs to stdout — they corrupt JSON-RPC.
  • Capture stderr (mcp-server-NAME.log in Claude Desktop).
  • Reproduce with the exact command + args from host config.

Remote-specific tips

  • Confirm TLS and URL path.
  • Check MCP-Protocol-Version header negotiation.
  • Reproduce with Inspector against the HTTP endpoint.

Workflow

  1. Reproduce outside the host (CLI / Inspector).
  2. Fix schema or runtime errors until Inspector calls succeed.
  3. Reintroduce the host config.
  4. Confirm approval UX and end-to-end LLM tool use.
  5. Add regression tests for tool handlers.

Negative cases

  • “It works in Inspector but not in the host” → almost always config path, env, or cwd differences.
  • Intermittent remote failures → timeouts, load balancer idle limits, token expiry.
  • Tool succeeds but model misuses it → improve description and schema enums, not only code.

Discussion

Comments

Share feedback or questions about this page. No account required.

Loading comments…