Fix: Remove hard-coded timeout caps on MCP tool execution
Previously, MCP tool timeouts were strictly capped at 5s (init) and 10s (execution) regardless of configuration settings. This prevented long-running operations (e.g., >30s SSE transport calls) from completing successfully. Logic updated to fully respect mcp_client_init_timeout and mcp_client_tool_timeout settings, falling back to defaults only when no configuration is present.
Chetan Reddy committed
Jan 24, 2026 at 18:41 UTC
b4ba1dee4c3bd2c80f6f44a7cc8d7eb56c0eecc9
1 file changed
+3
-3
python/helpers/mcp_handler.py
+3
-3
@@ -1071,9 +1071,9 @@ class MCPClientRemote(MCPClientBase):
1071
server: MCPServerRemote = cast(MCPServerRemote, self.server)
1072
set = settings.get_settings()
1073
1074
- # Use lower timeouts for faster failure detection
1075
- init_timeout = min(server.init_timeout or set["mcp_client_init_timeout"], 5)
1076
- tool_timeout = min(server.tool_timeout or set["mcp_client_tool_timeout"], 10)
1074
+ # Resolve timeout: check server config first, then settings, defaulting to 5s/10s
1075
+ init_timeout = server.init_timeout or set["mcp_client_init_timeout"] or 5
1076
+ tool_timeout = server.tool_timeout or set["mcp_client_tool_timeout"] or 10
1077
1078
client_factory = CustomHTTPClientFactory(verify=server.verify)
1079
# Check if this is a streaming HTTP type