From 08b9874070f7b661f13cc023dfd2289da80547e4 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 21 Mar 2025 22:31:14 +0800 Subject: [PATCH 1/2] feat(client/sse): allow to set the timeout of `POST /messages` --- src/mcp/client/sse.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mcp/client/sse.py b/src/mcp/client/sse.py index 4f6241a72..e3bf305df 100644 --- a/src/mcp/client/sse.py +++ b/src/mcp/client/sse.py @@ -120,6 +120,7 @@ async def post_writer(endpoint_url: str): mode="json", exclude_none=True, ), + timeout=httpx.Timeout(timeout, read=sse_read_timeout), ) response.raise_for_status() logger.debug( From 81f10c20d833a9d9941df1e9543d69cf04dd0f70 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 21 Mar 2025 22:48:07 +0800 Subject: [PATCH 2/2] style: fix line too long --- src/mcp/client/sse.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mcp/client/sse.py b/src/mcp/client/sse.py index e3bf305df..f4092853d 100644 --- a/src/mcp/client/sse.py +++ b/src/mcp/client/sse.py @@ -120,7 +120,10 @@ async def post_writer(endpoint_url: str): mode="json", exclude_none=True, ), - timeout=httpx.Timeout(timeout, read=sse_read_timeout), + timeout=httpx.Timeout( + timeout, + read=sse_read_timeout, + ), ) response.raise_for_status() logger.debug(