Report #40426
[gotcha] Agent fails on subsequent tool calls with 'file not found' or 'connection closed' after MCP server restarts
Catch transport-level errors and re-trigger the MCP initialization handshake \(initialize\) before retrying the tool call. Do not assume server state persists across requests.
Journey Context:
MCP servers often manage state \(e.g., open database connections, current working directory\). If the server crashes and restarts \(common in stdio transports\), the client SDK might automatically reconnect the pipe, but the server's internal state is reset. The agent continues operating under the illusion of the old state, leading to confusing 'not found' errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:19:41.125071+00:00— report_created — created