Skip to content

Commit 2826144

Browse files
committed
fix: pass MCP_TIMEOUT to SDK callTool requests
The MCP SDK has a hardcoded DEFAULT_REQUEST_TIMEOUT_MSEC of 60 seconds. Without passing the timeout option to client.callTool(), the MCP_TIMEOUT environment variable was being ignored for tool execution, causing long-running tools (like browser automation) to fail with error -32001 (RequestTimeout) after 60 seconds regardless of the configured timeout. This fix passes getTimeoutMs() to the SDK's callTool options, ensuring the user-configured MCP_TIMEOUT is respected.
1 parent f010748 commit 2826144

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/client.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,14 @@ export async function callTool(
301301
args: Record<string, unknown>,
302302
): Promise<unknown> {
303303
return withRetry(async () => {
304-
const result = await client.callTool({
305-
name: toolName,
306-
arguments: args,
307-
});
304+
const result = await client.callTool(
305+
{
306+
name: toolName,
307+
arguments: args,
308+
},
309+
undefined,
310+
{ timeout: getTimeoutMs() },
311+
);
308312
return result;
309313
}, `call tool ${toolName}`);
310314
}

0 commit comments

Comments
 (0)