How to Use MCP Inspector to Test Your MCP Server

A step-by-step MCP Inspector tutorial: launch the web UI or CLI, check the handshake, list and call tools, test resources and prompts, then turn the checks into a CI smoke test and an Apidog CLI suite your coding agent maintains.

Ashley Innocent

Ashley Innocent

1 December 2026

How to Use MCP Inspector to Test Your MCP Server

Apidog for Enterprise

On-Premises Deploy

SSO & RBAC

SOC 2 Compliant

Explore Apidog Enterprise

To use MCP Inspector, run npx @modelcontextprotocol/inspector for the web UI or add --cli for a scriptable client, point it at your server (a stdio command or an HTTP URL), then check the handshake, list tools, resources and prompts, and call one tool. The CLI returns JSON and stable exit codes, so the same checks drop straight into CI.

Below you’ll run each step against a real server, then turn the checks into an automated suite your coding agent maintains.

What is MCP Inspector?

MCP Inspector is the official developer tool from the Model Context Protocol project for testing and debugging MCP servers. It connects to a server the way a real client would, completes the initialize handshake, and lets you list and call tools, read resources and fetch prompts, so you can see exactly what an agent will see.

The current release is the v2 line (2.17.0 on npm as of December 1, 2026). It ships as one package, @modelcontextprotocol/inspector, with three ways to drive it:

Mode Command Best for
Web UI npx @modelcontextprotocol/inspector Exploring a server by hand, reading schemas, trying tool arguments
CLI npx @modelcontextprotocol/inspector --cli Scripts, CI jobs, fast feedback for coding agents
TUI npx @modelcontextprotocol/inspector --tui Interactive testing inside a terminal or over SSH

All three support stdio (the Inspector spawns your server), Streamable HTTP and SSE. For other tools, see our roundup of the best MCP inspectors; this guide sticks to the official one.

Schema: the MCP Inspector package offers a web UI on port 6274, a CLI and a TUI on one shared core, which connects to an MCP server over stdio, Streamable HTTP or SSE

What you need before you start

You need three things:

  1. Node.js on a supported line. 2.17.0 declares ^22.23.4 || ^24.22.1 || >=26.12.1. Older patch releases get an EBADENGINE warning (it still ran on Node 24.15 for us).
  2. An MCP server. Yours, or the official Everything reference server (@modelcontextprotocol/server-everything), which exposes 17 tools, 4 prompts and 8 resources.
  3. jq for scripting the CLI.

Install both packages locally so the first connect doesn’t time out while npx downloads the server:

npm i -D @modelcontextprotocol/inspector@2.17.0 @modelcontextprotocol/server-everything

Step 1: Launch MCP Inspector against your server

Start the web UI

Run the Inspector with no target to open the web UI:

npx mcp-inspector

It prints a banner like this and opens your browser:

MCP Inspector Web is up and running at:
   http://127.0.0.1:6274?MCP_INSPECTOR_API_TOKEN=<token>

   Sandbox (MCP Apps): http://127.0.0.1:6275/sandbox
   Secrets: OS keychain

Port 6274 serves the UI; 6275 is the MCP Apps sandbox. The token is random per launch and guards every /api/* call, so don’t share that URL. Secrets go to the OS keychain; on a headless box without one they fall back to ~/.mcp-inspector/secrets.json, unencrypted unless you supply a key.

In the UI, pick a transport, enter the command or URL, and connect.

Or connect straight from the CLI

For a stdio server, put the server command after --cli. For a remote server, pass --transport and --server-url:

# stdio: the Inspector spawns the server
npx mcp-inspector --cli npx mcp-server-everything --method initialize --format json

# Streamable HTTP
npx mcp-inspector --cli --transport http \
  --server-url http://localhost:3001/mcp --method initialize --format json

--method initialize is a connect-only probe: it completes the handshake, prints serverInfo, protocolVersion and capabilities, and disconnects. The Everything server reported protocol 2025-11-25. If your server takes a flag the Inspector also defines (like --config), put -- between the server command and the Inspector’s options.

Step 2: Check the handshake and capabilities

Before testing tools, read the capabilities block:

"capabilities": {
  "logging": {}, "completions": {},
  "prompts": { "listChanged": true },
  "resources": { "subscribe": true, "listChanged": true },
  "tools": { "listChanged": true }
}

Check two things. Does the protocol version match what your host expects? And does every advertised capability work? If resources.subscribe is true, subscribe in the UI and trigger an update. Advertised but unimplemented capabilities are a classic “works in Inspector, breaks in the host” bug.

Step 3: List and call tools

Tools are what agents use most, so test them hardest. List them first:

npx mcp-inspector --cli npx mcp-server-everything \
  --method tools/list --format json | jq -c '[.result.tools[].name]'

The Everything server returned 17 names, from echo to get-roots-list. In the web UI, the Tools tab builds a form from each input schema. Read every description as the model would: is it clear when to call the tool and what each argument means? Vague descriptions break agents as often as bad code.

Then call one tool:

npx mcp-inspector --cli npx mcp-server-everything --method tools/call \
  --tool-name echo --tool-args-json '{"message":"hello"}' --format json
# {"result":{"content":[{"type":"text","text":"Echo: hello"}]}}

--tool-arg key=value is repeatable and JSON-parses each value (--tool-arg a=2 --tool-arg b=3 on get-sum returned “The sum of 2 and 3 is 5.”), so a zip code like 10001 arrives as a number. --tool-args-json sends one object verbatim; use it for anything typed.

Test failure paths too. Calling a tool that doesn’t exist returns {"error":{"code":"tool_not_found",...}} and exit code 5.

Step 4: Test resources and prompts

The same pattern covers the rest of the server. Only the method and result key change:

What to check Method Result key
Static resources resources/list .result.resources
Resource templates resources/templates/list .result.resourceTemplates
Prompts prompts/list .result.prompts

The Everything server returned 8 resources and 4 prompts. In the web UI, open each resource and fetch each prompt with arguments. Check MIME types, and that every advertised URI can actually be read.

Step 5: Turn MCP Inspector checks into a CI smoke test

Clicking through the UI finds bugs once; a smoke test stops them coming back. The CLI prints one JSON object and exits with a code per failure class:

Exit code Meaning
0 Success
3 Authentication failed or required
4 Server unreachable
5 Tool error (isError: true, or tool not found)
11 Server rate limited the request (HTTP 429)

A minimal script:

#!/usr/bin/env bash
set -euo pipefail
mcp() {
  npx --yes @modelcontextprotocol/inspector@2.17.0 --cli \
    --transport http --server-url "$SERVER_URL" \
    --connect-timeout 10000 --format json "$@"
}
mcp --method initialize | jq -e '.result.protocolVersion' > /dev/null
mcp --method tools/list \
  | jq -e '[.result.tools[].name] | index("echo")' > /dev/null
mcp --method tools/call --tool-name echo --tool-args-json '{"message":"ping"}' \
  | jq -e '.result.isError != true' > /dev/null
echo "smoke OK"
Sequence: a CI job runs the Inspector CLI, which sends initialize, tools/list and tools/call to the MCP server; jq asserts each JSON result and any non-zero exit code fails the job

Three rules from the official CLI smoke-testing guide are worth following:

Automate MCP server tests with Apidog CLI and your coding agent

The smoke script proves the server is alive. A real suite also needs reports, environments and run history. Don’t write it by hand: let your coding agent (Claude Code, Codex, Cursor) drive Apidog CLI and build it.

A remote MCP server is an HTTP endpoint that speaks JSON-RPC, so each Inspector check becomes one HTTP step. Two details from the Streamable HTTP transport spec matter: the request must send Accept: application/json, text/event-stream (our local server answered 406 Not Acceptable without it), and the reply may arrive as an SSE stream, so assertions check the response text.

Set up once:

npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com   # pick your agent when prompted

Then give your agent one prompt:

In Apidog project <projectId>, create a test scenario called "MCP Inspector checks,
automated" with three custom HTTP steps against https://mcp.deepwiki.com/mcp, each
sending Accept: application/json, text/event-stream. Step 1: initialize, assert 200
and that protocolVersion and serverInfo are returned. Step 2: tools/list, assert
read_wiki_structure and ask_wiki_question are listed. Step 3: tools/call
read_wiki_structure for modelcontextprotocol/inspector, assert no isError and text
content. Read the CLI schema and validate before writing, then run it.

The agent reads the schema, validates its payload, writes the scenario and runs it:

apidog cli-schema get test-scenario-update
apidog cli-schema validate test-scenario-update --file steps.json
apidog test-scenario create --project <projectId> --file create.json
apidog test-scenario update <scenarioId> --project <projectId> --file steps.json
apidog run -t <scenarioId> --project <projectId> -e <envId> -r cli

We ran exactly that against the public DeepWiki MCP server, which needs no auth. Three requests, nine assertions, all passing:

Apidog CLI running a sandbox scenario that replays MCP Inspector checks against the DeepWiki MCP server: initialize, tools/list and tools/call, 9 of 9 assertions pass

Swap in your server’s URL and add a step per tool you depend on. For CI, change the reporter to -r junit and follow our Apidog CLI CI/CD pipeline guide; for agent setup details, see Apidog CLI in Claude Code. For a broader test plan, including mocking the upstream APIs your tools call, read our MCP server testing playbook.

Once more than one person runs these agents, Sharkly helps: it’s a board where your team assigns tasks like “add a test step for every new MCP tool” to coding agents running on your own computers with your own Claude Code or Codex plan, and reviews what they ship before it merges. It’s free to start.

Common MCP Inspector problems and fixes

Symptom Likely cause Fix
unreachable, “Connection timed out after 15000 ms” npx still downloading the server, or a slow start Install the server first, or raise --connect-timeout
406 Not Acceptable on HTTP Client didn’t accept both JSON and SSE Send Accept: application/json, text/event-stream
Exit 3, auth_required Server wants OAuth or a token Pass --header "Authorization: Bearer ..." in CI
Garbled stdio output Server logs to stdout Log to stderr; stdout carries the protocol

Conclusion

MCP Inspector shows your server exactly as a client sees it. Explore in the web UI, lock checks into CI with the CLI, and hand the growing suite to your coding agent with Apidog CLI. Try Apidog free and turn your next Inspector session into a test that runs on every commit.

FAQ

Is MCP Inspector free?

Yes. It’s open source, published on npm as @modelcontextprotocol/inspector, and runs locally with npx. No account needed.

What’s the difference between the MCP Inspector web UI and CLI?

The web UI is for exploring by hand. The CLI prints one JSON object per command with stable exit codes, so scripts and CI can assert on it.

Can MCP Inspector test remote MCP servers?

Yes. Use --transport http --server-url <url> for Streamable HTTP or --transport sse for SSE. In CI, pass a bearer token with --header instead of interactive OAuth.

What port does MCP Inspector use?

The v2 web UI runs on port 6274 by default, with the MCP Apps sandbox on 6275. Change them with CLIENT_PORT and MCP_SANDBOX_PORT. Port 6277, the v1 proxy port, is retired.

How do I upgrade a v1 MCP Inspector script?

Exit codes, argument ordering and the -- separator changed in v2, so read the v1 to v2 migration guide in the Inspector repository before porting. If you need v1 meanwhile, npx @modelcontextprotocol/inspector@v1-latest still works.

Explore more

How to Run Soma-1X Lite Locally: Turn PDFs into Structured JSON with vLLM

How to Run Soma-1X Lite Locally: Turn PDFs into Structured JSON with vLLM

A hands-on Soma-1X Lite tutorial: serve the 2B open OCR model with vLLM or llama.cpp, render PDF pages with PyMuPDF, call the OpenAI-compatible endpoint with the trained prompts, parse the block output into JSON, and let your coding agent test the endpoint with Apidog CLI.

1 December 2026

Best Open-Source OCR Models in 2027

Best Open-Source OCR Models in 2027

Eight open OCR models compared on size, licence, olmOCR-Bench score, output format, handwriting and local runtimes, with pick-X-if guidance and a way to test two side by side.

1 December 2026

Claude Code Router: How to Run Claude Code With Any Model

Claude Code Router: How to Run Claude Code With Any Model

Want to run Claude Code with any model? Learn how Claude Code Router connects GLM, DeepSeek and OpenRouter, then set up routing and fallbacks.

1 December 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs

How to Use MCP Inspector to Test Your MCP Server