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

Status Open
Reported on v2.1.121
Maintainer reply None cached
Activity 15 comments · opened Jan 8, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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"
DEBUG=true claude mcp list  # claude mcp list  --debug option is no longer available as of Claude Code 2.1.121
sleep: bash -c sleep infinity - ✗ Failed to connect

real    1m0.692s
user    0m1.383s
sys     0m0.320s

Debug output:

grep -E 'timeout|sleep' ~/.claude/debug/54bfa90c-4134-48e4-a4d3-81368ead51f8.txt 
2026-01-08T10:50:33.583Z [DEBUG] MCP server "sleep": Starting connection with timeout of 100000ms
2026-01-08T10:51:33.602Z [DEBUG] MCP server "sleep": Connection failed after 60021ms: MCP error -32001: Request timed out
2026-01-08T10:51:33.603Z [ERROR] MCP server "sleep" Connection failed: MCP error -32001: Request timed out

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.1

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

This is a new instance of the https://github.com/anthropics/claude-code/issues/7575 issue, which was incorectly closed with "60 days of inactivity", despite human comments being present. This behavior of the autoclose bot is reported in https://github.com/anthropics/claude-code/issues/16497.

View original on GitHub ↗

14 Comments

github-actions[bot] · 7 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7575
  2. https://github.com/anthropics/claude-code/issues/424

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

Peter4daggai · 7 months ago

I think mine #17662 got marked as a duplicate.
I thought this was an Anthropic API server issues (and their support even told me that they limited the tool call time to 1 minute due to "incidents")
But purely by accident i ran it on v2.0.32 and there my long running mcp tools work perfectly

marcindulak · 7 months ago

The original issue described here is about a local stdio MCP server (linux sleep infinity command, not an http MCP server).

@Peter4daggai - please don't upvote the "Found possible duplicate issues:" bot like in https://github.com/anthropics/claude-code/issues/16837#issuecomment-3723367123 or https://github.com/anthropics/claude-code/issues/17662#issuecomment-3737842796, because by upvoting you indicate the issue is a duplicate, and the bot should close it. You need to downvote the bot message to indicate you want to keep the issue open.

The standalone reproduction for the MCP_TIMEOUT environment setting, is present for me since 1.0.113 https://github.com/anthropics/claude-code/issues/7575.
You could try to perform the reproduction steps described in this issue, with the latest 2.1.7 release, as 2.0.32 is old.

Peter4daggai · 7 months ago

@marcindulak I wont. And thanks for telling me that. I read it as "or comment" so i commented on my issue immediately.

I know 2.0.32 is old I was happily running my mcp tools on 2.1.4 (or 5 not sure) when last weekend it stopped working. I then reverted as far back as 2.1.1. Still did not work so I and Anthropic's support deemed it an API server issue and not Claude Code. The issue was deliberate the AI said because of some "incidents" so they took it down from 5 minutes to 1 minute. But then my colleague said he did not have the issue. I was amazed at the fact he ran it all successfully on his machine where he had 2.0.32. I reverted to that version and it also worked for me. Very strange indeed.

I also notice this issue is about the startup time of the server my issue is about MCP_TOOL_TIMEOUT i.e. the tool take about 2 minutes to return a result (transport=http)

unbalanced · 7 months ago

Long starting mcps and long running mcps should be a user option
Please bring back MCP_TIMEOUT and MCP_TOOL_TIMEOUT

Also if there's a way to contribute to solving this please refer us to which codebase this belongs because i could not seem to find those implementations

marcindulak · 7 months ago
marcindulak · 6 months ago

.

marcindulak · 6 months ago

.

marcindulak · 5 months ago

.

marcindulak · 4 months ago

.

Hani-AMJ · 3 months ago

Additional data point from the field — a different angle on this same class of bug.

We run a self-hosted MCP server with a long-poll tool (wait_for_channel_event — a multi-agent message broker subscribe primitive). The expected wait window is up to 5 minutes, well within the documented MCP server-side ceiling but obviously above any client cap.

To work around exactly this class of timeout, we shipped a server-side keepalive (FastMCP ctx.report_progress() frames at 30s cadence — well inside the 60s default) on the assumption that any properly-implemented MCP client would reset its tool-call timer on progress notifications. Reference design: RequestOptions.resetTimeoutOnProgress: true from the TypeScript SDK.

It did not help. Empirically, our wait_for_channel_event calls from Claude Code via mcp-remote bridge time out at ~30 seconds with MCP error -32001 Request timed out, regardless of:

  • Server-side keepalive frames being sent (verified via docker exec from inside the FastMCP container — frames go out at 30s/60s/90s exactly)
  • MCP_TIMEOUT env var (we tried 60000, 120000, 300000 — all behave the same)
  • Streamable HTTP vs SSE transport (same shape on both)

Source-level inspection of mcp-remote@0.1.37/0.1.38 (chunk-65X3S4HB.js) confirms mcp-remote itself doesn't impose this cap — its mcpProxy is a pure transport relay with no Client.request() path. The cap therefore fires UPSTREAM of mcp-remote, inside @anthropic-ai/claude-agent-sdk 0.2.138 (bundled with Claude Desktop / Claude Code).

Specifically, our probe + the linked source inspection suggest a hardcoded TOOL_CALL_TIMEOUT_MS in claude-agent-sdk that:

  1. Does NOT honor MCP_TIMEOUT values above ~30s (in our case; possibly 60s in others as reported here)
  2. Does NOT honor server-side progress notifications (the resetTimeoutOnProgress option doesn't appear to be wired)

The combination of these means even legitimate long-poll MCP tools that follow MCP spec for progress notifications cannot be used reliably from Claude Code today.

Two fix-direction ideas that would unblock this class of tool:

  1. Expose TOOL_CALL_TIMEOUT_MS as a configurable (env var or config file). Even 5 minutes would be enough for most long-poll use cases.
  2. Honor server-side progress notifications by resetting the timer (the resetTimeoutOnProgress: true semantics already in the TypeScript SDK). This is the cleanest fix because it doesn't require user configuration; the timer extends as long as the server keeps work happening.

Happy to share probe-level repros on request if it helps.

Cross-referenced here so it informs upstream priority for the timeout/keepalive class.

marcindulak · 2 months ago

.

neerajbhatmongo · 2 months ago

@Hani-AMJ facing the exact same issue as well. It doesn't honor the progress notifications sent from the remote MCP tool

FlorinAndrei · 2 months ago

Plenty of Docker-based MCPs fail to start in 60 seconds, because downloading a new image takes too long, even on a good internet connection. E.g. I'm having issues right now with Playwright.

The CLI should allow bigger values for this timeout.

Showing cached comments. Read the full discussion on GitHub ↗