How to Debug an MCP Server Using MCP Inspector
A complete developer guide to debugging MCP servers with MCP Inspector — from zero-install launch via npx to live tool testing, error fixes, and pro tips.
Mohammed Kafeel
Machine Learning Researcher
On this page
- Key Takeaways
- What Is MCP Inspector?
- Prerequisites
- How to Install and Launch MCP Inspector
- Understanding the MCP Inspector UI
- Step-by-Step Debugging Workflow
- Real-World Example: Debugging a Node.js MCP Server
- Common MCP Debugging Issues and How to Fix Them
- Pro Tips and Best Practices
- MCP Inspector vs. Other Debugging Tools
- FAQ
- Useful Sources
- Ready to Start Debugging?
More than 70% of MCP server bugs are caught before a single AI client ever touches the code - but only if you're using the right tool. Most developers waste hours restarting Claude Desktop or Cursor just to test one tool call. There's a much faster way.
MCP Inspector is the official, browser-based debugger for Model Context Protocol servers. Think of it as Postman for MCP: you fire requests, inspect responses, and watch logs in real time - no AI client required. This guide walks you through everything, from the first npx command to squashing the most common bugs.
If you're brand new to the protocol, skim what MCP is first, then come back here to debug your server.
Key Takeaways
📦 No installation needed - MCP Inspector runs via
npx @modelcontextprotocol/inspector.🌐 Browser UI at port 6274, proxy server at port 6277.
🔌 Transport-agnostic - supports stdio, SSE, and streamable-http.
🚫 Never use
console.log()with stdio transport - it corrupts the protocol stream.🔁 Iterative loop: edit code → rebuild → reconnect → re-test.
⚠️ Inspector ≠ Claude Desktop - always do a final test in your target AI client.
What Is MCP Inspector?
MCP Inspector is an interactive, browser-based developer tool for testing and debugging MCP (Model Context Protocol) servers. It lets you send requests, inspect responses, and monitor server logs without needing a full AI client like Claude Desktop or Cursor.
The best analogy: it's Postman for MCP. If you've ever used Postman to debug a REST API, MCP Inspector does the same job for MCP servers.
How Does MCP Inspector Work Under the Hood?
MCP Inspector has a two-component architecture:
- MCP Inspector Client (MCPI) - a React-based web UI, accessible at
http://127.0.0.1:6274by default. - MCP Proxy (MCPP) - a Node.js server running on port 6277 that bridges the web UI to your MCP server via stdio, SSE, or streamable-http.
The proxy isn't a traffic interceptor. It acts as both an MCP client (talking to your server) and an HTTP server (serving the UI), which is what lets a browser-based tool talk to local processes.
One important caveat: MCP Inspector doesn't fully simulate the quirks of specific AI clients. It won't catch Cursor-specific or Claude Desktop-specific behavior. It's a development and testing tool - not a production replica.
Prerequisites
Before you launch the MCP Inspector tool, make sure you have:
- Node.js
^22.7.5or higher - this is a hard requirement, not a suggestion. - An MCP server to test - Node.js/TypeScript or Python both work.
- Basic terminal knowledge - you'll be running a few shell commands.
That's it. No global install, no config file to set up first.
How to Install and Launch MCP Inspector
The short answer: you don't install it. MCP Inspector runs entirely via npx, so you're always on the latest version.
Basic Launch Command
npx @modelcontextprotocol/inspector <command>
Launch Commands for Every Common Scenario
Local Node.js / TypeScript server:
npx @modelcontextprotocol/inspector node path/to/server/index.js
Local Python server (using uv):
npx @modelcontextprotocol/inspector uv --directory path/to/server run package-name args...
From an npm package:
npx -y @modelcontextprotocol/inspector npx <package-name> <args>
From a PyPI package:
npx @modelcontextprotocol/inspector uvx <package-name> <args>
With environment variables (use -e, not hardcoded values):
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js arg1 arg2
Custom ports (if 6274 or 6277 are already taken):
CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector node build/index.js
Via Docker (for isolated, reproducible environments):
docker run --rm \
-p 127.0.0.1:6274:6274 \
-p 127.0.0.1:6277:6277 \
-e HOST=0.0.0.0 \
-e MCP_AUTO_OPEN_ENABLED=false \
ghcr.io/modelcontextprotocol/inspector:latest
Add a Debug Script to package.json
Save yourself typing by adding this to your package.json:
"scripts": {
"debug": "npx -y @modelcontextprotocol/inspector node index.js"
}
Then just run:
npm run debug
What You'll See in the Console
After launch, your terminal will print:
🔑 Session token: 3a1c267fad21f7150b7d624c160b7f09b0b8c4f623c7107bbf13378f051538d4
Proxy server listening on port 6277
Open inspector at http://127.0.0.1:6274
Open http://127.0.0.1:6274 in your browser. The Inspector auto-opens with the session token pre-filled in the URL for security.
💡 Security note: The proxy requires a session token by default. Never set
DANGEROUSLY_OMIT_AUTH=truein any environment you care about - it exposes your machine to remote code execution attacks (see CVE-2025-49596).
Understanding the MCP Inspector UI
The MCP Inspector UI has five key panels. Each one maps to a specific part of the MCP protocol.
1. Server Connection Pane
This is where you configure and initiate the connection.
- Select your transport type: stdio (local processes), SSE (Server-Sent Events), or streamable-http.
- Customize command-line arguments and environment variables.
- Click "Connect" to start the session.
For local servers, always start with stdio transport - it's the most straightforward.
2. Resources Tab
- Lists all resources your server exposes.
- Shows metadata: MIME types, descriptions.
- Lets you inspect resource content directly.
- Supports subscription testing for real-time resource updates.
3. Prompts Tab
- Displays all available prompt templates.
- Shows each prompt's arguments and descriptions.
- Lets you test prompts with custom arguments.
- Previews the generated messages before they'd reach an AI client.
4. Tools Tab
This is where most of your debug MCP server work happens.
- Lists all available tools with their JSON schemas and descriptions.
- Lets you test tools with custom inputs via a form interface.
- Shows tool execution results in real time.
5. Notifications Pane
Don't ignore this panel. It's your live log stream.
- Shows all server logs and notifications as they happen.
- Critical for spotting errors, unexpected behavior, and protocol-level issues.
- Displays session IDs you can use to trace specific connections.
Step-by-Step Debugging Workflow
Here's the exact workflow we use when debugging an MCP server with MCP Inspector. Follow these four phases in order.
Phase 1: Initial Setup & Connection
- Launch MCP Inspector with your server command (see the commands above).
- Open
http://127.0.0.1:6274in your browser. - Select your transport type - use stdio for local servers.
- Click "Connect".
- Check the Notifications Pane immediately - connection logs appear here. Any startup errors show up right away.
Phase 2: Capability Verification
- Go to the Tools Tab → click "List Tools" → verify all expected tools appear.
- Go to the Resources Tab → confirm your resources are listed with correct metadata.
- Go to the Prompts Tab → verify prompt templates load with the right arguments.
If a tool is missing here, the problem is in your tool registration code - not in the transport or the Inspector.
Phase 3: Testing Tools
- Select a tool from the Tools Tab.
- Fill in the required parameters using the form.
- Click Execute.
- Inspect the JSON response in the results panel.
- Switch to the Notifications Pane to check for any server-side logs or errors triggered by the call.
Phase 4: Iterative Development
- Make changes to your server code.
- Rebuild if you're using TypeScript:
npm run build. - In the Inspector, click Disconnect → Connect to reconnect.
- Re-test the affected features.
- Watch the Notifications Pane for new errors.
This reconnect step is important. The Inspector doesn't hot-reload your server - you need to explicitly reconnect after a rebuild.
Real-World Example: Debugging a Node.js MCP Server
Let's walk through a concrete MCP Inspector tutorial with a real server. (If you haven't built one yet, start with our guide to building an MCP server in Python - the Inspector works the same way against either runtime.) Here's a simple MCP server that fetches npm package info:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { execSync } from "child_process";
const server = new McpServer({
name: "npm-info-server",
version: "1.0.0",
description: "Fetches npm package information"
});
server.tool(
"getNpmPackageInfo",
{ packageName: z.string() },
async ({ packageName }) => {
const output = execSync(`npm view ${packageName}`).toString();
return { content: [{ type: "text", text: output }] };
}
);
const transport = new StdioServerTransport();
await server.connect(transport);
Launch the Inspector against this server:
npx @modelcontextprotocol/inspector node index.js
Then in the Inspector UI:
- Connect via stdio transport.
- Go to the Tools Tab → click "List Tools" → you'll see
getNpmPackageInfo. - Enter a package name - try
react. - Click Execute.
- Inspect the JSON response. You should see the full
npm view reactoutput wrapped in the MCP content format. - Check the Notifications Pane for any errors (e.g., if the package name doesn't exist,
execSyncwill throw and you'll see the stack trace here).
This loop - write tool, launch Inspector, test, fix, reconnect - is the core of MCP server testing.
Common MCP Debugging Issues and How to Fix Them
Most MCP server bugs fall into a handful of categories. Here's the full troubleshooting table:
| Issue | Likely Cause | Fix |
|---|---|---|
| Connection refused | Wrong transport type or server not starting | Check transport selection; run your server command manually to see startup errors |
| Tools not showing | Server not registering tools correctly | Check tool registration code; inspect the Notifications Pane for errors |
console.log() not visible |
STDIO transport captures stdout | Write debug logs to a file instead of stdout |
| Schema validation error | Tool input doesn't match the defined schema | Review your tool schema definition; validate input types carefully |
| Authentication failure | Missing or wrong auth tokens | Pass env vars with the -e flag in your Inspector launch command |
| Transport mismatch | Client/server transport incompatibility | Match the transport type in Inspector to what your server actually uses |
| Port conflict | Default ports 6274 or 6277 already in use | Use CLIENT_PORT and SERVER_PORT env vars to pick different ports |
If schema validation errors keep surfacing, the root cause is usually the schema itself - our guide to validating tool schemas covers how to write inputs agents construct correctly.
The console.log() Trap
This one trips up almost every developer the first time. With stdio transport, stdout is the protocol channel. If you write console.log("debug info") in your server code, that text goes straight into the MCP message stream and corrupts it.
The fix: write debug output to stderr or to a log file.
// ❌ Don't do this with stdio transport
console.log("Tool called with:", args);
// ✅ Do this instead
process.stderr.write(`Tool called with: ${JSON.stringify(args)}\n`);
// or write to a log file
Pro Tips and Best Practices
These are the habits that separate a smooth debugging session from a frustrating one.
Use absolute paths in your server configuration. Relative paths cause hard-to-diagnose "file not found" errors depending on where you run the command.
Never
console.log()with stdio transport. It pollutes the protocol stream. Usestderror a log file.Use the
-eflag for environment variables. Don't hardcode API keys or secrets in your server command.Test edge cases deliberately: empty inputs, invalid types, missing required fields, concurrent tool calls. The Inspector makes this easy - use it.
MCP Inspector ≠ Claude Desktop. Inspector won't catch client-specific quirks. Always do a final end-to-end test in your actual target AI client.
Use session IDs. The Inspector logs a session ID in the console. When you're digging through logs, use it to trace exactly which connection triggered a specific error.
Use the Docker image for isolated, reproducible debugging environments - especially useful on CI or when onboarding teammates.
Use CLI mode for automation. The
--cliflag lets you script tool calls and integrate Inspector into CI/CD pipelines:
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list
MCP Inspector vs. Other Debugging Tools
Use the right tool for the right job. Here's when to reach for each one:
| Tool | Best For |
|---|---|
| MCP Inspector | Development-time testing, tool/resource/prompt validation, transport debugging |
| Claude Desktop / Cursor | End-to-end testing in the actual AI client environment |
| Server logs | Production monitoring and post-deployment debugging |
| Unit tests | Automated regression testing of individual tool functions |
CLI mode (--cli flag) |
CI/CD pipelines, scripted testing, coding assistant feedback loops |
The Inspector is your primary tool during development. Once the server behaves correctly in Inspector, move to your target AI client for integration testing. Don't skip either step.
FAQ
What is MCP Inspector?
MCP Inspector is an official, interactive browser-based developer tool for testing and debugging Model Context Protocol (MCP) servers. It lets you send requests, inspect responses, and monitor server logs without needing a full AI client. Think of it as Postman for MCP.
How do I run MCP Inspector with npx?
Run npx @modelcontextprotocol/inspector node path/to/server/index.js for a Node.js server, or npx @modelcontextprotocol/inspector uv --directory path/to/server run package-name for Python. No installation required - npx MCP Inspector always fetches the latest version.
What ports does MCP Inspector use by default?
The web UI (client) runs on port 6274, and the proxy server runs on port 6277. You can change these with CLIENT_PORT and SERVER_PORT environment variables if there's a conflict.
Why aren't my tools showing up in MCP Inspector?
The most common cause is a tool registration error in your server code. Check the Notifications Pane for startup errors. Also confirm your server actually starts successfully by running the server command directly in your terminal before launching the Inspector.
Why can't I see my console.log() output in MCP Inspector?
With stdio transport, stdout is the MCP protocol channel. Any console.log() output corrupts the message stream. Write debug output to stderr or a log file instead.
Does MCP Inspector work with Python MCP servers?
Yes. Use the uv command: npx @modelcontextprotocol/inspector uv --directory path/to/server run package-name. For PyPI packages, use npx @modelcontextprotocol/inspector uvx <package-name>.
What transports does MCP Inspector support?
MCP Inspector is transport-agnostic. It supports stdio (for local processes), SSE (Server-Sent Events), and streamable-http. Select the transport in the Server Connection Pane before clicking Connect.
Is MCP Inspector the same as testing in Claude Desktop?
No. MCP Inspector is a development tool - it doesn't simulate the specific behavior of Claude Desktop, Cursor, or any other AI client. Always do a final integration test in your target client after the Inspector confirms your server works correctly.
Can I use MCP Inspector in a CI/CD pipeline?
Yes. Use CLI mode with the --cli flag: npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list. This outputs JSON and is scriptable for automated testing.
How do I pass environment variables to my MCP server via Inspector?
Use the -e flag in your launch command: npx @modelcontextprotocol/inspector -e API_KEY=$API_KEY node build/index.js. Never hardcode secrets in the command string.
Useful Sources
- MCP Inspector - Official Documentation - modelcontextprotocol.io
- MCP Inspector - GitHub Repository - github.com/modelcontextprotocol/inspector
- MCP Debugging Guide - modelcontextprotocol.io
- Model Context Protocol Specification - modelcontextprotocol.io
Ready to Start Debugging?
You've got everything you need. Run npx @modelcontextprotocol/inspector node your-server/index.js, open http://127.0.0.1:6274, and start testing.
The fastest way to build a reliable MCP server is to catch bugs early - and MCP Inspector is the fastest way to do that.
Keep reading
Connecting Claude Code to Internal Tools with MCP: A Developer's Guide
A hands-on guide to connecting Claude Code to your internal tools via MCP — setup, real-world use cases, security best practices, and troubleshooting for developers.
How Cursor, Claude Code, and Windsurf Use MCP for Agentic Coding
Cursor, Claude Code, and Windsurf all support MCP - but they implement it differently. Setup, real workflows, and a side-by-side comparison.
What the Agentic AI Foundation (AAIF) Means for MCP and the Future of Agentic AI
On December 9, 2025, Anthropic, Block, and OpenAI donated their most strategic AI agent projects to a neutral open foundation. Here's why the AAIF matters for everyone building with AI agents.



