From 252917f30c850d40d91232cf80fb72f2e98f01c1 Mon Sep 17 00:00:00 2001 From: aryanmotgi Date: Mon, 25 May 2026 23:04:43 -0700 Subject: [PATCH 1/2] docs: correct create_mcp_http_client default timeout docstring The docstring claimed the default timeout is 30 seconds, but the implementation sets httpx.Timeout(30, read=300) so the read timeout is actually 5 minutes to accommodate long-lived SSE streams. Update the docstring to reflect the real defaults. --- src/mcp/shared/_httpx_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mcp/shared/_httpx_utils.py b/src/mcp/shared/_httpx_utils.py index 251469eaa1..602eb0a378 100644 --- a/src/mcp/shared/_httpx_utils.py +++ b/src/mcp/shared/_httpx_utils.py @@ -29,12 +29,14 @@ def create_mcp_http_client( This function provides common defaults used throughout the MCP codebase: - follow_redirects=True (always enabled) - - Default timeout of 30 seconds if not specified + - Default timeout of 30 seconds for connect/write/pool and 300 seconds for read (to + accommodate long-lived SSE streams) if not specified Args: headers: Optional headers to include with all requests. timeout: Request timeout as httpx.Timeout object. - Defaults to 30 seconds if not specified. + Defaults to 30 seconds for connect/write/pool and 300 seconds for read if + not specified. auth: Optional authentication handler. Returns: From 452b15ea7049af3eb64b06635bfd577e6ff23277 Mon Sep 17 00:00:00 2001 From: Aryan Motgi Date: Tue, 26 May 2026 01:54:16 -0700 Subject: [PATCH 2/2] docs: consolidate timeout description per review --- src/mcp/shared/_httpx_utils.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mcp/shared/_httpx_utils.py b/src/mcp/shared/_httpx_utils.py index 602eb0a378..23b2667da5 100644 --- a/src/mcp/shared/_httpx_utils.py +++ b/src/mcp/shared/_httpx_utils.py @@ -29,14 +29,13 @@ def create_mcp_http_client( This function provides common defaults used throughout the MCP codebase: - follow_redirects=True (always enabled) - - Default timeout of 30 seconds for connect/write/pool and 300 seconds for read (to - accommodate long-lived SSE streams) if not specified + - Default ``timeout`` tuned for long-lived SSE streams (see ``timeout`` below). Args: headers: Optional headers to include with all requests. - timeout: Request timeout as httpx.Timeout object. - Defaults to 30 seconds for connect/write/pool and 300 seconds for read if - not specified. + timeout: Request timeout as httpx.Timeout object. Defaults to 30 seconds for + connect/write/pool and 300 seconds for read (to accommodate long-lived + SSE streams) if not specified. auth: Optional authentication handler. Returns: