claude-code - 💡(How to fix) Fix Auto-reconnect MCP streamable-HTTP servers on `Session not found`

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When an MCP server using streamable HTTP transport evicts a session (idle timeout, restart, deploy), the client keeps using its stale session ID and every tool call fails with:

Streamable HTTP error: Error POSTing to endpoint:
{"error":{"message":"Session not found","code":-32600},...}

/mcp reports the server as "Connected" because that status reflects the last successful handshake, not live session validity. Users must manually reconnect via /mcp to recover.

Error Message

Streamable HTTP error: Error POSTing to endpoint: {"error":{"message":"Session not found","code":-32600},...} On receiving JSON-RPC error code -32600 with message "Session not found" surfacing the error to the user. 4. Observe Session not found error; /mcp still shows "Connected".

Root Cause

/mcp reports the server as "Connected" because that status reflects the last successful handshake, not live session validity. Users must manually reconnect via /mcp to recover.

RAW_BUFFERClick to expand / collapse

Summary

When an MCP server using streamable HTTP transport evicts a session (idle timeout, restart, deploy), the client keeps using its stale session ID and every tool call fails with:

Streamable HTTP error: Error POSTing to endpoint:
{"error":{"message":"Session not found","code":-32600},...}

/mcp reports the server as "Connected" because that status reflects the last successful handshake, not live session validity. Users must manually reconnect via /mcp to recover.

Proposed behavior

On receiving JSON-RPC error code -32600 with message "Session not found" (or equivalent session-eviction signal), Claude Code should transparently re-establish the session and retry the failed call once, rather than surfacing the error to the user.

Repro

  1. Connect to any streamable-HTTP MCP server (e.g. Fastmail).
  2. Leave the session idle long enough for the server to evict it (or wait for a server-side restart).
  3. Invoke any tool from that server.
  4. Observe Session not found error; /mcp still shows "Connected".
  5. Manually /mcp → reconnect → tool works again.

Environment

Claude Code (CLI), darwin.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING