Skip to content

Mcp-Protocol-Version header missing when client Connection is wrapped #1109

Description

@jan-xyz

streamableClientConn.setMCPHeaders derives the Mcp-Protocol-Version header exclusively from c.initializedResult, which is populated only through the unexported clientConnection.sessionUpdated hook. Client.Connect reaches that hook via a type assertion on the Connection returned by the Transport:

if hc, ok := cs.mcpConn.(clientConnection); ok {
    hc.sessionUpdated(cs.state)
}

That assertion silently fails whenever the Connection is wrapped by another type that exposes only the exported Connection interface. c.initializedResult then stays nil for the life of the session, and every SEP-2575 (>= 2026-07-28) request sent through that connection is missing the Mcp-Protocol-Version header. Servers that validate the header per spec reject the request with 400 Bad Request, closing the connection.

This is currently breaking the GitHub MCP with the 1.7-pre releases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions