bug: MCP server - SSE connection from Claude Code CLI drops after ≈ 5 min idle – “Body Timeout Error”
Provide environment information
System: OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm) CPU: (8) x64 Intel(R) Xeon(R) CPU @ 2.80GHz Memory: 28.92 GB / 31.35 GB Container: Yes Shell: 5.2.15 - /bin/bash Binaries: Node: 22.13.0 - ~/miniforge3/bin/node Yarn: 1.22.22 - /usr/bin/yarn npm: 10.9.2 - ~/miniforge3/bin/npm
Describe the bug
When Claude Code CLI connects to a local Trigger.dev MCP server, the Server-Sent Events (SSE) stream is closed after ~5 minutes of inactivity. Once closed, every MCP call fails until the Claude CLI process is restarted (Trigger.dev server itself does not need a restart).
MCP server "triggerdev" Error: SSE error: TypeError: terminated: Body Timeout Error
Expected The SSE control channel should stay open indefinitely so the CLI can send tasks even after long idle periods.
Likely cause Most HTTP servers/proxies close an SSE response that stays silent for several minutes. Because the Trigger.dev MCP endpoint sends no keep-alive heartbeat while idle, the connection hits this idle “body timeout” and terminates.
Reproduction repo
None
To reproduce
Start Trigger.dev MCP server locally
trigger dev --mcp # or equivalent command
In another terminal, run
claude --mcp-debug
Execute any MCP command → it succeeds.
Leave the session idle for ~5 minutes.
Run another MCP command. Actual: CLI logs the error above and the command fails. Work-around: Restarting claude --mcp-debug restores functionality.
Additional information
Proposed fix: Send a periodic SSE heartbeat/keep-alive (e.g. : keepalive\n\n) every ≤ 30 s so the stream never appears idle.
Related discussions & bugs