Install: pip install mcp-testbench |
PyPI: pypi.org/project/mcp-testbench
What a snapshot is
A snapshot is the normalized JSON schema of everything an MCP server publishes: its tools (with input and output schemas), prompts (with arguments) and resources, plus the server info and protocol version from the handshake. It is produced from the live server -- or from an offline JSON definition -- and it is small, sorted and diff-friendly, so it reviews well in a pull request.
mcp-testbench snapshot -o mcp-snapshot.json -- python my_server.py
git add mcp-snapshot.json && git commit -m "mcp snapshot"
Checking against the snapshot
mcp-testbench check mcp-snapshot.json -- python my_server.py
mcp-testbench check mcp-snapshot.json --url http://localhost:8000/mcp
mcp-testbench check mcp-snapshot.json --definition server.json # offline
Every difference is classified -- see Breaking changes for the full rules:
| Class | Meaning | Fails check? |
|---|---|---|
breaking | existing callers can break (tool removed, parameter removed, optional became required, type narrowed, ...) | yes -- exit 1 |
non-breaking | additive / widening changes | no |
routing | description or annotation-hint changes -- no call breaks, but an agent may choose differently | no |
cosmetic | title changes | no |
Diffs are deep: local $ref pointers are resolved and nested
changes are reported with dotted paths such as
tool echo.input.config.timeout.
Updating a snapshot intentionally
When a change is deliberate, regenerate the snapshot and commit it in the same pull request -- the snapshot diff in the PR is the contract review:
mcp-testbench snapshot -o mcp-snapshot.json -- python my_server.py
In pytest, the mcp_snapshot fixture writes the snapshot on
first run and compares on later runs; pass --mcp-update-snapshots
to rewrite snapshots instead of comparing.
Why not just diff the source code?
Source diffs show what you edited. Schema snapshots show what your callers -- agents and clients -- actually see, including changes produced by framework upgrades, code generation, or a dependency's schema builder. That is the surface where breaking changes happen.