-
Notifications
You must be signed in to change notification settings - Fork 341
Description
Is your feature request related to a problem? Please describe.
In order to support real-world deployments of MCP, server authors need a way to easily deploy a stateless version of the MCP app, or to implement sticky sessions. Unfortunately for the sticky session approach, many or most sticky session implementations rely on cookies, which are naturally suited for browser-based sessions. However, for a backend API-to-API implementation (such as that of Claude), there is no assumption that Anthropic's implementation will store cookies, as most API-calling services like curl or the vast majority of HTTP SDKs don't by default (e.g. Reqwest).
Instead of implemention what (IMO) is the most logical solution, namely websockets, the Typescript SDK has implemented the "stateless" mode that is implied by the StreamableHttp spec. In this mode, the server omits the Mcp-Session-Id
header, and the request continues without session persistence.
Currently, the Rust SDK does not implement this, and will immediately error if a Mcp-Session-Id
header is not found. Thus, when using this SDK from a kubernetes horizontal autoscaling deployment, 50% of requests time out, making the integration unusable.
Describe the solution you'd like
I haven't probed too deeply into the implementation in Rust, but it seems like the session based persistence is fundamental to the StreamableHttp mode, given that various lifecycle hooks are attached to the session. That said, I'd be happy to probe further if needed to draw out a possible spec.
Describe alternatives you've considered
I'd rather not reimplement our MCP integration in typescript.
Additional context
modelcontextprotocol/typescript-sdk#330
https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/server/streamableHttp.ts