Model Context Protocol · infra · fg-0526

MCP server returns 400 or 404 on session id after initialize when it runs on several instances

400 Bad Request on calls after a successful initialize

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

In protocol versions 2025-03-26 to 2025-11-25, a stateful server keeps the session in process memory, so a request routed to another instance has no session. Servers answer a missing id with 400 and an ended one with 404, after which the client must initialize again.

Fix

Run the server stateless (no session id generator), pin sessions to an instance, or keep session state in a shared store. The 2026-07-28 protocol removes sessions and the Mcp-Session-Id header entirely.

Apply

new StreamableHTTPServerTransport({ sessionIdGenerator: undefined }) // stateless: any instance can answer

Affects: MCP protocol 2025-03-26 through 2025-11-25 servers on multi-instance or serverless hosting; sessions removed in 2026-07-28

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp