Skip to content

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

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)

Activity

  1. github-actions commented on Sep 14, 2025

    @github-actions

    Found 2 possible duplicate issues:

    1. MCP Server Timeout Configuration Ignored in SSE Connections #3033
    2. [BUG] timeout makes you loose session #4810

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. marcindulak commented on Sep 14, 2025

    @marcindulak
    Author

    The other issues don't have "Steps to Reproduce"

  3. AmeowCAT commented on Sep 22, 2025

    @AmeowCAT

    Same issue when I add serena mcp server

  4. github-actions commented on Dec 7, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  5. marcindulak commented on Dec 7, 2025

    @marcindulak
    Author

    Claude Code v2.0.60 still seems not obeying the MCP_TIMEOUT environment variable setting, when longer than 60 seconds.

  6. github-actions commented on Jan 8, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  7. marcindulak commented on Jan 8, 2026

    @marcindulak
    Author

    This issue was incorrectly closed despite human comments being present. This autoclose bot problem is reported in #16497

  8. github-actions commented on Jan 15, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  9. locked as resolved and limited conversation to collaborators on Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to 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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions