From 252917f30c850d40d91232cf80fb72f2e98f01c1 Mon Sep 17 00:00:00 2001 From: aryanmotgi Date: Mon, 25 May 2026 23:04:43 -0700 Subject: [PATCH 1/3] 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/3] 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: From 52c9bc57548786624de01c0c547c738a126e4450 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Tue, 2 Jun 2026 18:20:38 +0200 Subject: [PATCH 3/3] docs: tighten timeout docstring wording --- src/mcp/shared/_httpx_utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mcp/shared/_httpx_utils.py b/src/mcp/shared/_httpx_utils.py index 23b2667da5..6a121aff6d 100644 --- a/src/mcp/shared/_httpx_utils.py +++ b/src/mcp/shared/_httpx_utils.py @@ -27,15 +27,12 @@ def create_mcp_http_client( ) -> httpx.AsyncClient: """Create a standardized httpx AsyncClient with MCP defaults. - This function provides common defaults used throughout the MCP codebase: - - follow_redirects=True (always enabled) - - Default ``timeout`` tuned for long-lived SSE streams (see ``timeout`` below). + Always enables follow_redirects and applies an SSE-friendly default timeout. 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 (to accommodate long-lived - SSE streams) if not specified. + timeout: Request timeout as httpx.Timeout object. Defaults to 30s for + connect/write/pool and 300s for read (for long-lived SSE streams). auth: Optional authentication handler. Returns: