← GUIDES

GUIDE / SETUP NOTE

MCP Inspector CLI: Check a Server Before an Agent Uses It

Use the MCP Inspector CLI to list a server's tools and hints, test its calls and read exit codes, so a person can approve it before an agent connects.

21 Nov 2026Checked 2026-10-30
MCP Inspector CLI checks on a notes server: three tools with their annotations, a refused path escape with exit code 5, a delete that did not run, and a newer-protocol delete stopped by a 60-second timeout, for a person to approve

MCP Inspector 2.13.0 (npm), CLI mode, Node 24, run against a local FastMCP 4.1.4 stdio server with two read-only tools and one delete tool that asks a person. Tested 2026-10-30.

MCP Inspector is the MCP project's own tool for testing servers, and its CLI mode runs one command, prints JSON and exits with a code you can check. We pointed it at a small notes server: it showed each tool's read-only or destructive label, proved a path escape was refused, and confirmed the delete tool did not run without a person's answer. One catch: on the newest protocol the CLI waited on the delete's question, so wrap it in a timeout.

The CLI gathers the facts. A person reads them and approves the server before any agent gets it.

What MCP Inspector is (checked on 2026-10-30)

The MCP Inspector ships as one npm package with three clients: a web UI, a CLI and a terminal UI, per the Inspector docs. It needs Node 22.19.0 or newer and runs through npx. We tested version 2.13.0. The repo says the MCP project is moving its licence from MIT to Apache-2.0 for new contributions. It is free and needs no account for local servers.

Based on MCP Inspector, by the Model Context Protocol project and contributors.

The setup at a glance

  • Trigger: you are about to add an MCP server to an agent's client.
  • Permissions: the Inspector starts the server on your machine and calls only what you tell it to. Call write tools only on throwaway data.
  • Output: JSON for each check, plus an exit code: 0 for success, 5 for a tool error, per the smoke-testing guide.
  • Human approval: a person reads the tool list, labels and test results, then decides whether the server goes into the agent's config.

Step 1: Pin the version

bash
npx --yes @modelcontextprotocol/inspector@2.13.0 --cli --help

The smoke-testing guide says plain npx @modelcontextprotocol/inspector picks up the latest release each time, and that CI should pin an exact version.

Step 2: Connect and list the tools

bash
I="npx --yes @modelcontextprotocol/inspector@2.13.0 --cli"
$I python server.py --method initialize --format json
$I python server.py --method tools/list --format json
$I python server.py --method tools/list --strict

initialize is a connect-only probe. tools/list returns each tool with its annotations, such as readOnlyHint and destructiveHint. --strict reports tool-schema portability problems and exits 6 on a serious one, per the CLI README.

Step 3: Test the calls you depend on

bash
$I python server.py --method tools/call --tool-name read_note --tool-arg name=offsite.txt --format json
$I python server.py --method tools/call --tool-name read_note --tool-arg name=../server.py --format json
echo $?

Try one call that should work and one that should be refused. A tool that returns an error exits 5, so a script can stop on it.

Step 4: Check the destructive tool on throwaway data

bash
timeout 60 $I python server.py --method tools/call --tool-name delete_note --tool-arg name=q3-draft.txt --format json
ls notes

Check the folder afterwards, not only the exit code. The CLI cannot answer a server's question, so a well-built delete tool should refuse to run here. The CLI docs point to the web client or the mcpdo connection client for flows that need elicitation. The protocol eras page says the web client pauses each such round for you to answer. We did not test the web client.

What our test showed

CheckResult
initialize, defaultProtocol 2025-11-25. --protocol-era auto or modern gave 2026-07-28
tools/list3 tools; list_notes and read_note readOnlyHint: true, delete_note destructiveHint: true
tools/list --strictExit 0, no portability problems
read_note offsite.txtReturned the note, exit 0
read_note ../server.pyisError: true, "No note named ... in the notes folder", exit 5
delete_note, default era"Not deleted", exit 0, file kept. The CLI did not advertise elicitation and the server's question came back as cancel
delete_note, --protocol-era autoNo result; stopped by timeout after 60 seconds, exit 124, file kept
Install size120 packages, 111 MB in node_modules

The default-era delete exited 0 even though nothing was deleted. Exit codes say whether a call failed, not whether it did what you wanted, so check the result text and the data too.

Things to know

  • The CLI defaults to the older protocol for a server you name on the command line. The protocol eras page says this is deliberate. Test with --protocol-era auto as well if your agent's client uses the newer one.
  • Annotations in the list are the server's own claims. Step 3 is how you check them.
  • On a machine with no keychain, the Inspector docs say it saves OAuth tokens and stdio env: values to ~/.mcp-inspector/secrets.json, unencrypted unless you supply a key. Read the security page before you test a server with real credentials.
  • Run every write tool against copies, never real data.

Takeaway

Run the Inspector CLI over a server before an agent sees it: list the tools, test the calls that matter, check the data afterwards, and let a person approve the result.

Next step: pick one MCP server you use and run Steps 2 and 3 against it, saving the JSON so a person can review it.

How we check the tools we list is on our verification page.

Good setups, worth keeping. Request email updates on the home page, then confirm by email. No subscription starts until you confirm. Or find an agent for the job.

Your privacy choices

Choose optional tools. Rejecting them keeps the setup library available. Advertising consent stays off.

Choices stay in this browser for 90 days. You can change them using Privacy settings. Privacy and cookie details