feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback#703
Open
anubhav756 wants to merge 1 commit into
Open
feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback#703anubhav756 wants to merge 1 commit into
anubhav756 wants to merge 1 commit into
Conversation
802cb5e to
bc8837b
Compare
Contributor
Author
5a88785 to
fc0c7cd
Compare
e41ec74 to
eb3cf50
Compare
Yuan325
approved these changes
Jul 1, 2026
Yuan325
left a comment
Contributor
There was a problem hiding this comment.
Approve with a comment for clarification~
d86e41f to
58c7b78
Compare
994fbdf to
f81589a
Compare
Contributor
|
nit: Could you link to the MCP draft/source of truth for this PR? |
dishaprakash
reviewed
Jul 2, 2026
Contributor
Author
This PR actually isn't directly implementing an MCP SEP, but adapting to recent changes from the server. However, the most relevant SEP is https://modelcontextprotocol.io/seps/2575-stateless-mcp#unsupported-protocol-versions that has the error codes that we are handling here. Hope that helps. |
a8a71db to
264348c
Compare
f81589a to
1b769cf
Compare
874e2c4 to
7030fc0
Compare
1b769cf to
51e553c
Compare
7030fc0 to
ed2ca21
Compare
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.
Description
This PR standardizes the Python SDK's version opt-in strategy for the upcoming stateless draft and introduces protocol auto-negotiation fallback to ensure smooth backward compatibility with older servers.
Note
This PR is stacked on top of the test infrastructure changes in #706.
Changes:
protocol.py):Protocol.MCP_DRAFTconstant mapped to"DRAFT-2026-v1"to give developers a safe way to opt into testing the draft spec without hardcoding ephemeral version strings.Protocol.MCP_LATESTmapped to the stable2025-11-25release to ensure production workloads remain unaffected.client.py&mcp.py):-32004UnsupportedProtocolVersionError), the transport layer now safely raises aProtocolNegotiationError.test_e2e_mcp.py):test_protocol_fallback_e2eto verify smooth protocol negotiation downgrades against older servers. Leveraging the dual-server harness from test: upgrade integration harnesses for dual-server execution #706, this test proves that a client requestingMCP_DRAFTsuccessfully falls back when hitting port5000, but correctly utilizes the draft protocol on port5001.