Skip to content

[BUG] MCP Server Timeout Configuration Ignored in Streamable SSE HTTP Connections #20335

Description

@JackDan9

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Summary
Claude Code is not respecting MCP timeout settings configured in settings.json, causing HTTP MCP servers to
appear "offline" due to premature SSE stream disconnections using default timeout values instead of
configured ones.

What Should Happen?

Expected Behavior
MCP timeout settings in ~/.claude/settings.json should be applied to MCP server connections
SSE streams should timeout according to configured values (e.g., 60 seconds for MCP_TIMEOUT)
MCP servers should remain "online" when timeout settings are properly configured
Actual Behavior
MCP timeout settings in settings.json are ignored
SSE streams disconnect after ~5 minutes regardless of configured timeout values
HTTP MCP servers show as "offline" due to connection timeouts
No timeout configuration values appear in MCP debug logs

Claude Code receives empty responses from MCP tools that take >60 seconds

Error Messages/Logs

{
    "content": [
      {
        "cache_control": {
          "type": "ephemeral"
        },
        "type": "tool_result"
      }
    ],
    "role": "user"
  }

Steps to Reproduce

Steps to Reproduce
Configure MCP timeout settings in ~/.claude/settings.json:
{
"env": {
"MCP_TIMEOUT": "60000",
"MCP_TOOL_TIMEOUT": "120000",
"MAX_MCP_OUTPUT_TOKENS": "25000"
}
}
Add HTTP MCP server to ~/.claude.json:
{
"mcpServers": {
"example": {
"type": "http",
"url": "http://example.local:8080/mcp"
}
}
}
Start Claude Code with --mcp-debug flag
Use MCP server tools successfully
Wait ~5 minutes and observe SSE disconnection errors in logs
Environment
Claude Code Version: 2.0.
Platform: Linux 6.8.12-9-pve
MCP Server: HTTP-based Gitea MCP Server v0.3.0
Transport: SSE (Server-Sent Events)
Evidence
MCP Server Verification
MCP server responds correctly to protocol requests:
curl -X POST http://example.local:8080/mcp -H "Content-Type: application/json" -d '{"jsonrpc": "2.0",
"method": "initialize", "id": 1}'
Returns: {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-03-26",...}}
Log Evidence
Successful connection: MCP server connected to transport
SSE disconnection after ~5 minutes:
Error: SSE stream disconnected: TypeError: terminated
at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1344:23205
No timeout configuration in logs: No references to MCP_TIMEOUT, MCP_TOOL_TIMEOUT, or configured values
Process Environment Check
Environment variables not visible in Claude Code process: cat /proc/$(pgrep claude)/environ | grep MCP
returns empty
Settings file format confirmed correct per documentation
Additional Context
MCP server works correctly with other LLM/AI agents
Same timeout pattern occurs consistently (~5 minutes)
Server has no authentication requirements
Network connectivity is stable (server accessible via curl)
Workaround
None identified - timeout settings cannot be applied to prevent SSE disconnections.
Impact
HTTP MCP servers appear unreliable/offline
Users cannot configure appropriate timeout values for their network environment
Reduced usability of HTTP MCP servers in production environments

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.16

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mcpbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on LinuxstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions