Describe the bug
The SSE transport in MCP does not pass session ID, authentication info, or request headers through to MCP message handlers, while the StreamableHTTP transport does. This creates feature parity issues between the two transport methods and prevents SSE-based MCP connections from accessing critical request context like authentication tokens and custom headers.
To Reproduce
Steps to reproduce the behavior:
- Set up an MCP Agent using SSE transport with McpAgent.serveSSE() or McpAgent.serve() with transport: "sse"
- Add authentication middleware that sets request.auth with user credentials
- Connect to the agent using an MCP client (e.g., MCP Inspector) over SSE
- Observe that MessageExtraInfo received in the MCP server handlers is undefined, lacking:
- Session ID
- Authentication info (authInfo)
- Request headers (requestInfo.headers)
Expected behavior
SSE transport should have feature parity with StreamableHTTP transport. When MCP messages are received over SSE, the handlers should receive:
- Session ID for tracking connections across requests
- Authentication info from middleware (if present)
- Request headers for accessing custom headers, authorization tokens, etc.
This data should be passed via the MessageExtraInfo parameter, matching the StreamableHTTP implementation.
Screenshots
EXPECTED (via StreamableHTTP)
ACTUAL (via SSE)
Version:
agents@0.2.23
Additional context
This issue is important to our team at MCPcat as we're helping Cloudflare Agents users maintain session tracking via Durable objects in Cloudflare workers.
Describe the bug
The SSE transport in MCP does not pass session ID, authentication info, or request headers through to MCP message handlers, while the StreamableHTTP transport does. This creates feature parity issues between the two transport methods and prevents SSE-based MCP connections from accessing critical request context like authentication tokens and custom headers.
To Reproduce
Steps to reproduce the behavior:
- Session ID
- Authentication info (authInfo)
- Request headers (requestInfo.headers)
Expected behavior
SSE transport should have feature parity with StreamableHTTP transport. When MCP messages are received over SSE, the handlers should receive:
This data should be passed via the MessageExtraInfo parameter, matching the StreamableHTTP implementation.
Screenshots
EXPECTED (via StreamableHTTP)
ACTUAL (via SSE)
Version:
agents@0.2.23
Additional context
This issue is important to our team at MCPcat as we're helping Cloudflare Agents users maintain session tracking via Durable objects in Cloudflare workers.