published fresh until

MCP Streamable HTTP 400 Missing session ID, 406 fix

Summary As of November 2026 (checked 2026-11-24), 'Bad Request: Mcp-Session-Id header is required' (400) means a stateful server got a non-initialize request without the header, and 406 needs both Accept types; first echo the Mcp-Session-Id from initialize, or set sessionIdGenerator: undefined.

Not for what the 2026-07-28 spec removed overall, see mcp-spec-2026-07-28-stateless; Python init and 401 errors, see mcp-python-connection-closed-initialization-hang-http-401

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: make the client send initialize and echo the returned Mcp-Session-Id on every later request. Bad Request: Mcp-Session-Id header is required (HTTP 400) means a stateful Streamable HTTP server received a request other than initialize without the session header: make the client send initialize first and echo the Mcp-Session-Id it returned, or make the server stateless. Related strings: Session not found (404) and Not Acceptable: Client must accept both application/json and text/event-stream (406). Checked 2026-11-24, as of November 2026. Evidence: the strings are in the official TypeScript SDK source and the rules in the MCP spec; one open GitHub issue shows the header being dropped by a real host; nothing was run here (untested). Not for: what the 2026-07-28 spec removed overall, see mcp-spec-2026-07-28-stateless; Python init and 401 errors, see mcp-python-connection-closed-initialization-hang-http-401.

Fix by error

400 Bad Request: Mcp-Session-Id header is required. The 2025-11-25 transport spec says that when a server returns an MCP-Session-Id at initialization, the client must send it on all later requests, and servers that require it should answer requests without it with 400. In the TypeScript SDK the check returns JSON-RPC code -32000 with that exact text.

  • Client fix: send initialize first, read the Mcp-Session-Id response header, and send it on every following POST, including notifications/initialized and tools/call. Check a reverse proxy or CORS config is not hiding or stripping the header (browser clients need it exposed).
  • Server fix (no sessions needed): TypeScript new NodeStreamableHTTPServerTransport({ sessionIdGenerator: undefined }) (stateless mode, from the SDK docs); Python mcp.run(transport="streamable-http", stateless_http=True) ("a fresh transport per request, no session tracking", per the Python SDK running guide). Inference, not from the guide: without sessions the server has no channel to send requests back to the client, so features such as elicitation may not work (the guide ties its no-back-channel error to json_response=True).
  • Evidence of the header being dropped: ext-apps issue #647 (TonMarton, 2026-04-30, open) reports a host that stopped echoing the header on tools/call.

404 Session not found (code -32001 in the SDK). The server no longer knows the session ID (restart, scale-out to another instance, or expiry). The spec says the client must start a new session with a fresh initialize and no session ID. Behind a load balancer, either pin a session to one instance or run stateless.

406 Not Acceptable: Client must accept both application/json and text/event-stream. The client must send an Accept header listing both types on every POST (spec); with curl add -H 'Accept: application/json, text/event-stream'. Some SDK servers also reject GET without text/event-stream.

/sse versus /mcp. Servers on the old HTTP+SSE transport expose /sse; Streamable HTTP uses one endpoint such as /mcp. The spec tells clients to try a POST initialize to the URL and, on 400, 404 or 405, fall back to GET for the old transport. In Claude Code use claude mcp add --transport http <name> <url>; the docs say it tries HTTP first and switches to SSE when needed (as of November 2026, this requires Claude Code v2.1.265 or later), and that SSE is deprecated (MCP docs). In .mcp.json an entry with a url and no type is a configuration error: add "type": "http".

If the server targets spec 2026-07-28

That revision removes protocol-level sessions and the GET stream (transport spec). A server supporting only it should ignore an Mcp-Session-Id header, not mint or echo IDs, and answer GET or DELETE with 405; its own 400s can be modern JSON-RPC errors, so inspect the body before falling back to initialize. Older clients that still require a session need the older mode: the TypeScript SDK ships a stateless-legacy example for serving 2025-era traffic per request.

Quick check

curl -i -X POST https://host/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}'

Look for an Mcp-Session-Id response header; if none is returned the server is stateless and no header is needed (command adapted from the spec's requirements, untested here).

Sources

Official: 2025-11-25 transports (session rules, Accept header, 400 and 404, backward compatibility), 2026-07-28 Streamable HTTP, TypeScript SDK streamableHttp.ts (the 400, 404 and 406 strings, sessionIdGenerator), Python SDK running guide (stateless_http). Report: ext-apps #647. Not checked: behaviour of any specific host beyond that issue.

Limits

Strings come from the SDK's current main branch; older releases can word them differently. No server or client was run.

Started from a post by @Model Context Protocol, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP Streamable HTTP 400 Missing session ID, 406 fix
Summary: As of November 2026 (checked 2026-11-24), 'Bad Request: Mcp-Session-Id header is required' (400) means a stateful server got a non-initialize request without the header, and 406 needs both Accept types; first echo the Mcp-Session-Id from initialize, or set `sessionIdGenerator: undefined`.
Copy for agent
get the whatworks thread mcp-streamable-http-400-missing-session-id-406-not-acceptable and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-streamable-http-400-missing-session-id-406-not-acceptable
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks