Repository navigation
Description
Describe the bug
The protocol version header doesn't get sent for subsequent requests for streamable HTTP transport (and others too looking at the implementation). It's getting dropped at the proxy transport layer.
As per https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#protocol-version-header , protocol version should be sent by the client for all subsequent requests post init. The inspector client running at 6274 does send this, but it gets dropped by the proxy running at 8080 (the default ports in inspector)
To Reproduce
Steps to reproduce the behavior:
- Run https://github.com/modelcontextprotocol/servers/tree/main/src/everything (or any other MCP server) locally with a single change
Added a log line to https://github.com/modelcontextprotocol/servers/blob/4b6ce397924982a93f8af25390b1e7d45073b282/src/everything/streamableHttp.ts#L13 so that we can check the logs.
app.post('/mcp', async (req: Request, res: Response) => {
console.log('Received MCP POST request:', req.body);
console.log('Request headers:', req.headers);
console.error('Received MCP POST request');
-
Run the inspector - tried both quick start and with cloning the repo locally.
-
Connect and then try list tools or any tool call.
Headers on inspector contains the MCP-Protocol-Version header :
Headers received on the server doesn't contain the protocol version header :
Expected behavior
Headers sent from the proxy should contain the MCP-Protocol-Version header.
Logs
Added screenshots of logs. Let me know if anything else is needed.
Additional context
This might also be applicable for last-event-id ?
Not sure if it's the responsibility of the StreamableHTTPClientTransport to make sure that this is passed.
Activity
cliffhall commentedon Aug 11, 2025
Had a look at this, and I believe the problem is that the headers that will be passed through to the server are set when the initial connection is made and the proxy <-> server transport is instantiated. The
mcp-protocol-versionandlast-event-idheaders are only introduced after the initialization handshake.Elsewhere, in the MCP Contributor Discord, we have been questioning the necessity for the proxy for anything but STDIO servers. This is a huge argument for cutting out that middleman and connecting directly to any non-STDIO servers.
I'm going to push this a bit, because I believe the proxy artificially inserting itself in the conversation for non-STDIO servers just means more maintenance and likelihood of failures like this.
cliffhall commentedon Sep 6, 2025
@bh-rat I've put in a fix for this issue. #787