Skip to content

Conversation

cliffhall
Copy link
Member

@cliffhall cliffhall commented Sep 15, 2025

Description

When the client sends a request, do not pass on the mcp-session-id header for the Client <-> Proxy connection. This causes a problem for stateless http connections.

Motivation and Context

The changes in #787 introduced an unexpected side effect for stateless StreamableHttp connections. They don't return an mcp-session-id, but the function that forwards headers was passing on the mcp-session-id for the Client <-> Proxy transport. Therefore the server, which does not recognize this session id will return a 404 error according to spec.

Researching the headers being sent, it was that the Client <-> Proxy session id was being sent if no mcp-session-id was returned from the server.

This fixes #804

How Has This Been Tested?

With the server in #804 that was failing before. Works now.
Screenshot 2025-09-15 at 6 21 15 PM

Still works with Everything server, which gets it's proper session id sent on the Proxy <-> Server transport.

Breaking Changes

Nope.

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

Additional context

…ader for the Client <-> Proxy connection. This causes a problem for stateless SSE or StreamableHttp connections.
@olaservo olaservo merged commit 19e12e2 into modelcontextprotocol:main Sep 16, 2025
5 checks passed
@cliffhall cliffhall deleted the fix-stateless-http-connections branch September 16, 2025 22:35
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.

v0.16.7 connection regression: "Error accessing endpoint (HTTP 404)"
2 participants