Skip to content

[BUG] Claude code does not obey values of MCP_TIMEOUT longer than 60 seconds #7575

@marcindulak

Description

@marcindulak

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?

Claude code does not obey values of MCP_TIMEOUT longer than 60 seconds

What Should Happen?

Claude code should obey longer values of MCP_TIMEOUT. This is needed for MCP servers that have a long startup times, e.g. download some resources.

Error Messages/Logs

[DEBUG] MCP server "sleep": Starting connection with timeout of 100000ms
[DEBUG] MCP server "sleep": Connection failed after 60031ms: MCP error -32001: Request timed out

Steps to Reproduce

rm -rf /tmp/claude-60seconds-timeout
mkdir /tmp/claude-60seconds-timeout
cd /tmp/claude-60seconds-timeout
export MCP_TIMEOUT=100000 # 100 seconds
claude mcp remove sleep || true
claude mcp add sleep -- bash -c "sleep infinity"
claude mcp list --debug

Output:

Removed MCP server "sleep" from local config
File modified: /home/user/.claude.json [project: /tmp/claude-60seconds-timeout]
Added stdio MCP server sleep with command: bash -c sleep infinity to local config
File modified: /home/user/.claude.json [project: /tmp/claude-60seconds-timeout]
[DEBUG] Writing to temp file: /home/user/.claude.json.tmp.518189.1757834898685
[DEBUG] Preserving file permissions: 100664
[DEBUG] Temp file written successfully, size: 75128 bytes
[DEBUG] Applied original permissions to temp file
[DEBUG] Renaming /home/user/.claude.json.tmp.518189.1757834898685 to /home/user/.claude.json
[DEBUG] File /home/user/.claude.json written atomically
Checking MCP server health...

[DEBUG] MCP server "sleep": Starting connection with timeout of 100000ms
[DEBUG] MCP server "sleep": Connection failed after 60028ms: MCP error -32001: Request timed out
[ERROR] MCP server "sleep" Connection failed: MCP error -32001: Request timed out
sleep: bash -c sleep infinity - ✗ Failed to connect

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

No response

Claude Code Version

1.0.113 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Xterm

Additional Information

The problem with the ingored timeout value may be related to the hard-code timeout mentioned in #424 (comment)

Metadata

Metadata

Assignees

No one assigned

    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