[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
Workaround ✓ Mentioned in thread ↓
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.
Showing cached comments. Read the full discussion on GitHub ↗
14 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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
The original issue described here is about a local stdio MCP server (linux
sleep infinitycommand, 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_TIMEOUTenvironment 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.
@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)
Long starting mcps and long running mcps should be a user option
Please bring back
MCP_TIMEOUTandMCP_TOOL_TIMEOUTAlso 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
People suggested in https://github.com/anthropics/claude-code/issues/424#issuecomment-2722227863 that the 60 seconds limit is due to Claude Code (and Gemini CLI) somehow using the default value from https://github.com/modelcontextprotocol/typescript-sdk/blob/b0ef89ffaf6db8b3c52cd8919e8949b0f1da9ca4/packages/core/src/shared/protocol.ts#L110
.
.
.
.
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: truefrom the TypeScript SDK.It did not help. Empirically, our
wait_for_channel_eventcalls from Claude Code via mcp-remote bridge time out at ~30 seconds withMCP error -32001 Request timed out, regardless of:docker execfrom inside the FastMCP container — frames go out at 30s/60s/90s exactly)MCP_TIMEOUTenv var (we tried 60000, 120000, 300000 — all behave the same)Source-level inspection of
mcp-remote@0.1.37/0.1.38(chunk-65X3S4HB.js) confirms mcp-remote itself doesn't impose this cap — itsmcpProxyis a pure transport relay with noClient.request()path. The cap therefore fires UPSTREAM of mcp-remote, inside@anthropic-ai/claude-agent-sdk0.2.138 (bundled with Claude Desktop / Claude Code).Specifically, our probe + the linked source inspection suggest a hardcoded
TOOL_CALL_TIMEOUT_MSin claude-agent-sdk that:MCP_TIMEOUTvalues above ~30s (in our case; possibly 60s in others as reported here)resetTimeoutOnProgressoption 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:
TOOL_CALL_TIMEOUT_MSas a configurable (env var or config file). Even 5 minutes would be enough for most long-poll use cases.resetTimeoutOnProgress: truesemantics 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.
.
@Hani-AMJ facing the exact same issue as well. It doesn't honor the progress notifications sent from the remote MCP tool
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.