MCP session ghosts: TypeScript SDK's client.close() never sends DELETE, here's a fix

Turbulent_Rooster_73 · reddit · 2026-11-21

The Electroscope team (open-source USB microscope desktop app with a built-in Streamable HTTP MCP server) shares a real MCP protocol pitfall:

Problem: The TypeScript SDK's client.close() only aborts locally — it never sends DELETE /mcp with the mcp-session-id, so disconnected agents lingered in the "Sharing this lens" list for 30 minutes until the idle sweeper cleaned up. That list must be truthful since a human watches the same view.

Their detection scheme:

Reusable details: all positions normalized 0..1 in the oriented frame after rotation/mirroring; capturesnapshot crops from full-res frames (real close-ups, not upscales); captures return focus/brightness/exposure metrics; getstatus flags camera controls the device silently ignores.

Signed Windows 11 x64 and macOS Apple Silicon builds available; connect via claude mcp add --transport http electroscope http://<ip>:7821/mcp. The author asks the community how others handle session presence/cleanup and whether 10s is a sensible grace window.

Original post →

More from coding & agent

coding & agent channel →