feat: add MCP version compatibility scenarios - #464
Open
LucaButBoring wants to merge 1 commit into
Open
Conversation
commit: |
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 coverage for clients that communicate with both draft and initialization-era MCP servers.
The client scenario verifies that a dual-era client sends a valid modern request before falling back to the fixed
2025-11-25protocol version. The reference client caches the detected server era by HTTP origin and repeats detection when a cached legacy assumption fails.Legacy-server response behavior remains a non-scored diagnostic because the MCP specification permits legacy servers to reject, ignore, or process an era-ambiguous request under legacy semantics.
Motivation and Context
The draft Streamable HTTP compatibility rules define a specific fallback sequence for clients that support both protocol eras. A client sends a valid modern request first. It falls back only when the server returns HTTP 400 without a recognized modern JSON-RPC error.
The previous implementation accepted any HTTP 4xx response, omitted the required
Mcp-Methodheader, and treated legacy-server behavior as a scored conformance requirement. These checks could accept invalid client behavior and require behavior that the specification does not impose on legacy servers.The change adds shared compatibility helpers for request construction, response classification, bounded body handling, and strict JSON-RPC error-envelope validation. It also removes the normative legacy-server scenario from the registry and retains equivalent coverage as a diagnostic.
How Has This Been Tested?
The following validation passed locally:
npm run checknpm run buildversion-backcompatclient scenario through the conformance CLInotifications/initialized, andtools/listThe tests cover:
-32020,-32021, and-32022Breaking Changes
No user code or configuration changes are required.
The draft client suite no longer includes pending scenarios. The legacy-server compatibility check is no longer a scored conformance scenario because the specification does not define one required legacy-server response.
Types of changes
Checklist
Additional context
The initialization-era boundary is fixed at
2025-11-25. It does not derive from the repository's latest protocol-version constant.Modern error recognition requires an HTTP 400 response with an
application/jsoncontent type and a valid JSON-RPC 2.0 error envelope. The response ID must match the modern probe request ID.The fixture subprocess binds to
127.0.0.1on an operating-system-selected port. Direct execution of the example server continues to use port3010by default.This PR was written using GPT-5.6 Sol in Kiro Crew.