Skilllibrary mcp-inspector-debugging
Debug MCP servers using the MCP Inspector, server logs, and host traces. Use when MCP tools don't appear in the host, tool calls fail silently, transport connections drop, or the initialize handshake doesn't complete. This skill covers the MCP Inspector tool, common failure patterns, and systematic debugging steps.
git clone https://github.com/merceralex397-collab/skilllibrary
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/07-mcp/mcp-inspector-debugging" ~/.claude/skills/merceralex397-collab-skilllibrary-mcp-inspector-debugging && rm -rf "$T"
07-mcp/mcp-inspector-debugging/SKILL.mdPurpose
Systematically debug MCP server issues using the MCP Inspector and other diagnostic tools. The MCP Inspector is the official interactive debugging tool for MCP servers — it connects to a server, lists capabilities, and lets you call tools/read resources/get prompts interactively.
When to use this skill
- MCP tools don't appear in the host application
- Tool calls fail or return unexpected errors
- The server fails to start or the initialize handshake doesn't complete
- SSE/HTTP transport connections drop or timeout
- Need to verify a server works before connecting to a host
Do not use this skill when
- Building a new server from scratch → use
orget-startedmcp-development - Designing tool schemas → use
mcp-tool-design - Working on auth implementation → use
mcp-auth-transports
The MCP Inspector
Installation and basic usage
npx @modelcontextprotocol/inspector <command> [args...]
For stdio servers:
npx @modelcontextprotocol/inspector node dist/index.js npx @modelcontextprotocol/inspector uv run python server.py npx @modelcontextprotocol/inspector ./my-go-binary
For Streamable HTTP servers:
npx @modelcontextprotocol/inspector --url https://my-server.example.com/mcp
The Inspector opens a web UI at
http://localhost:6274 with tabs for:
- Tools — list all tools, call them with arguments, see responses
- Resources — list resources, read their contents
- Prompts — list prompts, get them with arguments
- Notifications — see server notifications in real time
Debugging workflow with Inspector
- Verify initialization: The Inspector shows the
handshake result. Check thatinitialize
includes the expected primitives (tools, resources, prompts).capabilities - List tools: Click the Tools tab. If tools don't appear, the server's
handler has a problem.tools/list - Call a tool: Select a tool, fill in arguments, click Call. Check the response for
flag and content.isError - Check resources: Switch to Resources tab. Verify URIs and content.
- Monitor notifications: Watch for
ornotifications/tools/list_changed
.notifications/resources/updated
Systematic debugging procedure
Level 1 — Server doesn't start
| Symptom | Check |
|---|---|
| "command not found" | Is // in PATH? Use absolute path to binary. |
| Immediate exit | Does the server have compilation errors? Run or . |
| Hangs without output | Server may be waiting for input. Verify it's running stdio transport correctly. |
| Port already in use | For HTTP transport, check if another process is on the same port. |
Level 2 — Connection fails
| Symptom | Check |
|---|---|
| Initialize timeout | Server must respond to request. Check JSON-RPC message format. |
| Protocol version mismatch | Server and client must agree on protocol version. Check field. |
| No capabilities | response must include object with declared features. |
Level 3 — Tools don't appear
| Symptom | Check |
|---|---|
| Empty tool list | capability not declared in response. |
| Tools appear in Inspector but not host | Host may need restart. Check host-specific config format. |
| Partial tools | Tool registration may have thrown an error silently. Add error logging. |
Level 4 — Tool calls fail
| Symptom | Check |
|---|---|
| Invalid params error | doesn't match the arguments sent. Validate schema with Inspector. |
| Tool execution error | Check in response. Read the error message for guidance. |
| Timeout | Tool handler is taking too long. Check async operations and timeouts. |
| Empty response | Handler returned null/undefined. Must return . |
Level 5 — Transport-specific issues
stdio:
orconsole.log()
to stdout corrupts the JSON-RPC streamprint()- Non-UTF-8 output breaks the protocol
- Embedded newlines in messages break framing
Streamable HTTP:
- Missing
header validation enables DNS rebinding attacksOrigin - SSE stream dropped → client should reconnect with
Last-Event-ID - Session expired (404) → client must re-initialize
Server-side logging
For stdio servers, always log to stderr:
console.error("Debug: tool called with", args); // Goes to stderr // NEVER: console.log("...") — this corrupts stdout
import sys print("Debug: tool called", file=sys.stderr) # Goes to stderr # NEVER: print("...") — this corrupts stdout
For HTTP servers, use structured logging:
import { Server } from "@modelcontextprotocol/sdk/server/index.js"; // Server supports logging capability — send logs to client server.sendLoggingMessage({ level: "info", data: "Processing request" });
Decision rules
- Always verify with MCP Inspector BEFORE connecting to a host — it eliminates host-specific variables
- If Inspector works but host doesn't, the issue is host config, not server code
- If neither works, check Level 1 (server starts) → Level 2 (connection) → Level 3 (capabilities) → Level 4 (tool execution)
- Enable
capability for production servers to support remote debugginglogging
Output requirements
- Identified failure level (1-5)
- Specific root cause
- Fix applied and verified via MCP Inspector
- Host re-tested after fix
Related skills
— host-specific config patternsmcp-host-integration
— transport-level debuggingmcp-auth-transports
— automated testing beyond manual debuggingmcp-testing-evals
— schema validation issuesmcp-schema-contracts
Failure handling
- If MCP Inspector itself fails to install, ensure Node.js 18+ is available and npm registry is reachable
- If Inspector connects but shows no UI, check port 6274 is not blocked
- If the issue is intermittent, add
capability and uselogging
to trace executionserver.sendLoggingMessage()