From d7abf39169f97d785923dcfda5206e683e7e69c9 Mon Sep 17 00:00:00 2001 From: Luc Nguyen Date: Sun, 7 Jun 2026 05:31:03 +0000 Subject: [PATCH] fix: set httpx timeout for streamableHttp transport to prevent event loop blocking timeout=None causes the httpx client to wait indefinitely when connecting to MCP servers via streamableHttp transport, blocking the entire event loop. This prevents Telegram polling and other async operations from running. Set timeout=httpx.Timeout(30.0, connect=10.0) to match the pattern used in the SSE transport's httpx_client_factory. --- nanobot/agent/tools/mcp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanobot/agent/tools/mcp.py b/nanobot/agent/tools/mcp.py index 2fb7da89..d31aa676 100644 --- a/nanobot/agent/tools/mcp.py +++ b/nanobot/agent/tools/mcp.py @@ -740,7 +740,7 @@ async def connect_mcp_servers( headers=cfg.headers or None, event_hooks={"request": [_validate_mcp_request_url]}, follow_redirects=True, - timeout=None, + timeout=httpx.Timeout(30.0, connect=10.0), ) ) read, write, _ = await server_stack.enter_async_context(