Skip to content

MCP Server Timeout Configuration Ignored in SSE Connections #3033

@b3nw

Description

@b3nw

● Claude Code MCP Server Timeout Configuration Bug Report

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.

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

Steps to Reproduce

  1. Configure MCP timeout settings in ~/.claude/settings.json:
    {
    "env": {
    "MCP_TIMEOUT": "60000",
    "MCP_TOOL_TIMEOUT": "120000",
    "MAX_MCP_OUTPUT_TOKENS": "25000"
    }
    }
  2. Add HTTP MCP server to ~/.claude.json:
    {
    "mcpServers": {
    "example": {
    "type": "http",
    "url": "http://example.local:8080/mcp"
    }
    }
    }
  3. Start Claude Code with --mcp-debug flag
  4. Use MCP server tools successfully
  5. Wait ~5 minutes and observe SSE disconnection errors in logs

Environment

  • Claude Code Version: 1.0.43
  • 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

Metadata

Metadata

Labels

area:mcpbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions