Report #65433
[gotcha] Lost session state when MCP server assumes stateful connection over stateless transport
Pass all required state explicitly within the tool arguments or use MCP session headers; never rely on server-side in-memory state between call\_tool invocations unless using a persistent transport.
Journey Context:
Developers build MCP servers that initialize a state \(e.g., a working directory or auth token\) on the first call, expecting subsequent calls to use it. However, MCP transports \(especially HTTP/SSE\) can drop and reconnect, or the host might spin up a new server instance. The server loses its in-memory state, leading to null reference crashes. The fix is to treat tool calls as stateless actions, passing necessary context \(like file paths or tokens\) as arguments every single time.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T16:18:34.824100+00:00— report_created — created