Support per-server timeouts for long-running MCP tool calls - #515
Open
praaline wants to merge 1 commit into
Open
Support per-server timeouts for long-running MCP tool calls#515praaline wants to merge 1 commit into
praaline wants to merge 1 commit into
Conversation
rockfordlhotka
self-requested a review
August 24, 2026 14:53
rockfordlhotka
approved these changes
Aug 24, 2026
There was a problem hiding this comment.
Pull request overview
This PR adds per-server timeout support for long-running MCP tool calls by introducing toolTimeoutMs in mcp.json, raising the bridge’s maximum allowed timeout to 15 minutes, and decoupling the timeout the agent proxy advertises to the bridge from how long the proxy waits for a response.
Changes:
- Added
ToolTimeoutMstoMcpBridgeServerConfigand applied it as an override when determining the bridge’s effective tool-call timeout (capped byMaxTimeoutMs). - Increased
McpBridgeOptions.MaxTimeoutMsto 900,000 ms (15 minutes) and updated the bridge timeout parsing accordingly. - Updated
McpToolProxyto support separaterequestTimeout(advertised) andresponseTimeout(local wait) and added regression tests for the separation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/RockBot.Tools.Tests/McpToolProxyTests.cs | Adds regression test ensuring proxy can wait longer than the timeout it advertises to the bridge. |
| tests/RockBot.Agent.Tests/McpBridgeServerConfigTests.cs | Ensures ToolTimeoutMs does not affect canonical server identity (dedup/registration stability). |
| src/RockBot.Tools.Mcp/McpToolProxy.cs | Splits advertised request timeout from proxy response wait timeout. |
| src/RockBot.Tools.Mcp/McpServiceCollectionExtensions.cs | Updates DI registration to construct McpToolProxy with separate timeouts. |
| src/RockBot.Agent/Program.cs | Configures agent MCP proxy with a short advertised timeout and a longer response wait. |
| src/RockBot.Agent/McpBridge/McpBridgeService.cs | Applies per-server tool timeout override (capped) when executing tool calls. |
| src/RockBot.Agent/McpBridge/McpBridgeServerConfig.cs | Introduces ToolTimeoutMs in the bridge server config model. |
| src/RockBot.Agent/McpBridge/McpBridgeOptions.cs | Raises the bridge’s maximum allowed timeout to 15 minutes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+41
to
+42
| _requestTimeout = requestTimeout ?? TimeSpan.FromSeconds(60); | ||
| _responseTimeout = responseTimeout ?? _requestTimeout; |
Comment on lines
+311
to
+314
| agent.AddToolHandler(); | ||
| agent.AddMcpToolProxy( | ||
| requestTimeout: TimeSpan.FromSeconds(60), | ||
| responseTimeout: TimeSpan.FromSeconds(930)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for MCP servers whose tool calls legitimately require a longer
execution budget, while preserving the existing timeout behavior for ordinary
MCP servers.
Closes #514.
Changes
ToolTimeoutMstoMcpBridgeServerConfig;MaxTimeoutMs;McpToolProxyfrom how long the proxywaits for the bridge to respond;
so timeout responses can propagate normally.
Example:
{ "file-analysis": { "toolTimeoutMs": 900000 } }Why
Some analytical MCP operations can legitimately take several minutes. The
previous proxy timeout caused these calls to fail even though the downstream
MCP operation would complete successfully if allowed to continue.
Per-server configuration avoids increasing the normal execution timeout for
all MCP services.
Tests
Added regression coverage for:
dotnet test RockBot.slnxpasses.