Guide build/

Debug an MCP server with MCP Inspector: web UI, CLI and CI

Point the official Inspector at a stdio command or an HTTP URL, read the JSON-RPC traffic, pick the protocol era, and turn the CLI into a CI check.

Published
Read
6 min
Source
Markdown

Short answer

MCP Inspector is the MCP project's reference tool for testing and debugging MCP servers, published as the npm package @modelcontextprotocol/inspector (version 2.18.0 as of December 6, 2026). Run npx @modelcontextprotocol/inspector node path/to/server/index.js to open the web UI against a stdio server, or pass --server-url https://api.example.com/mcp --transport http for a remote one. Add --cli for a scriptable client with JSON output and stable exit codes for CI.

Checked against: the MCP Inspector README, the modelcontextprotocol.io Inspector, CLI, protocol eras and security pages, the security advisories and the npm registry, December 6, 2026.

Run by us: no. Commands are copied from the MCP Inspector docs and the official SDK docs.

What is MCP Inspector, and which version is current?

MCP Inspector is the reference developer tool for testing and debugging MCP servers, shipped by the MCP project as one npm package with three clients behind one binary.

Item As of December 6, 2026
Package @modelcontextprotocol/inspector
npm latest 2.18.0, published December 5, 2026
npm v1-latest 1.0.8; the v1 line gets security fixes only
Node.js 22.23.4+, 24.22.1+ or 26.12.1+
npx @modelcontextprotocol/inspector                   # web UI (default)
npx @modelcontextprotocol/inspector --cli             # CLI
npx @modelcontextprotocol/inspector --tui             # TUI

The mode flag must come first, because the launcher stops parsing at the first argument that isn’t --web, --cli or --tui. The package also installs mcpdo, an experimental client that keeps one connection open across many commands. The web launch prints a URL that carries a per-launch API token. Open that URL instead of typing localhost:6274.

How do I attach it to a local stdio server?

Pass the command that starts your server as the Inspector’s arguments; the Inspector spawns it and talks to it over stdin and stdout.

Server Command
A built Node.js server npx @modelcontextprotocol/inspector node path/to/server/index.js
The TypeScript SDK tutorial server npx @modelcontextprotocol/inspector npx tsx src/index.ts
A Python SDK server uv run mcp dev server.py
A published npm server npx -y @modelcontextprotocol/inspector npx @modelcontextprotocol/server-filesystem ~/Desktop

Use -e KEY=VALUE to set the server’s environment variables and --cwd to set its working directory. In the web and TUI clients, everything after a bare -- goes to the server, which is how to pass a flag the Inspector would otherwise read as its own:

mcp-inspector node build/index.js -- --config /etc/myserver.conf --verbose

The CLI splits the other way: arguments before -- are the server command, and arguments after it are Inspector options, per the configuration page.

How do I attach it to a remote server?

Pass the URL with --server-url and name the transport with --transport http.

npx @modelcontextprotocol/inspector --server-url https://api.example.com/mcp --transport http

Without --transport, v2 infers the transport only from the URL path: a path ending in /mcp means Streamable HTTP, and one ending in /sse means SSE. Any other path fails with Transport type not specified and could not be determined from URL, where v1 fell back to SSE, per the migration guide. Add --header "Name: Value" to send an API key. The Inspector saves headers in mcp.json exactly as written, so a credential in a header stays in that file. OAuth secrets and stdio env values go to the OS keychain instead.

Which tab shows what went wrong?

Start with Protocol for JSON-RPC errors, then Network or Console for transport failures.

Tab Shown when Use it to
Tools, Resources, Prompts The server declares that capability Call tools from a generated form, read resources, render prompts
Protocol Always Read every JSON-RPC request, response and notification
Network HTTP and SSE servers Check status codes, headers and bodies
Console stdio servers Read the server process’s stderr
Logs The server declares logging See notifications/message output

A capability tab that doesn’t appear usually means the server never declared that capability. On modern-era HTTP connections, the Network tab highlights the standard Mcp-* request headers. A stdio server that writes anything except JSON-RPC to stdout breaks the connection, so its diagnostics belong on stderr, where Console shows them.

Why does my server connect as a legacy server?

The Inspector’s protocol era setting defaults to legacy, so it opens with a plain initialize handshake even when your server supports revision 2026-07-28.

protocolEra What the Inspector does at connect
legacy (default) Sends initialize, with no probing
auto Probes server/discover, then falls back to initialize on any non-modern outcome
modern Pins 2026-07-28, with no fallback

Set the era in Server Settings in the web client, as protocolEra in a config file, or with --protocol-era on a CLI or TUI run. The protocol eras page explains the default: a server/discover probe can stall against silent legacy stdio servers and clutters the transcript. The official TypeScript and Python SDKs’ HTTP handlers serve both eras by default, so test a server under both.

How do I test OAuth?

Connect to the protected server and let the Inspector run the MCP authorization flow, which all three clients support.

Client Redirect URI
Web <origin you opened the Inspector at>/oauth/callback, by default http://127.0.0.1:6274/oauth/callback
CLI and TUI http://127.0.0.1:6276/oauth/callback

Per the authorization page, the Inspector follows the server’s 401 to its authorization server. It registers with dynamic client registration, a static client (--client-id, --client-secret) or a Client ID Metadata Document (--client-metadata-url). After you sign in in the browser, it stores the tokens and retries. Register the exact redirect URI on an authorization server that requires pre-registration; localhost and 127.0.0.1 count as different URIs. --callback-url changes the CLI and TUI callback. When a CLI login fails, --oauth-debug prints each OAuth request and response to stderr with tokens and secrets redacted. MCP authorization step by step explains what each step should return.

How do I run it in CI?

Use --cli with --format json and --stored-auth-only, and let the exit code fail the job.

set -euo pipefail

# Fail the build if the server can't be reached or doesn't expose the tool
mcp-inspector --cli --config ./ci-servers.json --server my-server \
  --stored-auth-only --method tools/list --format json \
  | jq -e '.result.tools | map(.name) | index("get_weather")' > /dev/null
Exit code Meaning, per the CLI docs
0 Success
3 The server requires authentication
4 The server is unreachable
5 The tool returned isError: true, or wasn’t found
6 --strict found an error-severity tool-schema portability problem
14 A stdio server never came up

--stored-auth-only uses stored tokens or fails at once with auth_required, instead of opening a browser. On any non-zero exit, the CLI also writes one JSON error line to stderr. Adding --strict to a tools/list run reports tool schemas that are valid JSON Schema but may not work in every client. The CLI page lists the other exit codes.

Is it safe to leave running?

It is safe on your own machine with the defaults, because the web backend can spawn processes and its token and loopback bind are the guard.

  • Every /api/* route requires the per-launch token. DANGEROUSLY_OMIT_AUTH=true removes that check for anything that can reach the port.
  • The backend binds 127.0.0.1 and refuses all-interface binds unless DANGEROUSLY_BIND_ALL_INTERFACES=true. GET / embeds the token, so anyone who can load the page can act as you.
  • In Docker, publish with -p 127.0.0.1:6274:6274. A bare -p 6274:6274 exposes the backend on every host interface.
  • Without an OS keychain, secrets go to ~/.mcp-inspector/secrets.json, unencrypted unless you supply a key.
  • A stdio server runs as your user. The docs suggest docker run -i --rm --network none <image> as the command for a server you don’t trust.

The advisories page lists fixed flaws, including these:

Advisory Severity Fixed in
CVE-2025-49596: no authentication between client and proxy, so unauthenticated requests could launch stdio commands Critical 0.14.1
GHSA-4fc4-wcmh-4g86: a malicious OAuth callback could switch the transport to stdio and run a local command Critical 1.0.3
GHSA-vcc9-3xgm-p9v4: incomplete fix for CVE-2025-49596; DNS rebinding could steal the API token High 2.12.0
GHSA-2mr9-588x-f57x: the CLI and TUI printed server-controlled C1 control characters Medium 2.18.0 and 1.0.8

Run the current release. Use npx @modelcontextprotocol/inspector@v1-latest only if you must stay on v1.

Sources

  1. MCP Inspector READMEModel Context Protocol github.com
  2. MCP InspectorModel Context Protocol modelcontextprotocol.io
  3. Web clientModel Context Protocol modelcontextprotocol.io
  4. CLI clientModel Context Protocol modelcontextprotocol.io
  5. Configuration and flagsModel Context Protocol modelcontextprotocol.io
  6. Protocol erasModel Context Protocol modelcontextprotocol.io
  7. AuthorizationModel Context Protocol modelcontextprotocol.io
  8. SecurityModel Context Protocol modelcontextprotocol.io
  9. Migrating from v1 to v2Model Context Protocol github.com
  10. CLI client READMEModel Context Protocol github.com
  11. MCP Inspector security advisoriesModel Context Protocol github.com
  12. @modelcontextprotocol/inspectornpm npmjs.com

Changelog

  • First published.

Cite this page

Agents for Devs. "Debug an MCP server with MCP Inspector: web UI, CLI and CI." Published Dec 6, 2026. https://agentsfordevs.com/guides/debug-mcp-server-inspector
Cite one section