MCP requests need an idle clock that progress may reset and a ceiling it cannot. Where the TypeScript SDK checks the ceiling, and what to do with a late result.
One number is not enough for a long tool call
An agent host that calls MCP tools needs a timeout on every request. Without one, a server that hangs holds the agent's turn open forever. With a single fixed timeout, you have to choose between failing legitimate long work, such as a stock reconciliation for Belgavi's Book Store that takes four minutes, and waiting far too long for a server that died in the first second.
The MCP specification answers this with two clocks. The lifecycle text in the 2025-11-25 revision, and the cancellation pattern in the 2026-07-28 revision, say the same thing: implementations SHOULD set timeouts for all sent requests; when a request gets no response within the timeout, the sender SHOULD cancel it and stop waiting; SDKs SHOULD let the timeout be set per request; implementations MAY reset the timeout clock when a progress notification for the request arrives, because that implies work is happening; and they SHOULD always enforce a maximum timeout regardless of progress.
That gives an idle clock, which progress can push forward, and a ceiling, which nothing can. This guide shows how to configure both, how one widely used SDK actually implements the ceiling, and what to do with the result that arrives after you stopped waiting.
How progress reaches the client
A client asks for progress by putting a progressToken in the request's _meta. The server MAY then send notifications/progress messages carrying that token, a progress value that MUST increase with every notification, and optionally a total and a message. The server is free to send none at all.
{"jsonrpc": "2.0", "id": 41, "method": "tools/call",
"params": {"name": "reconcile_stock", "arguments": {"store": "main"},
"_meta": {"progressToken": "reconcile-41"}}}
{"jsonrpc": "2.0", "method": "notifications/progress",
"params": {"progressToken": "reconcile-41", "progress": 1200, "total": 4800,
"message": "1200 of 4800 titles checked"}}Because progress is optional and server-controlled, it is evidence that something is alive, not a promise of completion. A server with a bug can emit progress forever, and a server stuck in a loop that reports the same work again cannot, because progress must increase; but a server that increments a counter on a timer satisfies the rule while doing nothing useful. That is exactly why the specification wants a ceiling that progress cannot move.
The TypeScript SDK options
The TypeScript SDK exposes both clocks as request options. Reading protocol.ts on the main branch on 27 November 2026 (commit 5ee54ee), timeout defaults to DEFAULT_REQUEST_TIMEOUT_MSEC, which is 60,000 ms; resetTimeoutOnProgress defaults to false; and maxTotalTimeout has no default, meaning no ceiling.
// Author: Sandeep Belgavi. A long tool call with an idle clock and a ceiling.
const result = await client.callTool(
{ name: "reconcile_stock", arguments: { store: "main" } },
{
timeout: 60_000, // idle clock: no response or progress for 60 s ends the call
resetTimeoutOnProgress: true, // each progress notification restarts the idle clock
maxTotalTimeout: 300_000, // ceiling: five minutes in total
onprogress: (p) => log.info({ progress: p.progress, total: p.total }),
},
);Two defaults matter. With resetTimeoutOnProgress left false, progress notifications are delivered to onprogress but do not extend anything, so a four-minute job fails at 60 seconds even while it reports progress. And with no maxTotalTimeout, a server that keeps sending progress keeps the call open indefinitely once reset is enabled.
Where the SDK checks the ceiling
The detail that surprises people is where maxTotalTimeout is enforced. In _resetTimeout, the SDK computes the elapsed time and throws "Maximum total timeout exceeded" if it is at or above the ceiling; otherwise it clears the idle timer and starts a new one. _resetTimeout runs when a progress notification arrives. There is no separate timer for the ceiling.
Two consequences follow, and the companion example mcp_timeout_clock models both.
First, the ceiling is only observed when progress arrives. If a server sends progress until 290 seconds and then stops, the last reset at 290 seconds starts a new 60-second idle timer, and the call ends at 350 seconds, not 300. The worst case is the ceiling plus one idle timeout.
Second, the two ways of ending differ in what goes on the wire. When the idle timer fires, the SDK's cancel function sends notifications/cancelled for the request (or, on transports with a per-request stream in the 2026-07-28 revision, aborts that stream), and rejects with a timeout error. When the ceiling is exceeded on a progress notification, the handler marks the response as received and rejects directly. In the code I read, that path neither sends notifications/cancelled nor aborts the per-request stream: the stream's abort controller is used only inside cancel, and the promise's finally cleanup removes handlers and timers without touching it. I did not check whether individual transports close the stream on their own. The server may keep working on a request the client has abandoned.
Both are reasonable implementation choices, and both may change in later releases, which is why the model records the commit date. The fix on the caller side is simple: give the ceiling its own timer. An AbortSignal.timeout(300_000) passed as the request's signal fires at 300 seconds whether or not progress is arriving, and the SDK's abort path goes through the same cancel function that sends the cancellation.
const ceiling = AbortSignal.timeout(300_000);
const result = await client.callTool(
{ name: "reconcile_stock", arguments: { store: "main" } },
{ timeout: 60_000, resetTimeoutOnProgress: true, signal: ceiling },
);What the model shows
The model takes an idle timeout, the reset flag, a ceiling, a ceiling mode (sdk, checked only on progress, or timer, its own clock), the times at which progress arrives and the time of the result. Its recorded scenarios:
- Steady progress every 20 seconds and a result at 110 seconds: the result is returned after five resets.
- Progress at 20, 40 and 60 seconds with reset disabled and a result at 90 seconds: the idle timer fires at 60 seconds, a cancellation is sent, and the result at 90 seconds is ignored.
- Progress every 25 seconds forever with a 300-second ceiling: in
sdkmode the call is rejected when the notification at 300 seconds arrives, without a cancellation; intimermode the ceiling fires at 300 seconds and a cancellation is sent. - Progress until 290 seconds, then silence:
sdkmode waits until 350 seconds;timermode stops at 300.
The interactive lab on this page runs the same model with your own numbers and a step-by-step trace.
The late result is the real risk
Stopping waiting does not stop the work. The cancellation text in the specification is explicit about the race: a cancellation may arrive after processing has completed and after a response was sent, receivers MAY ignore it when processing has already completed, both parties MUST handle the race gracefully, and the sender SHOULD ignore any response that arrives after it cancelled. For a read-only tool that is harmless. For a tool with an effect, such as issuing a refund, the timeout tells you nothing about whether the effect happened.
So an agent host should treat a timed-out effectful call as unknown, not failed:
- Send effectful calls with an idempotency key or a client-chosen operation ID in the arguments, so a retry cannot apply the effect twice.
- After a timeout, look the operation up by that ID before retrying or reporting failure to the model.
- Record the late result if one arrives, even though the request promise already rejected, so the audit trail matches what the server did.
What stays deterministic here is the host, not the model. The model should see "the reconciliation timed out after five minutes; its status is unknown and is being checked", not a raw error it might answer by calling the tool again.
Choosing the numbers
Set the idle timeout from the longest gap you expect between signs of life, not from the length of the whole job. If a server sends progress every 10 seconds when healthy, an idle timeout of 30 to 60 seconds detects a stall quickly. Set the ceiling from the user-facing budget for the whole operation, which usually comes from the turn or the workflow step that is waiting. Then check that the ceiling is enforced by a timer, either your own or the SDK's in a version where you have confirmed it, so the worst case is the ceiling rather than the ceiling plus an idle timeout.
For work that routinely exceeds a turn, a request with a long ceiling is the wrong shape. The 2025-11-25 revision added task-augmented requests, where the server returns a task and the client polls or subscribes for its result; the progress specification says the original progress token keeps working for the task's lifetime, and a task is cancelled with tasks/cancel rather than notifications/cancelled. A durable job with an ID is easier to time out, cancel and audit than a request held open for twenty minutes.
Limits of this guide
The timeout and progress rules are quoted from the MCP specification revisions 2025-11-25 and 2026-07-28. The SDK behaviour comes from reading packages/core-internal/src/shared/protocol.ts on the TypeScript SDK main branch on 27 November 2026; it was not exercised against a live server, and other SDKs implement timeouts differently. The companion model reproduces timing and cancellation decisions only.
Interactive experiment
MCP request timeouts: idle clock, progress resets and a hard ceiling. Synthetic browser-local fixtures, adjustable inputs, decision traces and JSON export.