
MCP Inspector
Author: modelcontextprotocol
Description: Developer tool for testing and debugging Model Context Protocol (MCP) servers. Provides a React web UI (Inspector Client) plus a Node.js proxy server (Inspector Proxy) that can connect to MCP servers over stdio, SSE, or streamable HTTP. Also includes a CLI mode for scripting MCP interactions.
Stars: 9.0k
Forks: 1.2k
License: MIT License
Category: Official
Overview
Installation
npx @modelcontextprotocol/inspectordocker 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:latestnpx @modelcontextprotocol/inspector node build/index.js# Pass arguments only
npx @modelcontextprotocol/inspector node build/index.js arg1 arg2
# Pass environment variables only
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js
# Pass both environment variables and arguments
npx @modelcontextprotocol/inspector -e key=value -e key2=$VALUE2 node build/index.js arg1 arg2
# Use -- to separate inspector flags from server arguments
npx @modelcontextprotocol/inspector -e key=$VALUE -- node build/index.js -e server-flagCLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector node build/index.jsnpm run devnpm run dev:windowsnpm run build
npm startnpx @modelcontextprotocol/inspector --cli node build/index.jstools/list
List available tools exposed by the connected MCP server (CLI via --method tools/list).
tools/call
Invoke a specific tool on the connected MCP server, passing arguments (CLI via --method tools/call with --tool-name and --tool-arg).
resources/list
List available resources exposed by the connected MCP server (CLI via --method resources/list).
prompts/list
List available prompts exposed by the connected MCP server (CLI via --method prompts/list).
FAQs
How do I change the default ports (6274 and 6277) used by MCP Inspector?
MCP Inspector supports custom port configuration through environment variables PORT and PROXY_PORT. Set these before launching: `PORT=8080 PROXY_PORT=8081 npx @modelcontextprotocol/inspector`. You can also pass `--port` and `--proxy-port` flags directly to the CLI. Check the Inspector repository's README for the complete list of available configuration options and flags.
How do I use MCP Inspector CLI mode to automate tool contract testing in a CI/CD pipeline?
Run npx with `--cli` flag and specify the method to test: `npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list` validates your server's tool inventory, while adding `--tool-name` and `--tool-arg` flags enables specific tool response validation. Exit codes from these commands signal pass or fail states that your CI runner can interpret, catching schema regressions before deployment.
Why does my stdio MCP server disconnect when tested with MCP Inspector, and how do I fix stdout corruption issues?
Your stdio server disconnects because any non-JSON output to stdout breaks the JSON-RPC parser. Remove all print statements, console logs, and debug output that write to stdout. Redirect diagnostic logging to stderr instead, or write to a separate log file. Ensure your server only emits valid JSON-RPC messages on stdout to maintain the connection.
What is the difference between MCP Inspector and MCPJam Inspector, and when should I use each one?
MCP Inspector is the official tool best for protocol compliance testing and CI automation via CLI mode. MCPJam Inspector adds an LLM playground for interactive chat-style testing, making it better for simulating conversational agent behavior. Choose MCP Inspector for contract validation and pipelines; choose MCPJam when testing tool selection in multi-turn dialogue scenarios.
How do I connect MCP Inspector to a remote SSE or streamable HTTP server instead of a local stdio server?
Instead of passing a command, provide the remote endpoint URL directly to the Inspector proxy. For SSE servers, use the full URL including protocol and port. For streamable HTTP, specify the endpoint implementing the MCP HTTP transport spec. The Inspector UI at localhost:6274 connects through the proxy on port 6277 to your remote server without spawning a local process.
What does the DANGEROUSLY_OMIT_AUTH setting do in MCP Inspector and when is it safe to use?
`DANGEROUSLY_OMIT_AUTH` disables authentication between Inspector proxy and web UI, removing security preventing unauthorized MCP server access. Use exclusively for isolated local development on trusted machines, never on shared networks or cloud instances where Inspector ports could be accessed, as it exposes full server control without credential verification.