Repository navigation
Summary
The current tool call correctly fails without being automatically replayed. However, the client keeps using the stale session ID for subsequent calls, even with reconnection enabled. Reloading the MCP plugin or restarting DSH Web temporarily restores the connection, but the problem recurs if the session becomes invalid again. ConfigurationBoth affected servers use the official transport: streamable-http
reconnect:
enabled: true
initialDelayMs: 500
maxDelayMs: 30000
maxAttempts: 10The official client's installed The third-party Steps to reproduce
Actual behavior
An isolated reproduction using a mocked HTTP endpoint and the installed official client produced this request sequence: The two The test used shortened reconnect delays and still observed no new Expected behaviorWhen an established stateful HTTP session is reported as invalid with HTTP 404:
Suspected causeThe official client's connection manager starts reconnection from However, the installed SDK's HTTP POST error path throws The tool execution path also propagates the error without invalidating the stale connection. Relevant areas in the installed packages:
This appears to be a missing session-invalidation recovery path, rather than a missing reconnect configuration. ImpactAfter server-side session invalidation, MCP tools remain unusable until the user manually reloads the plugin or restarts DSH Web. |
Replies: 2 comments
|
"Reconnection enabled" does not help here because the supervisor only reacts to a connection that drops, and a 404 is not a drop.
The rule you are applying — a request carrying a session id answered with 404 must start a new session with a fresh initialize — belongs to the Streamable HTTP session lifecycle, which is implemented in the transport from So there are two possible fixes and they land in different places: the SDK resets its session on 404, or DSH treats a session-invalid error as a generation-ending event — discard the transport, reconnect, send initialize — instead of returning it as an ordinary tool failure. The second one is within DSH's reach and would cover servers that speak the rule differently. Worth putting in the report: when the attempt budget is exhausted the supervisor unregisters the server's tools and stops, and "disposal (including HMR) is the only way back from that state" ( |
|
Production case: two streamable-HTTP MCP servers behind one gateway, permanent 404 until host restart (DSH Desktop 0.2.1-rc.3, macOS arm64) Adding an independent reproduction of the exact symptom, from an internal deployment whose MCP servers cannot be modified. Setup
Timeline (UTC+8)
Server-side control (the server was healthy) Discriminator for the 404 arm Why this case is worth recording
Spec reference for the gap: Streamable HTTP / Session Management — a client receiving 404 for a request carrying |
"Reconnection enabled" does not help here because the supervisor only reacts to a connection that drops, and a 404 is not a drop.
packages/mcp/mcp-client/src/connection.ts:1-13states the contract: it owns the client/transport generations, keeps the tool registry in sync with the live generation, and — "when the connection drops — restarts the configured server with bounded exponential backoff". The trigger is the transport generation ending. An HTTP 404 from a Streamable HTTP endpoint is a completed response carrying an error body; the transport stays up, the generation never ends, so no restart is scheduled and the next call reuses the same session id. That is exactly the "keeps using t…