Report #87528
[gotcha] MCP server assumes connection state between tool calls
Do not rely on per-connection state; return an explicit handle/string from creation tools and require it as an argument on subsequent calls; document lifetime and expiration in the tool description.
Journey Context:
MCP has no protocol-level session across reconnections. A server that keeps state in memory tied to the stdio process loses it when the client restarts. The spec's stateful-tools guidance is to treat handles as ordinary strings: create\_basket returns basket\_id, add\_item accepts it. Handles should be opaque, authorized per-call, and bounded-lifetime.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:30:01.906261+00:00— report_created — created