add compatibility language to version header requirement by bhosmer-ant · Pull Request #668 · modelcontextprotocol/modelcontextprotocol

@bhosmer-ant

halter73

@bhosmer-ant bhosmer-ant deleted the basil/version_header_compatibility branch

June 6, 2025 22:34

felixweinberger added a commit to modelcontextprotocol/python-sdk that referenced this pull request

Jun 9, 2025
…ader

When the MCP-Protocol-Version header is not present in requests, the server
now assumes protocol version "2025-03-26" instead of returning an error.
This maintains backwards compatibility with older clients that don't send
the version header.

The server still validates and returns 400 Bad Request for invalid or
unsupported protocol versions when the header is explicitly provided.

This change addresses the backwards compatibility requirement from
modelcontextprotocol/modelcontextprotocol#668

- Modified _validate_protocol_version to assume "2025-03-26" when header is missing
- Updated tests to verify backwards compatibility behavior
- Added new test specifically for backwards compatibility scenario

@ihrpr ihrpr mentioned this pull request

Jun 9, 2025

felixweinberger added a commit to modelcontextprotocol/python-sdk that referenced this pull request

Jun 12, 2025
…ader

When the MCP-Protocol-Version header is not present in requests, the server
now assumes protocol version "2025-03-26" instead of returning an error.
This maintains backwards compatibility with older clients that don't send
the version header.

The server still validates and returns 400 Bad Request for invalid or
unsupported protocol versions when the header is explicitly provided.

This change addresses the backwards compatibility requirement from
modelcontextprotocol/modelcontextprotocol#668

- Modified _validate_protocol_version to assume "2025-03-26" when header is missing
- Updated tests to verify backwards compatibility behavior
- Added new test specifically for backwards compatibility scenario

This was referenced

Feb 12, 2026