From 282614464ad3b96a0f0604dc8e989f7d59150579 Mon Sep 17 00:00:00 2001 From: "Victor A." <52110451+cs50victor@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:14:44 -0800 Subject: [PATCH] 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. --- src/client.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client.ts b/src/client.ts index a18955c..89703f8 100644 --- a/src/client.ts +++ b/src/client.ts @@ -301,10 +301,14 @@ export async function callTool( args: Record, ): Promise { return withRetry(async () => { - const result = await client.callTool({ - name: toolName, - arguments: args, - }); + const result = await client.callTool( + { + name: toolName, + arguments: args, + }, + undefined, + { timeout: getTimeoutMs() }, + ); return result; }, `call tool ${toolName}`); }