Repository avatar
AI Tools
v0.2.0
active

mcpcheck

io.github.Matrinus/mcpcheck

Verify MCP tool schemas against a lockfile and diagnose your MCP setup.

Documentation

mcpcheck

Diagnose and lock your MCP setup: validate configs, probe servers over stdio, and diff tool schemas in CI so your agent does not silently gain or lose abilities.

CI PyPI GitHub Action License: MIT Python 3.11+

Status: v0.2.0

Demo

# demo: two fixture servers (ok.py, evil.py) in a temporary directory

$ mcpcheck config --config mcp.json
mcp.json (claude)
  fs: stdio
  risky: stdio

$ mcpcheck probe --config mcp.json
name                 status        startup  tools
fs                   ok               11ms      2
risky                ok               11ms      1

$ mcpcheck lock --config mcp.json -o mcp.lock.json
wrote mcp.lock.json

$ mcpcheck verify --config mcp.json --lock mcp.lock.json
no changes

$ mcpcheck verify --config mcp-v2.json --lock mcp.lock.json
~ fs.echo
0 added, 0 removed, 1 changed

$ mcpcheck doctor --config mcp.json --security
info DOC006 risky.exec_shell (mcp.json): tool name looks like it executes or writes: exec_shell
  hint: Disable this tool for untrusted models or scope what it can reach. Treat this as a signal, not a verdict: heuristic, review manually.
info DOC007 risky.exec_shell (mcp.json): description contains "ignore previous": exec_shell
  hint: Inspect the description and consider pinning the server version. Treat this as a signal, not a verdict: heuristic, review manually.
0 errors, 0 warnings, 2 info

all 6 steps behaved as expected

The transcript above is the output of demo.sh on the fixture servers: config and probe see both servers, the lock matches, a changed schema turns verify red, and doctor --security flags the risky tool as info only.

Install

pipx install mcpcheck-cli            # recommended: isolated environment
pip install mcpcheck-cli             # or into the current environment
pipx install git+https://github.com/Matrinus/mcpcheck   # latest from source

The distribution is mcpcheck-cli; the installed command is mcpcheck. Python 3.11+.

Quickstart

mcpcheck config --config mcp.json                # validate the config and resolve ${VAR}
mcpcheck probe --config mcp.json                 # start each server and read its tools
mcpcheck lock --config mcp.json -o mcp.lock.json # record schemas in a lockfile
mcpcheck verify --config mcp.json --lock mcp.lock.json # compare live tools with the lock
mcpcheck doctor --config mcp.json --security     # aggregate findings and security hints

What it does

commandreturnsexit code
configdiscovered/validated configs, resolved env, config errors0, 1, 2
probeper-server status, startup ms, tools, schema hashes, resources0, 1, 2
lockwrites mcp.lock.json for servers that answered0, 2, 3
verifyadded / removed / changed tools versus the lockfile0, 1, 2, 3
doctorfindings DOC001–DOC009 with severity and an actionable hint0, 1, 2
servemcpcheck as an MCP server over stdio, exposing verify and doctor0, 2

--json is available on every reporting command and is byte-stable across runs: no timestamps, sorted keys. The only exception is startup_ms in probe, which measures real process startup; serve speaks JSON-RPC instead of --json.

How it works

mcpcheck speaks JSON-RPC over stdio itself: one JSON message per line, initialize + notifications/initialized, a deadline on every read, and a process-group kill on timeout or close. It then sends tools/list (following nextCursor) and resources/list. Each tool is hashed as the SHA-256 of its canonical JSON schema with sorted keys, so a new parameter changes the hash while reformatting the config does not. Environment values are expanded and handed to the child process, but never serialized: --json carries only env_keys, so secrets stay out of logs and CI output.

What it does not do

  • HTTP/SSE transports — remote servers are reported as unsupported (v0.2).
  • OAuth or any interactive auth; a server that needs a browser cannot be probed.
  • Tools are never called, so it cannot tell you whether a tool works.
  • The --security checks are heuristics on names and descriptions, not an audit.
  • Linux and macOS only in v0.1.

Exit codes

codemeaning
0success; changes outside the --fail-on policy are still printed
1config errors, unreachable servers, findings (with --strict also warns), or changes inside the policy
2usage error, unreadable or invalid config/lockfile
3a server did not respond during lock/verify, so nothing was compared

Use as a GitHub Action

The composite action installs its own Python 3.12 and runs mcpcheck verify, failing the job on changes inside fail-on (any by default):

- uses: actions/checkout@v4
- uses: Matrinus/mcpcheck@v0.1.0
  with:
    config: .mcp.json
    lock: mcp.lock.json
    fail-on: any

Inputs: config (default .mcp.json), lock (default mcp.lock.json), fail-on (any, added, removed or changed) and timeout in seconds (default 5). Pin the tag to the version of mcpcheck that wrote the lockfile; see action.yml for the full definition.

Use it as an MCP server

mcpcheck serve makes mcpcheck itself an MCP server over stdio, so an agent can check its own environment. It exposes exactly two read-only tools, verify and doctor. Add it to a client config:

{"mcpServers":{"mcpcheck":{"command":"mcpcheck","args":["serve"]}}}

Arguments are limited to config paths (.json/.toml), lock, fail_on, security and timeout; no command, args or env is accepted, so nothing from the client is executed, and each response is capped at 8192 bytes. See docs/mcp-server.md for the protocol, tools and limits.

Listed in the official MCP Registry as io.github.Matrinus/mcpcheck, so registry-aware clients and catalogs can find and install it.

Roadmap

  • v0.2 — own MCP server (serve) with verify and doctor as tools; HTTP/SSE transports, --watch, pre-commit hook.
  • v0.3 — per-project policy (policy.yaml), SARIF export for code scanning.
  • v0.4 — compare two machines: what one has that the other does not.

See docs/design.md for the decisions behind v0.1.

Contributing

See CONTRIBUTING.md. New config formats and new doctor rules are designed to be small, self-contained contributions; make check must pass and bash demo.sh must stay green.

License

MIT — see LICENSE.

PYPI
mcpcheck-cli
Install Command
pip install mcpcheck-cli