From 715883a5f8dde1a1b81b313bd253c7992a869ce6 Mon Sep 17 00:00:00 2001 From: ihrpr Date: Thu, 12 Jun 2025 08:59:44 +0100 Subject: [PATCH 1/2] set timeout for sse in httpx_client_factory --- src/mcp/client/sse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mcp/client/sse.py b/src/mcp/client/sse.py index 1ce6a6da4..1e7bf7f59 100644 --- a/src/mcp/client/sse.py +++ b/src/mcp/client/sse.py @@ -54,7 +54,9 @@ async def sse_client( async with anyio.create_task_group() as tg: try: logger.debug(f"Connecting to SSE endpoint: {remove_request_params(url)}") - async with httpx_client_factory(headers=headers, auth=auth) as client: + async with httpx_client_factory( + headers=headers, auth=auth, timeout=httpx.Timeout(timeout, read=sse_read_timeout) + ) as client: async with aconnect_sse( client, "GET", From 2f393f7da0bcccf1a8168752f69b58b47b6c06d1 Mon Sep 17 00:00:00 2001 From: ihrpr Date: Thu, 12 Jun 2025 09:05:20 +0100 Subject: [PATCH 2/2] remove from aconnect_sse --- src/mcp/client/sse.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mcp/client/sse.py b/src/mcp/client/sse.py index 1e7bf7f59..0c05c6def 100644 --- a/src/mcp/client/sse.py +++ b/src/mcp/client/sse.py @@ -61,7 +61,6 @@ async def sse_client( client, "GET", url, - timeout=httpx.Timeout(timeout, read=sse_read_timeout), ) as event_source: event_source.response.raise_for_status() logger.debug("SSE connection established")