mcp-toolbox-sdk-python
mcp-toolbox-sdk-python copied to clipboard
feat(core): implement reference support for Stateless MCP (SEP-2575)
Description
This PR introduces reference client support for Stateless MCP (SEP-2575) according to conformance tests in https://github.com/modelcontextprotocol/conformance/pull/270, transitioning the SDK to a stateless-first architecture for the upcoming MCP version.
Changes
- Added new stateless transport (
v20260618)- Created
McpHttpTransportV20260618which skips the monolithicinitializesession handshake, keeping connections completely stateless. - Automatically populates the required
_metaparameters (protocolVersion,clientInfo,clientCapabilities) on every request. - Appends the mandatory
MCP-Protocol-VersionHTTP header to every outgoing POST request.
- Created
- Added support for inline version negotiation
- Implemented automatic version negotiation and retry loop prevention
- intercepts server
UnsupportedProtocolVersionError(-32004) responses, intersects available versions, and retries the request inline with the negotiated version.
- intercepts server
- Implemented automatic version negotiation and retry loop prevention
- Added Pydantic models strictly mapped to the stateless draft schema.
- Added unit tests for the new transport.
- Updated the client conformance harness
client.pyto support execution of therequest-metadatascenario.
- Updated the client conformance harness
Checklist
- [x] Unit tests pass.
- [x] Conformance suite stateless checks pass.
/gcbrun