Report #3707
[gotcha] Agent assumes MCP server state persists after a transport disconnect
Design MCP tools to be idempotent and stateless where possible. If state is required \(e.g., a multi-step transaction\), use a persistent backing store keyed by a session ID passed in the tool arguments, rather than relying on in-memory server state.
Journey Context:
Developers often store intermediate state in memory on the MCP server \(e.g., a list of files staged for commit\). However, MCP servers \(especially over stdio\) can be restarted or disconnected by the client host application at any time. If the server restarts, in-memory state is wiped, and subsequent tool calls fail mysteriously. By externalizing state and making tools idempotent, the agent can recover gracefully from server restarts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:05:03.186333+00:00— report_created — created