feat: implement MCP protocol version header support#404
Merged
Conversation
acheshkov
approved these changes
Jul 18, 2025
|
how to config ? |
This was referenced Jul 22, 2025
Closed
Add MCP-Protocol-Version header to all HTTP requests as required by MCP specification 2025-06-18. This enables proper server-side version negotiation and backwards compatibility handling. - Add protocol version constants (2025-06-18 for streamable HTTP, 2024-11-05 for SSE) - Include MCP-Protocol-Version header in all GET/POST/DELETE requests - Update WebClientStreamableHttpTransport, WebFluxSseClientTransport, HttpClientSseClientTransport, and HttpClientStreamableHttpTransport Complies with MCP specification requirement that HTTP clients MUST include protocol version header on all requests to MCP servers. Related to #398 , #363 , #250 Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
- Add protocolVersion() method to transport and transport provider interfaces and implementations - Replace hardcoded HTTP header strings with HttpHeaders constants - Update protocol versions to be transport-specific rather than global - Deprecate McpSchema.LATEST_PROTOCOL_VERSION in favor of transport-specific versions - Standardize header names: MCP-Protocol-Version, mcp-session-id, last-event-id - Update clients and servers to use transport.protocolVersion() for initialization - Refactor tests to use transport-specific protocol versions This change improves maintainability by centralizing header name constants and allows different transports to support different protocol versions independently. Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
b9c6c90 to
c477064
Compare
|
i see that
in sourc code Did you mean because release note said |
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.
Add MCP-Protocol-Version header to all HTTP requests as required by MCP specification 2025-06-18. This enables proper server-side version negotiation and backwards compatibility handling.
Complies with MCP specification requirement that HTTP clients MUST include protocol version header on all requests to MCP servers.
Related to #398 , #363 , #250
Implementation Details:
MCP_PROTOCOL_VERSIONandMCP_PROTOCOL_VERSION_HEADER_NAMEconstants to all HTTP transport classes2025-06-18for streamable HTTP transports (WebClientStreamableHttpTransport, HttpClientStreamableHttpTransport)2024-11-05for SSE transports (WebFluxSseClientTransport, HttpClientSseClientTransport) for backwards compatibilitySpecification Reference:
This change ensures full compliance with the MCP specification requirement that "the client MUST include the MCP-Protocol-Version HTTP header on all subsequent requests to the MCP server."
Add MCP protocol version header support to all HTTP transport implementations as required by MCP specification 2025-06-18.
Motivation and Context
The MCP specification 2025-06-18 requires that HTTP clients MUST include the
MCP-Protocol-Versionheader on all requests to MCP servers. This enables:Without this header, servers cannot properly handle version-specific behavior and may not function correctly with clients using different protocol versions.
How Has This Been Tested?
Breaking Changes
No breaking changes. This is a backwards-compatible addition:
Types of changes
Checklist