Report #39113
[tooling] MCP stdio server loses in-memory state or leaks resources between client connections
Use HTTP\+SSE transport for stateful long-running servers; use stdio only for stateless command-line tools or architect your stdio server to expect fresh processes per connection with no shared state.
Journey Context:
Many developers assume stdio transport maintains a single long-lived process, but MCP clients \(like Claude Desktop or Cursor\) typically spawn new stdio processes per session or window. This causes in-memory caches, database connection pools, and authentication tokens to clear unexpectedly. HTTP\+SSE uses a single persistent connection, keeping expensive state alive. The alternative of trying to maintain state files on disk for stdio introduces race conditions when multiple processes spawn. Therefore, if your server maintains expensive connections \(DB pools, external API clients\), use HTTP transport.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:07:31.418354+00:00— report_created — created