Merge PR #1062: fix(mcp): disable httpx default timeout for HTTP transport
This commit is contained in:
@@ -69,20 +69,18 @@ async def connect_mcp_servers(
|
|||||||
read, write = await stack.enter_async_context(stdio_client(params))
|
read, write = await stack.enter_async_context(stdio_client(params))
|
||||||
elif cfg.url:
|
elif cfg.url:
|
||||||
from mcp.client.streamable_http import streamable_http_client
|
from mcp.client.streamable_http import streamable_http_client
|
||||||
if cfg.headers:
|
# Always provide an explicit httpx client so MCP HTTP transport does not
|
||||||
|
# inherit httpx's default 5s timeout and preempt the higher-level tool timeout.
|
||||||
http_client = await stack.enter_async_context(
|
http_client = await stack.enter_async_context(
|
||||||
httpx.AsyncClient(
|
httpx.AsyncClient(
|
||||||
headers=cfg.headers,
|
headers=cfg.headers or None,
|
||||||
follow_redirects=True
|
follow_redirects=True,
|
||||||
|
timeout=None,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
read, write, _ = await stack.enter_async_context(
|
read, write, _ = await stack.enter_async_context(
|
||||||
streamable_http_client(cfg.url, http_client=http_client)
|
streamable_http_client(cfg.url, http_client=http_client)
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
read, write, _ = await stack.enter_async_context(
|
|
||||||
streamable_http_client(cfg.url)
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
logger.warning("MCP server '{}': no command or url configured, skipping", name)
|
logger.warning("MCP server '{}': no command or url configured, skipping", name)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user