How long will an MCP client wait for your tool call?
Troy Fortin Jr
I build Kin. It sits between AI apps and the accounts they use, and some of its tool calls wait for a person. When an agent tries something you set to Ask me, the call that asked stays open while your phone buzzes. It returns the moment you tap Approve.
That only works if the client is still listening. So I needed one number per client: how long will it hold a single MCP tool call open?
The docs mostly don't say. So I measured it, on October 17 and again today, October 31, 2026.
The short answer
Today's versions: Claude Code 2.1.316, Codex 0.165.0 and Gemini CLI 0.67.0-nightly.20261022.
| What the server does | Claude Code | Codex | Gemini CLI |
|---|---|---|---|
| Holds the HTTP headers until the result | Drops at 60 s | Waits (200 s came back) | Drops at 60 s |
| Streams, with keep-alive comments | Drops at 300 s | Drops at 300 s | Waits to its 600 s timeout |
| Streams, sending nothing | Drops at 300 s | Drops at 300 s | Drops at 300 s |
| Streams, with a progress notice every 5 s | Waits (700 s came back) | Drops at 300 s | Cancels at 600 s |
| Same, with a 30 s timeout configured | Drops at 30 s | Cancels at 30 s | Cancels at 30 s |
| Tells the server it gave up | No | Yes | Yes |
Five different limits, and three different reasons for the number 300. The rest of this post is what each row means.
How I measured
The probe is a small MCP server on the official TypeScript SDK (1.32.1), stateless Streamable HTTP. It has one tool, hold, that waits a given number of seconds and returns. If asked, it sends notifications/progress every 5 seconds while it waits. It answers on three routes:
/mcp: an SSE response. Headers go out at once, and the SDK writes a keep-alive comment every 15 seconds./mcp-noka: the same stream with the keep-alive off, so nothing crosses the wire until the result./mcp-json: the SDK's JSON response mode (enableJsonResponse: true). No headers until the result is ready.
It logs every request, when the headers went out, when the client closed the socket and any notifications/cancelled.
Here is the tool, trimmed:
server.registerTool('hold', {
description: 'Waits the given number of seconds, then returns.',
inputSchema: { seconds: z.number(), progress: z.boolean().optional() },
}, async ({ seconds, progress = false }, extra) => {
const token = extra?._meta?.progressToken;
const start = Date.now();
let next = start + 5_000;
while (Date.now() - start < seconds * 1000) {
if (extra.signal?.aborted) throw new Error('client went away');
if (progress && token !== undefined && Date.now() >= next) {
await extra.sendNotification({
method: 'notifications/progress',
params: { progressToken: token, progress: Math.round((Date.now() - start) / 1000), total: seconds },
});
next += 5_000;
}
await new Promise((resolve) => setTimeout(resolve, 250));
}
return { content: [{ type: 'text', text: `held ${seconds} s` }] };
});
Each CLI ran headless with its real MCP client. I swapped the model for a small fake API server that answers the first turn with one call to hold and the second turn with the tool's result. So a run costs nothing, needs no account and does the same thing every time. Claude Code ran with --bare, Codex with a scratch CODEX_HOME and Gemini CLI with a scratch GEMINI_CLI_HOME, so none of my own settings or hooks were involved.
That's 29 timed runs today, after a 3-second smoke test per client, on an M5 Max running macOS 26.4, over loopback. On October 17 I ran 24 on the versions before these (Claude Code 2.1.302 with a real model, Codex 0.162.1, Gemini CLI 0.65 nightly). The two days agree except where I say so below.
1. The 60-second wall is about headers, not your tool
Claude Code and Gemini CLI dropped every call at 60 seconds when the server held back its response headers. The 70-second call and the 200-second call both died at 60.0 s in Claude Code, and at 60.4 and 60.6 s in Gemini CLI.
In Gemini CLI it isn't the tool timeout. That defaults to 10 minutes (MCP_DEFAULT_TIMEOUT_MSEC = 10 * 60 * 1000 in packages/core/src/tools/mcp-client.ts). On the SSE route, where headers go out right away, the same 200-second call came back fine in both clients.
In Claude Code the wall does move with MCP_TOOL_TIMEOUT. With MCP_TOOL_TIMEOUT=180000, a 130-second call in JSON mode came back on both days. I haven't traced which layer the 60 comes from in either client.
Codex didn't care. In JSON mode a 70-second and a 200-second call both came back with their results.
So the setting that bites here is on the server. If you turn on enableJsonResponse, calls longer than a minute failed in two of these three clients. Raising MCP_TOOL_TIMEOUT fixed Claude Code. I didn't test a raised timeout in Gemini CLI.
2. Three different 300-second limits
All three cut some calls at 300 seconds. They're three different rules.
Codex has a plain wall clock. DEFAULT_TOOL_TIMEOUT is Duration::from_secs(300) in codex-rs/codex-mcp/src/rmcp_client.rs, and tool_timeout_sec on the server's config entry changes it. Every 400-second call ended at 300.0 s, whatever the server sent: keep-alives, silence or a progress notice every 5 seconds.
Gemini CLI drops a silent stream. A stream with no bytes at all for 300 seconds was dropped at 301.7 s today and 302.5 s on October 17. Keep-alive comments are enough to stop it: with the SDK's 15-second keep-alive, a 360-second call came back with no progress at all, and a 620-second call ran until Gemini's own 600-second timeout.
Claude Code has an idle limit that progress notices reset and keep-alive comments don't. A stream carrying keep-alive comments still dropped at 300.0 s (301.9 s on October 17). With a progress notice every 5 seconds, a 360-second call came back on both days, and today a 700-second one did too. So in Claude Code, SSE comments don't count as activity. Progress notifications do.
3. Progress notifications help in one place
The MCP spec lets a client reset its timeout clock when progress arrives, and says it should still enforce a maximum. Here's what each client does with that.
Claude Code resets its 300-second idle limit on progress, but it won't stretch a timeout you set. With MCP_TOOL_TIMEOUT=30000, or "timeout": 30000 on the server entry in .mcp.json, a 50-second call with progress every 5 seconds was dropped at 30 s.
Codex ignores progress for timing. A 30-second tool_timeout_sec cut a progressing call at 30 s, and the default cut one at 300 s.
Gemini CLI ignores it too. A 30-second timeout cancelled a progressing call at 30 s, and a 700-second call with progress was cancelled at its 600-second default.
All three send a progressToken on every tools/call, whether or not anything asked for progress. So you can always send progress to them. Outside Claude Code it's for the person watching, not for the timer.
4. Who tells you they gave up
When a client stops waiting, a server that's doing something with side effects wants to know. The spec says a sender whose request timed out SHOULD issue a cancellation notification.
Claude Code never sent notifications/cancelled in any run. It closes the connection.
Codex 0.165.0 sends notifications/cancelled with the reason tool call response future dropped, then closes. On October 17, 0.162.1 closed without it. That changed in the last two weeks.
Gemini CLI sends notifications/cancelled with MCP error -32001: Request timed out when its own timer fires. When the silent stream died at 301.7 s, the cancel still came, at 600 s, for a request that had been gone for five minutes. Same on both days.
So the signal you can count on is the socket closing. If your tool keeps working after that, nobody hears the result.
5. What each client sends
Nothing secret, but not all of it is obvious.
| Claude Code | Codex | Gemini CLI | |
|---|---|---|---|
| User-Agent | claude-code/2.1.316 (sdk-cli) |
codex-mcp-client/0.165.0 |
node |
| First request | server/discover at 2026-07-28, then initialize at 2025-11-25 |
initialize at 2025-06-18 |
initialize at 2025-06-18 |
MCP-Protocol-Version header |
Yes | Yes | No |
| Capabilities | roots, elicitation (form and URL) | elicitation (form and URL) | roots |
_meta on tools/call |
progressToken, claudecode/toolUseId |
progressToken, session, thread and turn IDs, model, sandbox |
progressToken |
Two things stood out.
Gemini CLI's User-Agent is node, like any other Node program, so a server can't pick it out by header. Its initialize says gemini-cli-mcp-client, but a stateless server doesn't carry that to the next request. It also leaves out the MCP-Protocol-Version header, which the 2025-06-18 spec says a client MUST include on all subsequent requests.
Codex tells every MCP server you add a fair amount about the turn. This is one _meta from today, shortened, with my fake model's name in it:
{
"callId": "call_2",
"x-codex-turn-metadata": {
"session_id": "01a1932b-7ae3-7f31-8e5c-2c72516d6b63",
"thread_id": "01a1932b-7ae3-7f31-8e5c-2c72516d6b63",
"model": "fake-model",
"turn_id": "01a1932b-7bd7-77f0-ab3e-d7d2b14ec40c",
"turn_started_at_unix_ms": 1793470462958,
"thread_source": "user",
"turn_trigger": "exec",
"sandbox": "seatbelt",
"sandbox_mode": "read-only",
"auto_review_enabled": false,
"codex_version": "0.165.0"
},
"threadId": "01a1932b-7ae3-7f31-8e5c-2c72516d6b63",
"progressToken": 1
}
That's handy if you run the server. It's worth knowing if you don't.
The hosted apps I couldn't probe
claude.ai, ChatGPT and Cursor's editor call your server from places I can't watch the same way. Here's what's public. Treat these as reports, not measurements.
- ChatGPT: a reply in OpenAI's developer forum in April said "Currently the hard limit on any tool call is 1 minute". In May, OpenAI_Support said in another thread that it found no documented default and wouldn't build around a fixed number.
- Cursor: a July reply in Cursor's forum says its CLI path "uses the hardcoded SDK default of 60s", that progress doesn't extend it, and that the editor allows about 60 minutes.
- Claude Desktop: a June GitHub issue reports a 4-minute wall-clock limit on remote connectors.
What I do in Kin
A call that waits for a person has to fit inside whichever limit applies. Here's how Kin handles it today:
- Every
readandexecuteanswer is a stream whose headers go out at once. The SDK's keep-alive goes every 15 seconds, and a progress notice every 10 seconds when the client sent a token. That clears the header wall and Gemini's silent-stream limit, and it keeps Claude Code's idle timer reset. - The wait is capped per client, read from the User-Agent, with a margin under each limit: 110 seconds for Claude Code, 120 for current Codex and 45 for anything Kin doesn't recognize. That last group includes Gemini CLI, because
nodecould be anything. - Every change carries a
requestKey. If the client gives up first, the request stays open for the person (for up to an hour, by default), and the agent's next call with the same key returns the outcome instead of running the change again.
The last one matters most. Clients will give up. The fix isn't a longer timeout. It's making the second call safe.
If you build an MCP server
- Send headers right away. Don't use JSON response mode for anything that might run past 50 seconds.
- If the call has a
progressToken, send progress. It keeps Claude Code alive past 300 seconds and does no harm elsewhere. - Plan on about 45 seconds for a client you don't know. For longer work, return a handle and let the agent check back.
- Expect a closed socket when a client gives up, but the spec says a disconnect isn't a cancel, and a network drop looks the same. Only some clients send
notifications/cancelled, so make the work safe to repeat. - Make writes idempotent with a key the client sends, so a retry after a timeout can't do the thing twice.
Run it yourself
Everything is in mcp-timeout-probe.tar.gz: the server, the fake model, the run script, both days' run matrices and both days' raw logs. You can read the server first. It's MIT licensed.
Download it, then:
tar xzf mcp-timeout-probe.tar.gz && cd mcp-timeout-probe && npm install
./run-server.sh & ./run-fake-llm.sh &
./probe-run.sh ccf my-first-run /mcp-json 70 false
python3 -I summarize.py my-first-run
python3 -I summarize.py ccf results/2026-10-31.jsonl
The third line runs Claude Code with the headers held back for 70 s, and the last one summarizes today's Claude Code runs.
If your client or version gives a different number, I'd like to see it. The limits held between my two runs, but Codex changed how it gives up, so these numbers will drift.