Skip to content

feat: implement MCP protocol version header support #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Jul 16, 2025

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

Implementation Details:

  • Added MCP_PROTOCOL_VERSION and MCP_PROTOCOL_VERSION_HEADER_NAME constants to all HTTP transport classes
  • Uses protocol version 2025-06-18 for streamable HTTP transports (WebClientStreamableHttpTransport, HttpClientStreamableHttpTransport)
  • Uses protocol version 2024-11-05 for SSE transports (WebFluxSseClientTransport, HttpClientSseClientTransport) for backwards compatibility
  • Header is included in all HTTP requests (GET, POST, DELETE) across all transport implementations

Specification 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-Version header 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?

  • All existing unit tests pass with the changes
  • HTTP requests now include the MCP-Protocol-Version header in all transport implementations
  • Tested with both streamable HTTP transport (2025-06-18) and SSE transport (2024-11-05) scenarios
  • Verified header is included in GET, POST, and DELETE requests across all affected transport classes

Breaking Changes

No breaking changes. This is a backwards-compatible addition:

  • Existing client code continues to work without modification
  • Only adds required headers to HTTP requests
  • Servers that don't check for the header will continue to function normally
  • Maintains backwards compatibility with older MCP protocol versions

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

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 <[email protected]>
@tzolov tzolov added this to the 0.11.0 milestone Jul 16, 2025
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.

2 participants