Skip to content

Agent Zero AI framework

Fix: Remove hard-coded timeout caps on MCP tool execution

Chetan Reddyb4ba1dee4c3b
diff --git a/python/helpers/mcp_handler.py b/python/helpers/mcp_handler.py
index 1a16acb49..dfbff238e 100644
--- a/python/helpers/mcp_handler.py
+++ b/python/helpers/mcp_handler.py
@@ -1071,9 +1071,9 @@ class MCPClientRemote(MCPClientBase):
server: MCPServerRemote = cast(MCPServerRemote, self.server)
set = settings.get_settings()
- # Use lower timeouts for faster failure detection
- init_timeout = min(server.init_timeout or set["mcp_client_init_timeout"], 5)
- tool_timeout = min(server.tool_timeout or set["mcp_client_tool_timeout"], 10)
+ # Resolve timeout: check server config first, then settings, defaulting to 5s/10s
+ init_timeout = server.init_timeout or set["mcp_client_init_timeout"] or 5
+ tool_timeout = server.tool_timeout or set["mcp_client_tool_timeout"] or 10
client_factory = CustomHTTPClientFactory(verify=server.verify)
# Check if this is a streaming HTTP type