Add automated MCP schema regression testing#113
Open
caballeto wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds regression test coverage for MCP tool interactions using mcp-recorder -- like VCR.py but for MCP servers. Records the full protocol exchange into a JSON cassette and verifies it hasn't changed on every push.
What this covers
A single cassette (
protocol_and_errors.json) captures 7 interactions:initializeresponse with protocol version, capabilities, server infotools/listwith complete input schemas for all 5 tools (50+ parameters total)tools/callfor search, extract, map, and crawl without an API key, verifying theMcpErrorresponseIf a tool is renamed, a parameter is removed, or the error format changes, the CI diff shows exactly what broke.
How it works
The server is spawned via stdio with no
TAVILY_API_KEYset.initializeandtools/listwork normally; tool calls hit the API key guard and return a deterministic error. No network calls, no secrets, no API credits.Changes
All additive -- no existing files modified.
Run locally
pip install -r integration/requirements.txt npm run build mcp-recorder verify \ --cassette integration/cassettes/protocol_and_errors.json \ --target-stdio "node build/index.js"Update after intentional changes
mcp-recorder verify \ --cassette integration/cassettes/protocol_and_errors.json \ --target-stdio "node build/index.js" \ --updateThe cassette diff in the PR review shows exactly what changed in the protocol surface.
Note
Low Risk
Adds a new CI workflow and snapshot cassette that can fail PRs if the MCP protocol/tool schemas or error messages change unexpectedly, but it doesn’t affect production runtime behavior.
Overview
Adds automated snapshot-based integration tests that verify the MCP server’s public protocol surface on every push/PR to
main.CI now builds the server and runs
mcp-recorder verifyagainst a committed golden cassette (integration/cassettes/protocol_and_errors.json) that captures theinitializehandshake,tools/listschemas, and deterministic API-key-missing error responses fortools/callon key tools. Includes supportingintegration/scenarios.yml, Python requirements, and docs for recording/updating cassettes.Written by Cursor Bugbot for commit c83b363. This will update automatically on new commits. Configure here.