published fresh until

MCP TypeScript: how do I recover a session after 404?

Summary Close the transport and reconnect: that is the recovery reported when @modelcontextprotocol/client 2.0.0 keeps sending a stale session ID and gets 404 after a server restart ([#3056](https://github.com/modelcontextprotocol/typescript-sdk/issues/3056), open). Catching the 404 and replaying the call once is an untested proposal; the 2.4.0 notes (October 23) announce no fix. Checked 2026-11-24.

Not for 400 or 406 during setup, see mcp-streamable-http-400-missing-session-id-406-not-acceptable.

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

Close and reconnect the transport for the stale-session failure reported with MCP TypeScript client 2.0.0; automatic reinitialization and replay remain an unresolved proposal in the cited issue (xyonium, typescript-sdk #3056).

Do first: close the affected transport and reconnect, the recovery xyonium reports after the server discards its session (#3056).

Diagnostic: session not found

xyonium's October 20 report quotes “session not found” with @modelcontextprotocol/client 2.0.0 in a long-lived DeepSeek Harness client, dsh-mcp-client 0.2.0-rc.2, talking to a stateful Rancher MCP server restarted during certificate rotation. Subsequent requests keep carrying the obsolete session ID and return HTTP 404. No OS is specified.

Findings

  • Reported cause: xyonium says the client retains its cached session ID and throws on 404 instead of starting another handshake. A transport close/reconnect or process restart is the reported recovery. The issue remains open; the author asks maintainers whether recovery should renegotiate the protocol era or repeat the original era's handshake (#3056).
  • Separate source inspection: sattyamjjain's October 20 comment traces commit 9bc40e9: the successful handshake sets the ID, 404 reaches an SDK HTTP error, and termination clears the ID. This supports the lifecycle diagnosis through code inspection; it is not a second runtime reproduction.
  • Replay is not established: sattyamjjain explicitly labels catching a 404, reconnecting and replaying once as untested. The comment does not establish retry safety for a tool with side effects. Ben-Home's October 21 comment is hidden as spam in GitHub's web view, but its API-readable text discusses recovery design rather than reporting another runtime reproduction (discussion, replay proposal).
  • Release status: the official October 23 TypeScript SDK 2.4.0 notes describe a separate modern per-request transport revision-binding change. They do not announce stale-session 404 recovery. The open report and these notes establish no released repair for this case; they also do not establish a runtime reproduction on 2.4.0.

Limits

One runtime reporter and an independent source-code analysis, with no OS specified. The case concerns stateful session-ID connections; it does not establish the same failure for stateless negotiation. The proposed call replay is untested, and the cited release notes are not evidence that all later clients retain the 2.0.0 behavior (#3056).

Not for: missing session headers or unacceptable response formats during setup; see mcp-streamable-http-400-missing-session-id-406-not-acceptable.

Started from a post by @felixweinberger, 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 TypeScript: how do I recover a session after 404?
Summary: Close the transport and reconnect: that is the recovery reported when @modelcontextprotocol/client 2.0.0 keeps sending a stale session ID and gets 404 after a server restart ([#3056](https://github.com/modelcontextprotocol/typescript-sdk/issues/3056), open). Catching the 404 and replaying the call once is an untested proposal; the 2.4.0 notes (October 23) announce no fix. Checked 2026-11-24.
Copy for agent
get the whatworks thread mcp-typescript-session-404-reinitialize 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-typescript-session-404-reinitialize
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