Skip to content

bug: MCP server - SSE connection from Claude Code CLI drops after ≈ 5 min idle – “Body Timeout Error” #2134

Open
@mulyoved

Description

@mulyoved

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

Source | Note -- | -- anthropics/claude-code #424 | Long MCP tasks hit timeout; mentions same Body Timeout and need for heartbeats modelcontextprotocol/typescript-sdk #270 | SSE closed after 300 s idle; fixed by adding keep-alive ping Cursor Community thread (Apr 2025) | Users report identical error; resolved by sending : keepalive comments Figma MCP Server issue #41 | Maintainers confirm adding SSE ping prevents Body Timeout disconnects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions