[Feature] Configurable timeout and progress-based timeout reset for MCP tool calls
Description
MCP tool calls have no configurable timeout. The per-server timeout option only bounds the connection handshake and the initial tool listing (the comment at source/mcp/mcp-client.ts around line 277 says tool calls keep the SDK's own default). client.callTool({name, arguments}) in callTool is invoked without a timeout, without resetTimeoutOnProgress, and without a maxTotalTimeout, so every MCP tool call is limited to the MCP SDK's default request timeout (60 seconds, taken from the SDK's documented default; the SDK is not installed in my checkout so I could not re-check the constant).
Long-running MCP tools (test runners, builds, browser automation, database migrations, large exports) fail at the 60 second mark with a request timeout even when the server is healthy and reporting progress.
Use Case
A user connects an MCP server whose tools legitimately take several minutes, such as a CI trigger, a long database query, or a code indexer. The call is aborted client side after 60 seconds, the server keeps running, and the model sees an error and often retries, starting the same job again.
Proposed Solution
Add optional per-server settings next to the existing timeout, for example:
toolTimeout(ms): total time allowed for a tool call, with0or-1meaning no limit.resetTimeoutOnProgress(boolean, default true): reset the timer whenever the server sends a progress notification.
Pass both through to client.callTool(params, resultSchema, {timeout, resetTimeoutOnProgress, maxTotalTimeout, signal}). Document the defaults in the MCP configuration docs and show the effective value in the timeout error message so users know which knob to change.
Alternatives Considered
- Raising the existing
timeout. It does not apply to tool calls, so it has no effect here. - Wrapping slow servers in a background-job pattern. This pushes the problem onto every server author.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] This feature aligns with the project's goals (local-first AI assistance)
Related: #2015 asks for a timeout on execute_bash; this is the same need for MCP tools. Cancellation of in-flight MCP calls is a separate bug, filed on its own.
Implementation Notes (optional)
The config type lives alongside the other per-server fields; MCPServerConfig already carries timeout. The request options object is the third argument of the MCP client's callTool.
hey @akramcodez , i'd like to take this one, could you please assign it to me.