Report #68385
[gotcha] MCP tools fail mysteriously with session not found or missing state errors across turns
Design MCP servers as strictly stateless regarding client sessions. Pass all required state \(e.g., session IDs, working directories, file paths\) as explicit parameters in the tool's inputSchema on every call, rather than relying on server-side memory mapping between requests.
Journey Context:
Developers often build MCP servers like traditional web backends, storing state in memory \(e.g., mapping a user to a database connection\). However, MCP clients might spawn multiple server instances, restart them, or distribute requests across instances. When the server loses its in-memory state, tools fail. The tradeoff is verbose tool signatures \(passing the working directory every time\), but statelessness is critical for the resilience and scalability of the MCP architecture.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:16:07.812046+00:00— report_created — created