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.
This commit is contained in:
Luc Nguyen
2026-06-19 21:07:51 +08:00
committed by Xubin Ren
parent 33638417be
commit d7abf39169
+1 -1
View File
@@ -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(