[BUG] MCP Timeout needs to be configurable
Resolved 💬 20 comments Opened Mar 11, 2025 by workingdoge Closed Apr 1, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version:0.2.36
- Operating System: MacOS
- Terminal: Ghostty
Bug Description
MCP timeout error when using browser use
Steps to Reproduce
- install browser_use mcp
- tell claude code to search
- search takes too long and claude code times out with a -32000: Connection closed
Expected Behavior
Complete Search
Actual Behavior
Timeout
20 Comments
Are you saying the tool call is timing out or the server startup?
also getting this issue frequently when server startup, sometimes i dont get it sometimes i do. its frustrating
I am seeing a timeout issue frequently as well (MCP error -32001: Request timed out) for long-running mcp tool calls.
The issue is the underlying mcp library has a default 60 second timeout which is reasonable for most cases but there is a long tail of operations that will take longer than this.
I tried adding progress_reporting to my mcp server but then discovered that claude code is not supporting it since the MCP typescript sdk defaults to ignoring progress reporting for timeout purposes. added https://github.com/anthropics/claude-code/issues/470 which would probably be better than trying to manage timeouts of unknown duration.
Getting connection timeouts on server startup as well:
These both work in claude desktop fine
@pnispel you can configure a longer timeout with the
MCP_TIMEOUTenvironment variable:MCP_TIMEOUT=30000 claudefor exampleOh awesome thank you. I figured I was missing something like that
No worries, we just rolled it out last week!
@ashwin-ant it would be awesome if we could set this with
claude config set. Do you plan to include that instead of having to add this as a variable when we start Claude?We can look into this! We're also going to be increasing the default timeout to 30 seconds, which should hopefully make it so you don't need to override it.
Oh yeah, that'd definitely help!
On Tue, Mar 18, 2025, 8:07 PM Ashwin Bhat @.***> wrote:
@ashwin-ant This isn't working on my end still. We set MCP_TIMEOUT in the transport and also specify the timeout option when we call
client.callTooland I still get the below error, is this correct? Error still indicates evencallTooltimeout is not being applied eitherCode
Error
@luketchang the timeout is not for launching Claude Code as an MCP server, it's for using Claude Code as an MCP client that launches other servers. Can you share more about what you're trying to do?
Yep! We have an agent that fetches code context and is currently doing so by dispatching a task (via
client.callTool(...)) to Claude Code, which runs as an MCP server viaclaude mcp serve.I'm running into this issue as well - wanted to test if giving claude access to other LLMs (e.g. large models like 4.5, expert finetunes, deep research like setups) could help in certain situations, but have not found a way to make longer running queries work without resorting to a firecrawl-like async setup (return job ID, let claude query job ID status, etc)
Would greatly appreciate a config option / env var for MCP tool call timeout as well
Hey @ashwin-ant any updates here? Would there be a way to increase the timeout for
dispatch_agentcalls over MCP?Splitting this out and tracking in https://github.com/anthropics/claude-code/issues/680
Hi, did you resolve this issue?
I'm also facing similar issue where it seems the tool is not getting called and it times out.
~~Wanted to bump this! It still seems to cause issues.~~
Ok I figured it out finally 🎊 🥳
The issue is actually solved by the MCP
typescript-sdk. I think there must've been an interface change sometime in the past few months. The correct way to set up the timeout on the client is:Notice how
callTooldoes not accept an object, but 3 params, including two objects.The options should not be nested.
Example of a wrong implementation:
is it possible to set the timeout argument for Claude Desktop? All my mcp servers were accessible yesterday. Without any changes in code, they throw timeout errors today
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.