feat: add support for stateless MCP 2026 draft and protocol negotiation fallback#699
Merged
Conversation
…648) * feat: Add support for SEP-2575 * chore: remove error logs * chore: fix presubmits * chore: add todo * feat(core): support DRAFT-2026-v1 stateless transport and version negotiation retry limit * style: format python transport files with black and isort * refactor: move Protocol import to the top of the file * test: filter out draft versions in Go E2E tests, add todo remarks, and update protocol unit test expected versions * docs: add error requirements docstring in conformance client script * fix(core): update stateless protocol version retry logic to use spec-compliant -32004 code * fix(core): align ClientCapabilities Pydantic schema with spec * refactor: simplify version negotiation retry logic in MCP transport * chore: delint * refactor(core): implement transport proxy for protocol fallback * chore: delint * fix: fix integration tests * chore: delint * chore: fix license header Co-authored-by: Averi Kitsch <akitsch@google.com> * chore: remove unused retry logic from inside the transport class * chore: delint --------- Co-authored-by: Averi Kitsch <akitsch@google.com>
* test: upgrade integration harnesses for dual-server execution * chore: delint * test: update E2E protocol fallback assertions to support dynamic server URLs and ignore noise warnings in tool tests * chore: update package dependencies and metadata across all sub-packages * refactor: remove platform-specific .exe extension from toolbox binary path resolution in test configurations * refactor: convert patch_toolbox_client_url to an explicit fixture and apply it to E2E tests via pytestmark * refactor: reorder imports and constants in test conftest files for consistency * fix: remove autouse from patch_toolbox_client_url fixture to prevent unnecessary patching in integration tests
dishaprakash
approved these changes
Jul 9, 2026
* feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback (#704) * feat(core): add custom protocols array support for ToolboxClient * resolve PR 707 review comments * remove redundant constant definitions in conftest.py * test: fix conftest import locations and update readme links * refactor: consolidate fallback mechanism tests into test_client.py and remove redundant test_fallback.py * chore: delint * refactor: centralize test constants into package-specific files and update imports across test suites * test: update integration tests to use stable server URL constant * refactor: remove redundant pytestmark fixture declaration in integration tests * test: update integration tests to use TOOLBOX_SERVER_URL_STABLE for server connections * chore: delint * fix: add comments for dual-server to test fixtures * fix: update protocol negotiation error code from -32004 to -32022 across all transport versions * chore: delint * feat: implement automated MCP protocol version negotiation for old MCP versions * fix: update error code to -32022 for detecting server-supported protocol versions * fix: parse standard json-rpc errors on http 400 * feat: add automated protocol version fallback negotiation for invalid protocol version errors across all MCP transports * refactor: fix integration tests by replacing aioresponses with AsyncMock * test: update exception match regex to include MCP invalid request code in e2e tests and add debug script * test: use try/except for flexible auth error matching in e2e tests * fix(core): handle json-rpc error dict for protocol version mismatch * fix(core): match unsupported protocol version in error dict and fix lint * Fix unit tests related to _meta JSON error parsing, mock misconfiguration, and version negotiation array index checks * style: Run black and isort to fix lint CI errors * style: Run black across all packages * style: fix isort formatting with black profile * style: reformat imports per package to respect first-party modules * refactor: extract -32022 to constant and add missing fallback tests * style: move UNSUPPORTED_PROTOCOL_VERSION_ERROR_CODE to top of types.py * Extract -32022 into constant for v20260618 transport * Add missing test_version_negotiation_raises_fallback to legacy versions
This was referenced Jul 9, 2026
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 introduces support for the MCP 2026 stateless draft and associated protocol-level enhancements. The most significant additions include stateless transport support, HTTP routing headers, and robust protocol auto-negotiation mechanisms for seamless backwards compatibility.
Changes
DRAFT-2026-v1stateless transport protocol.ToolboxClient.-32022) for protocol version mismatch and graceful fallback across all MCP transports.