Skip to content

Commit 0bcecff

Browse files
authored
set timeout for sse in httpx_client_factory (#943)
1 parent 20dc0fb commit 0bcecff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/mcp/client/sse.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ async def sse_client(
5454
async with anyio.create_task_group() as tg:
5555
try:
5656
logger.debug(f"Connecting to SSE endpoint: {remove_request_params(url)}")
57-
async with httpx_client_factory(headers=headers, auth=auth) as client:
57+
async with httpx_client_factory(
58+
headers=headers, auth=auth, timeout=httpx.Timeout(timeout, read=sse_read_timeout)
59+
) as client:
5860
async with aconnect_sse(
5961
client,
6062
"GET",
6163
url,
62-
timeout=httpx.Timeout(timeout, read=sse_read_timeout),
6364
) as event_source:
6465
event_source.response.raise_for_status()
6566
logger.debug("SSE connection established")

0 commit comments

Comments
 (0)