Skip to content

feat: add support for stateless MCP 2026 draft and protocol negotiation fallback#699

Merged
anubhav756 merged 5 commits into
mainfrom
mcp-v202606
Jul 9, 2026
Merged

feat: add support for stateless MCP 2026 draft and protocol negotiation fallback#699
anubhav756 merged 5 commits into
mainfrom
mcp-v202606

Conversation

@anubhav756

@anubhav756 anubhav756 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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

  • Stateless MCP Support (SEP-2575): Implements reference support for the new DRAFT-2026-v1 stateless transport protocol.
  • Protocol Version Auto-Negotiation & Fallback:
    • Introduces automatic protocol version negotiation for backwards compatibility.
    • Adds support for a user-defined custom fallback protocols array in ToolboxClient.
    • Handles appropriate error codes (-32022) for protocol version mismatch and graceful fallback across all MCP transports.
  • Routing Headers (SEP-2243): Implements routing header support for the HTTP transport.
  • Testing Enhancements:
    • Upgrades integration test harnesses for dual-server execution (testing against stable and new server implementations).

@anubhav756 anubhav756 self-assigned this Jun 23, 2026
@anubhav756 anubhav756 changed the title [Draft] MCP Jule 2026 updates [Draft] MCP July 2026 updates Jun 23, 2026
…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>
@anubhav756 anubhav756 changed the title [Draft] MCP July 2026 updates draft: [Draft] MCP July 2026 updates Jul 2, 2026
@anubhav756 anubhav756 changed the title draft: [Draft] MCP July 2026 updates feat: [Draft] MCP July 2026 updates Jul 2, 2026
* 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
…tion fallback (#703)

* feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback (#704)

* chore: delint
@anubhav756 anubhav756 marked this pull request as ready for review July 9, 2026 11:02
@anubhav756 anubhav756 requested a review from a team as a code owner July 9, 2026 11:02
@anubhav756 anubhav756 changed the title feat: [Draft] MCP July 2026 updates feat: add support for stateless MCP 2026 draft and protocol negotiation fallback Jul 9, 2026
@anubhav756 anubhav756 assigned averikitsch and unassigned anubhav756 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
@anubhav756 anubhav756 merged commit 68263e1 into main Jul 9, 2026
35 checks passed
@anubhav756 anubhav756 deleted the mcp-v202606 branch July 9, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants