You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 #470 which would probably be better than trying to manage timeouts of unknown duration.
Getting connection timeouts on server startup as well:
MCP server "postgres" Connection failed: Connection to MCP server "postgres" timed out after 5000ms
MCP server "typescript-definition-finder" Connection failed: Connection to MCP server "typescript-definition-finder" timed out after 5000ms
@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.
you can configure a longer timeout with the MCP_TIMEOUT environment variable: MCP_TIMEOUT=30000 claude for example
@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.callTool and I still get the below error, is this correct? Error still indicates even callTool timeout is not being applied either
Code
transport = new StdioClientTransport({
command: "claude",
args: ["mcp", "serve"],
env: {
...Object.fromEntries(
Object.entries(process.env)
.filter(([, value]) => value !== undefined)
.map(([key, value]) => [key, value as string])
),
MCP_TIMEOUT: String(1200000), // 20 min
},
cwd: workingDirectory,
});
// Initialize client with explicit timeout settings
mcpClient = new Client({
name: "client",
version: "1.0.0",
options: {},
});
await mcpClient.connect(transport);
const mcpResponse = await mcpClient.callTool({
name: "dispatch_agent",
arguments: {
prompt: mcpPrompt,
},
options: {
timeout: 1200000, // 20 min
},
});
Error
Error in main: McpError: MCP error -32001: Request timed out
at Timeout.timeoutHandler (/Users/luketchang/code/<dir>/node_modules/.pnpm/@[email protected]/node_modules/@modelcontextprotocol/sdk/src/shared/protocol.ts:528:43)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7) {
code: -32001,
data: { timeout: 60000 }
}
@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?
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 via claude 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
you can configure a longer timeout with the MCP_TIMEOUT environment variable: MCP_TIMEOUT=30000 claude for example
@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.callTool and I still get the below error, is this correct? Error still indicates even callTool timeout is not being applied either
Code
transport = new StdioClientTransport({
command: "claude",
args: ["mcp", "serve"],
env: {
...Object.fromEntries(
Object.entries(process.env)
.filter(([, value]) => value !== undefined)
.map(([key, value]) => [key, value as string])
),
MCP_TIMEOUT: String(1200000), // 20 min
},
cwd: workingDirectory,
});
// Initialize client with explicit timeout settings
mcpClient = new Client({
name: "client",
version: "1.0.0",
options: {},
});
await mcpClient.connect(transport);
const mcpResponse = await mcpClient.callTool({
name: "dispatch_agent",
arguments: {
prompt: mcpPrompt,
},
options: {
timeout: 1200000, // 20 min
},
});
Error
Error in main: McpError: MCP error -32001: Request timed out
at Timeout.timeoutHandler (/Users/luketchang/code/<dir>/node_modules/.pnpm/@[email protected]/node_modules/@modelcontextprotocol/sdk/src/shared/protocol.ts:528:43)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7) {
code: -32001,
data: { timeout: 60000 }
}
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 we're calling callTool(arg1, arg2, arg3);
const mcpResponse = await mcpClient.callTool(
{
name: "Task",
arguments: {
prompt: mcpPrompt,
description: "Code Search",
},
},
CallToolResultSchema,
// options is here, after schema, not as part of arg1
{
timeout: DEFAULT_TOOL_CALL_TIMEOUT,
resetTimeoutOnProgress: true,
}
);
Notice how callTool does not accept an object, but 3 params, including two objects.
The options should not be nested.
Example of a wrong implementation:
const mcpResponse = await mcpClient.callTool({
name: "Task",
arguments: {
prompt: mcpPrompt,
},
// BAD -> options is part of the tool
options: {
timeout: DEFAULT_TOOL_CALL_TIMEOUT,
},
});```
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
Reacted by Jared McFarland, Dennis Koch, Lam-Tung Nguyen and Ashwin Raghav
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.
Activity
ashwin-ant commentedon Mar 11, 2025
Are you saying the tool call is timing out or the server startup?
am0y commentedon Mar 11, 2025
also getting this issue frequently when server startup, sometimes i dont get it sometimes i do. its frustrating
wskish commentedon Mar 13, 2025
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 #470 which would probably be better than trying to manage timeouts of unknown duration.
pnispel commentedon Mar 17, 2025
Getting connection timeouts on server startup as well:
These both work in claude desktop fine
ashwin-ant commentedon Mar 17, 2025
@pnispel you can configure a longer timeout with the
MCP_TIMEOUTenvironment variable:MCP_TIMEOUT=30000 claudefor examplepnispel commentedon Mar 17, 2025
Oh awesome thank you. I figured I was missing something like that
ashwin-ant commentedon Mar 17, 2025
No worries, we just rolled it out last week!
inheinsight commentedon Mar 19, 2025
@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?ashwin-ant commentedon Mar 19, 2025
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.
inheinsight commentedon Mar 19, 2025
luketchang commentedon Mar 19, 2025
@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
ashwin-ant commentedon Mar 19, 2025
@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?
luketchang commentedon Mar 19, 2025
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.Liu-Eroteme commentedon Mar 21, 2025
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
luketchang commentedon Mar 25, 2025
Hey @ashwin-ant any updates here? Would there be a way to increase the timeout for
dispatch_agentcalls over MCP?bcherny commentedon Apr 1, 2025
Splitting this out and tracking in #680
gaurav219 commentedon Apr 30, 2025
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.
theodormarcu commentedon May 12, 2025
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:
mzhadigerov commentedon May 13, 2025
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
github-actions commentedon Aug 10, 2025
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.