Guide
MCP Inspector: How to Run It, Test a Server, and Keep It Locked Down
The official debugging tool for Model Context Protocol servers is also a process that spawns commands and holds OAuth tokens. Here is how to use it, and how to run it safely.
What MCP Inspector is
MCP Inspector is the Model Context Protocol project's own developer tool for inspecting MCP servers. You point it at a server, it connects as an MCP client, and you can see and exercise everything the server offers: its tools, resources and prompts, the arguments they take and what they return. It is published as one npm package, @modelcontextprotocol/inspector, from the modelcontextprotocol/inspector repository.
The current release gives you four ways in, all from the same package:
- Web UI (the default): a browser app with a local Node backend that holds the actual MCP connections.
- CLI (
--cli): a scriptable client for automation, CI and quick checks. - TUI (
--tui): an interactive terminal interface. - mcpdo: an experimental connection CLI that keeps a named connection open through a local daemon.
For a security team, the Inspector matters twice over. It is the quickest way to see what a server can actually do before an agent is allowed near it, and it is itself a local process that launches commands and stores credentials, so it needs the same care as any other tool with that reach.
How to run it
No install step is needed; run it through npx:
npx @modelcontextprotocol/inspector # web UI (default)
npx @modelcontextprotocol/inspector --cli # CLI
npx @modelcontextprotocol/inspector --tui # terminal UIThe mode flag has to come first, straight after the package name. Check node -v before you start: v2 requires a recent patched Node release on each supported line, and npm only warns about a mismatch rather than stopping the install. The exact range is in the README.
Point it at a local (stdio) server
Everything after the package name is the command that starts your server. Pass environment variables with -e, and put arguments meant for the server after --:
npx @modelcontextprotocol/inspector node build/index.js
npx @modelcontextprotocol/inspector -e API_KEY=... -- node build/index.js --server-flagPoint it at a remote server
npx @modelcontextprotocol/inspector --server-url https://mcp.example.com/mcp --transport httpWithout --transport, v2 infers the transport only from the end of the URL: /mcp means Streamable HTTP and /ssemeans SSE. Any other path (including a trailing slash) stops with “Transport type not specified”, so pass --transport http or sse.
Keep a list of servers
v2 keeps your servers in a catalog file, ~/.mcp-inspector/mcp.json by default, in the familiar mcpServers shape, and the web UI, CLI and TUI all read it. Two flags decide who owns the file:
--catalog <path>: the Inspector's own list. It can create, edit and save it.--config <path>: read-only. Use it for a file you didn't write, such as a client application's config or one checked into a repo; the Inspector will not modify it.
The web UI opens at http://localhost:6274 by default and prints a link carrying a per-launch access token in its startup banner. The details are in MCP server configuration.
What to check on a server
Debugging is the Inspector's day job, but the same session doubles as a review. Before a server goes into an approved catalog, use it to answer:
- What tools does it expose, and what do they say about themselves? List them and read every description and input schema in full. Descriptions are read by the model, which is where tool poisoning hides.
- What can each tool reach?Call the read-only ones with harmless inputs and note which systems, files or accounts the results come from. Don't call tools that write, delete or send against real data from a review session.
- Which resources and prompts come with it? They are part of what an agent will be handed, not just the tools.
- How does it authenticate? For a remote server, walk the OAuth flow and look at the scopes it asks for. Our guide to MCP OAuth flows covers what to expect.
- Does it change over time? Save what you saw. A server whose tool list or descriptions later change without a new version is the pattern behind MCP rug pulls.
Using the CLI in CI
The CLI turns those checks into a repeatable job. --format json prints a single result object with no banners, ready for jq:
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list --format json
npx @modelcontextprotocol/inspector --cli node build/index.js \
--method tools/call --tool-name echo --tool-arg message=hiv2 exits with a code a pipeline can act on:
| Exit code | Meaning |
|---|---|
| 0 | Success |
| 1 | Usage or unexpected error |
| 2 | No MCP App on the tool (--app-info probe) |
| 3 | Server requires authentication |
| 4 | Server unreachable (DNS, refused, timeout) |
| 5 | Tool error, or the tool was not found |
On any non-zero exit it also writes one JSON error line to stderr. For a server behind OAuth, --stored-auth-only keeps CI from waiting on a browser: it fails fast with auth_required instead. One practical use is to save the tools/listoutput for every approved server and fail the build when it differs from the reviewed copy. The project's smoke-testing guide walks through the full pattern.
v1 vs v2
v2 is a rewrite. The package name and the npxentry point stayed the same; most of what's underneath changed. v1 is deprecated and gets security fixes only, on the v1-latest tag.
| v1 | v2 | |
|---|---|---|
| Processes and ports | Web UI on 6274, plus an MCP proxy on 6277 | One web server on 6274 (plus an MCP Apps sandbox, 6275 by default) |
| Modes | Web, CLI | Web, CLI, TUI |
| Server list | Per browser, in localStorage | A catalog file on disk, shared by every mode |
| Auth token variable | MCP_PROXY_AUTH_TOKEN | MCP_INSPECTOR_API_TOKEN (the old name still works as a fallback) |
| CLI exit codes | 0 or 1; a failed tool call exited 0 | 0 to 5; a failed tool call exits 5 |
The change most likely to break an existing CI step is the last row: a check that silently passed a failing tool call in v1 now stops. The migration guide covers every flag and variable.
Running it safely
The Inspector's backend starts processes on request and keeps credentials, so an exposed Inspector is a way into the machine running it. That is not theoretical. In June 2025, CVE-2025-49596 (CVSS 9.4, critical) showed that Inspector versions below 0.14.1 had no authentication between the browser client and the proxy, so unauthenticated requests could launch commands over stdio. It was fixed in 0.14.1. Our roundup of common MCP server security threats puts it in context.
Current releases are locked down by default. Keep them that way:
- Stay on loopback. The web server binds
127.0.0.1. An all-interfacesHOSTsuch as0.0.0.0is refused unless you also setDANGEROUSLY_BIND_ALL_INTERFACES. Don't set it on a laptop or a shared network. - Keep the token on. Every
/api/*route needs a bearer token, a fresh random one per launch unless you setMCP_INSPECTOR_API_TOKEN.DANGEROUSLY_OMIT_AUTHturns it off; leave it unset. - In Docker, publish to loopback. Use
-p 127.0.0.1:6274:6274, not-p 6274:6274, which publishes on every interface of the host. The image binds all interfaces inside the container, so the host-side prefix is what keeps it local. - Know where secrets land. OAuth tokens, client secrets and stdio
envvalues go to the OS keychain when there is one. Where there isn't (headless Linux, SSH sessions, containers), they go to~/.mcp-inspector/secrets.json, unencrypted unless you setMCP_INSPECTOR_SECRET_KEY_FILEorMCP_INSPECTOR_SECRET_KEY. On shared machines,MCP_INSPECTOR_SECRET_STORE=memorykeeps them out of storage, andMCP_INSPECTOR_PERSIST_TOKENS=nonestops OAuth tokens from outliving the session. - Treat connecting as running code. Connecting to a stdio entry runs its
commandon your machine before any MCP message is exchanged. Read the command in a catalog you didn't write before you press Connect. Our pre-connection vetting checklist covers what else to look at first. - Don't switch off TLS checks.
NODE_TLS_REJECT_UNAUTHORIZED=0disables certificate checks for every connection the Inspector makes, OAuth included. For a self-signed server, trust its certificate withNODE_EXTRA_CA_CERTSinstead. - Retire old installs. Pinned or globally installed copies from before 0.14.1 are the ones CVE-2025-49596 affects. Find and remove them.
Every variable above is documented in the Inspector's environment variables and secret storage guides. Check them against the version you run; defaults have changed between releases.
Checklist
- Run a current release; remove copies older than 0.14.1.
- Leave
HOSTon loopback and never setDANGEROUSLY_OMIT_AUTH. - In containers, publish ports as
127.0.0.1:6274:6274. - On machines without a keychain, encrypt the secrets file or use memory storage.
- Open other people's server files with
--config(read-only), and read each stdiocommandbefore connecting. - Review every tool description and schema, not just the tool names.
- Save each approved server's
tools/listoutput and diff it in CI.
The Inspector shows you a server one session at a time. Knowing which servers agents across a company are connected to, and what they call, is a separate job; see MCP attack surface mapping before deployment.
Common questions
Is MCP Inspector free?
It is open source, maintained in the modelcontextprotocol/inspector repository; the license terms are in its LICENSE file.
Is there an online MCP Inspector?
The official Inspector is something you run yourself, with npx or its container image (ghcr.io/modelcontextprotocol/inspector). Its documentation does not describe a hosted version. Be careful with third-party web tools that offer to inspect a server for you: they connect with whatever URL, headers and tokens you give them.
How do I install it?
You don't have to: npx @modelcontextprotocol/inspector fetches and runs it. To pin a version for a team or CI, add @modelcontextprotocol/inspector as a dev dependency and run its mcp-inspector binary.
How do I go back to v1?
npx @modelcontextprotocol/inspector@v1-latest. It only receives security fixes, so treat it as a stopgap.


