feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback#704
Merged
Merged
Conversation
9511caf to
261bb86
Compare
This reverts commit ee00b9e.
…stable and draft MCP versions
e821d64 to
caf7b85
Compare
Contributor
Author
|
This PR is rolled-up in #703 to override some of the intermediate changes and make it easier to review. |
anubhav756
added a commit
that referenced
this pull request
Jul 1, 2026
…tion fallback (#704) * feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback * fix: Keep the MCP_LATEST to stable version but point MCP_DRAFT to 2026 draft * chore: fix integration tests * chore: delint * chore: fix tests * test: increase integration test coverage * chore: delint * test: integrate the draft build with dual testing modes * fix(tests): correct pytest async fixtures and auto-format with black/isort * fix(tests): use pytest.fixture for sync fixtures and fix isort formatting * fix(tests): update binary URL for draft testing in all packages * chore: fix integration tests url and lint errors * chore: test with mcp-v202606 branch to fix unknown flag error * fix(test): core fallback and adk toolset import * chore: format files * Revert "chore: format files" This reverts commit ee00b9e. * chore(test): fix line length in bucket name selection * chore: bump TOOLBOX_VERSION to v1.6.0 * test: parameterize integration tests to run comprehensively for both stable and draft MCP versions
anubhav756
added a commit
that referenced
this pull request
Jul 1, 2026
…tion fallback (#704) * feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback * fix: Keep the MCP_LATEST to stable version but point MCP_DRAFT to 2026 draft * chore: fix integration tests * chore: delint * chore: fix tests * test: increase integration test coverage * chore: delint * test: integrate the draft build with dual testing modes * fix(tests): correct pytest async fixtures and auto-format with black/isort * fix(tests): use pytest.fixture for sync fixtures and fix isort formatting * fix(tests): update binary URL for draft testing in all packages * chore: fix integration tests url and lint errors * chore: test with mcp-v202606 branch to fix unknown flag error * fix(test): core fallback and adk toolset import * chore: format files * Revert "chore: format files" This reverts commit ee00b9e. * chore(test): fix line length in bucket name selection * chore: bump TOOLBOX_VERSION to v1.6.0 * test: parameterize integration tests to run comprehensively for both stable and draft MCP versions
anubhav756
added a commit
that referenced
this pull request
Jul 2, 2026
…tion fallback (#704) * feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback * fix: Keep the MCP_LATEST to stable version but point MCP_DRAFT to 2026 draft * chore: fix integration tests * chore: delint * chore: fix tests * test: increase integration test coverage * chore: delint * test: integrate the draft build with dual testing modes * fix(tests): correct pytest async fixtures and auto-format with black/isort * fix(tests): use pytest.fixture for sync fixtures and fix isort formatting * fix(tests): update binary URL for draft testing in all packages * chore: fix integration tests url and lint errors * chore: test with mcp-v202606 branch to fix unknown flag error * fix(test): core fallback and adk toolset import * chore: format files * Revert "chore: format files" This reverts commit ee00b9e. * chore(test): fix line length in bucket name selection * chore: bump TOOLBOX_VERSION to v1.6.0 * test: parameterize integration tests to run comprehensively for both stable and draft MCP versions
anubhav756
added a commit
that referenced
this pull request
Jul 3, 2026
…tion fallback (#704) * feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback * fix: Keep the MCP_LATEST to stable version but point MCP_DRAFT to 2026 draft * chore: fix integration tests * chore: delint * chore: fix tests * test: increase integration test coverage * chore: delint * test: integrate the draft build with dual testing modes * fix(tests): correct pytest async fixtures and auto-format with black/isort * fix(tests): use pytest.fixture for sync fixtures and fix isort formatting * fix(tests): update binary URL for draft testing in all packages * chore: fix integration tests url and lint errors * chore: test with mcp-v202606 branch to fix unknown flag error * fix(test): core fallback and adk toolset import * chore: format files * Revert "chore: format files" This reverts commit ee00b9e. * chore(test): fix line length in bucket name selection * chore: bump TOOLBOX_VERSION to v1.6.0 * test: parameterize integration tests to run comprehensively for both stable and draft MCP versions
anubhav756
added a commit
that referenced
this pull request
Jul 3, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 3, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 3, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 6, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 6, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 6, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 6, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 6, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 6, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 8, 2026
anubhav756
added a commit
that referenced
this pull request
Jul 8, 2026
anubhav756
added a commit
that referenced
this pull request
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
added a commit
that referenced
this pull request
Jul 9, 2026
…on fallback (#699) * feat(core): implement reference support for Stateless MCP (SEP-2575) (#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> * feat(core): implement SEP-2243 routing headers for HTTP transport (#701) * test: upgrade integration harnesses for dual-server execution (#706) * 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 * feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback (#703) * feat(core): add support for MCP 2026 stateless draft and auto-negotiation fallback (#704) * chore: delint * feat: support user-defined fallback protocols array (#707) * 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 --------- Co-authored-by: Averi Kitsch <akitsch@google.com>
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.
This PR adds support for the upcoming MCP 2026 stateless draft (
DRAFT-2026-v1) and introduces protocol auto-negotiation fallback to ensure smooth backward compatibility with older servers.MCP_DRAFTconstant pointing toDRAFT-2026-v1alongsideMCPandMCP_LATEST.UnsupportedProtocolVersionError, the client manually triggersProtocolNegotiationErrorand falls back to the server's preferred version.test_protocol_fallback_e2eto verify negotiation down to older versions.core,adk,langchain, andllamaindexintegrations.