From eb4c887381f68a30a8af261b792331fbdd7d7900 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Mon, 22 Sep 2025 18:33:49 +0100 Subject: [PATCH 01/10] feat: Add support for custom HTTPX client factory in StreamableHTTPConnectionParams --- .../adk/tools/mcp_tool/mcp_session_manager.py | 9 +++++-- .../mcp_tool/test_mcp_session_manager.py | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index fbe843a510..deca7d463c 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -27,16 +27,17 @@ from typing import Optional from typing import TextIO from typing import Union +from typing import runtime_checkable import anyio -from pydantic import BaseModel +from pydantic import BaseModel, ConfigDict try: from mcp import ClientSession from mcp import StdioServerParameters from mcp.client.sse import sse_client from mcp.client.stdio import stdio_client - from mcp.client.streamable_http import streamablehttp_client + from mcp.client.streamable_http import streamablehttp_client, McpHttpClientFactory except ImportError as e: if sys.version_info < (3, 10): @@ -101,11 +102,14 @@ class StreamableHTTPConnectionParams(BaseModel): when the connection is closed. """ + model_config = ConfigDict(arbitrary_types_allowed=True, ) + url: str headers: dict[str, Any] | None = None timeout: float = 5.0 sse_read_timeout: float = 60 * 5.0 terminate_on_close: bool = True + httpx_client_factory: Optional[runtime_checkable(McpHttpClientFactory)] = None def retry_on_closed_resource(func): @@ -285,6 +289,7 @@ def _create_client(self, merged_headers: Optional[Dict[str, str]] = None): seconds=self._connection_params.sse_read_timeout ), terminate_on_close=self._connection_params.terminate_on_close, + httpx_client_factory=self._connection_params.httpx_client_factory, ) else: raise ValueError( diff --git a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py index 559e51719a..d3ece9549f 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py @@ -144,6 +144,30 @@ def test_init_with_streamable_http_params(self): assert manager._connection_params == http_params + @pytest.mark.asyncio + async def test_init_with_streamable_http_custom_httpx_factory(self): + """Test initialization with StreamableHTTPConnectionParams.""" + import httpx + custom_httpx_client = httpx.AsyncClient() + + def _httpx_factory(headers=None, timeout=None, auth=None): + return custom_httpx_client + + custom_httpx_factory = Mock(side_effect=_httpx_factory) + + http_params = StreamableHTTPConnectionParams( + url="https://example.com/mcp", + timeout=15.0, + httpx_client_factory=custom_httpx_factory, + ) + manager = MCPSessionManager(http_params) + + async with manager._create_client(): + #assert factory was called + custom_httpx_factory.assert_called_once() + + + def test_generate_session_key_stdio(self): """Test session key generation for stdio connections.""" manager = MCPSessionManager(self.mock_stdio_connection_params) From ee16c0e6118663668b2a749eada260536b012975 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Mon, 22 Sep 2025 18:38:24 +0100 Subject: [PATCH 02/10] Update src/google/adk/tools/mcp_tool/mcp_session_manager.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- src/google/adk/tools/mcp_tool/mcp_session_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index deca7d463c..7aded4a793 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -102,7 +102,7 @@ class StreamableHTTPConnectionParams(BaseModel): when the connection is closed. """ - model_config = ConfigDict(arbitrary_types_allowed=True, ) + model_config = ConfigDict(arbitrary_types_allowed=True) url: str headers: dict[str, Any] | None = None From a1fcb659aea59aef224eb94aca476852aea2f140 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Mon, 22 Sep 2025 18:41:57 +0100 Subject: [PATCH 03/10] unit tested mock --- .../mcp_tool/test_mcp_session_manager.py | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py index d3ece9549f..d91ed075ff 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py @@ -144,16 +144,14 @@ def test_init_with_streamable_http_params(self): assert manager._connection_params == http_params - @pytest.mark.asyncio - async def test_init_with_streamable_http_custom_httpx_factory(self): - """Test initialization with StreamableHTTPConnectionParams.""" - import httpx - custom_httpx_client = httpx.AsyncClient() + @patch("google.adk.tools.mcp_tool.mcp_session_manager.streamablehttp_client") + def test_init_with_streamable_http_custom_httpx_factory( + self, mock_streamablehttp_client + ): + """Test that streamablehttp_client is called with custom httpx_client_factory.""" + from datetime import timedelta - def _httpx_factory(headers=None, timeout=None, auth=None): - return custom_httpx_client - - custom_httpx_factory = Mock(side_effect=_httpx_factory) + custom_httpx_factory = Mock() http_params = StreamableHTTPConnectionParams( url="https://example.com/mcp", @@ -162,9 +160,16 @@ def _httpx_factory(headers=None, timeout=None, auth=None): ) manager = MCPSessionManager(http_params) - async with manager._create_client(): - #assert factory was called - custom_httpx_factory.assert_called_once() + manager._create_client() + + mock_streamablehttp_client.assert_called_once_with( + url="https://example.com/mcp", + headers=None, + timeout=timedelta(seconds=15.0), + sse_read_timeout=timedelta(seconds=300.0), + terminate_on_close=True, + httpx_client_factory=custom_httpx_factory, + ) From cdedb047e5983bb47ae98a690f11a8ec4035b2da Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Thu, 25 Sep 2025 19:49:37 +0100 Subject: [PATCH 04/10] provide default - httpx client factory can't be none --- .../adk/tools/mcp_tool/mcp_session_manager.py | 52 +++++++++++-------- .../mcp_tool/test_mcp_session_manager.py | 26 ++++++++++ 2 files changed, 55 insertions(+), 23 deletions(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index 7aded4a793..5048e3db40 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -24,6 +24,7 @@ import sys from typing import Any from typing import Dict +from typing import Protocol from typing import Optional from typing import TextIO from typing import Union @@ -37,7 +38,7 @@ from mcp import StdioServerParameters from mcp.client.sse import sse_client from mcp.client.stdio import stdio_client - from mcp.client.streamable_http import streamablehttp_client, McpHttpClientFactory + from mcp.client.streamable_http import streamablehttp_client, McpHttpClientFactory, create_mcp_http_client except ImportError as e: if sys.version_info < (3, 10): @@ -84,32 +85,37 @@ class SseConnectionParams(BaseModel): timeout: float = 5.0 sse_read_timeout: float = 60 * 5.0 +@runtime_checkable +class CheckableMcpHttpClientFactory(McpHttpClientFactory, Protocol): + pass class StreamableHTTPConnectionParams(BaseModel): - """Parameters for the MCP Streamable HTTP connection. - - See MCP Streamable HTTP Client documentation for more details. - https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py - - Attributes: - url: URL for the MCP Streamable HTTP server. - headers: Headers for the MCP Streamable HTTP connection. - timeout: Timeout in seconds for establishing the connection to the MCP - Streamable HTTP server. - sse_read_timeout: Timeout in seconds for reading data from the MCP - Streamable HTTP server. - terminate_on_close: Whether to terminate the MCP Streamable HTTP server - when the connection is closed. - """ + """Parameters for the MCP Streamable HTTP connection. + + See MCP Streamable HTTP Client documentation for more details. + https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py + + Attributes: + url: URL for the MCP Streamable HTTP server. + headers: Headers for the MCP Streamable HTTP connection. + timeout: Timeout in seconds for establishing the connection to the MCP + Streamable HTTP server. + sse_read_timeout: Timeout in seconds for reading data from the MCP + Streamable HTTP server. + terminate_on_close: Whether to terminate the MCP Streamable HTTP server + when the connection is closed. + """ - model_config = ConfigDict(arbitrary_types_allowed=True) + model_config = ConfigDict(arbitrary_types_allowed=True) - url: str - headers: dict[str, Any] | None = None - timeout: float = 5.0 - sse_read_timeout: float = 60 * 5.0 - terminate_on_close: bool = True - httpx_client_factory: Optional[runtime_checkable(McpHttpClientFactory)] = None + url: str + headers: dict[str, Any] | None = None + timeout: float = 5.0 + sse_read_timeout: float = 60 * 5.0 + terminate_on_close: bool = True + httpx_client_factory: CheckableMcpHttpClientFactory = ( + create_mcp_http_client + ) def retry_on_closed_resource(func): diff --git a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py index d91ed075ff..8a502f12fe 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py @@ -171,6 +171,32 @@ def test_init_with_streamable_http_custom_httpx_factory( httpx_client_factory=custom_httpx_factory, ) + @pytest.mark.asyncio + @patch("google.adk.tools.mcp_tool.mcp_session_manager.streamablehttp_client") + async def test_init_with_streamable_http_none_httpx_factory( + self, mock_streamablehttp_client + ): + """Test that streamablehttp_client is called with custom httpx_client_factory.""" + from datetime import timedelta + from mcp.client.streamable_http import create_mcp_http_client + + http_params = StreamableHTTPConnectionParams( + url="https://example.com/mcp", + timeout=15.0 + ) + manager = MCPSessionManager(http_params) + + manager._create_client() + + mock_streamablehttp_client.assert_called_once_with( + url="https://example.com/mcp", + headers=None, + timeout=timedelta(seconds=15.0), + sse_read_timeout=timedelta(seconds=300.0), + terminate_on_close=True, + httpx_client_factory=create_mcp_http_client, + ) + def test_generate_session_key_stdio(self): From 4ce2156d4165fa9925ff887854afe8ba287fa4c0 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Thu, 25 Sep 2025 19:52:06 +0100 Subject: [PATCH 05/10] feat: Enhance StreamableHTTPConnectionParams with httpx_client_factory attribute --- .../adk/tools/mcp_tool/mcp_session_manager.py | 52 ++++++++++--------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index 5048e3db40..c956ce596d 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -87,35 +87,37 @@ class SseConnectionParams(BaseModel): @runtime_checkable class CheckableMcpHttpClientFactory(McpHttpClientFactory, Protocol): - pass + pass class StreamableHTTPConnectionParams(BaseModel): - """Parameters for the MCP Streamable HTTP connection. - - See MCP Streamable HTTP Client documentation for more details. - https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py - - Attributes: - url: URL for the MCP Streamable HTTP server. - headers: Headers for the MCP Streamable HTTP connection. - timeout: Timeout in seconds for establishing the connection to the MCP - Streamable HTTP server. - sse_read_timeout: Timeout in seconds for reading data from the MCP - Streamable HTTP server. - terminate_on_close: Whether to terminate the MCP Streamable HTTP server - when the connection is closed. - """ + """Parameters for the MCP Streamable HTTP connection. + + See MCP Streamable HTTP Client documentation for more details. + https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py + + Attributes: + url: URL for the MCP Streamable HTTP server. + headers: Headers for the MCP Streamable HTTP connection. + timeout: Timeout in seconds for establishing the connection to the MCP + Streamable HTTP server. + sse_read_timeout: Timeout in seconds for reading data from the MCP + Streamable HTTP server. + terminate_on_close: Whether to terminate the MCP Streamable HTTP server + when the connection is closed. + httpx_client_factory: Factory function to create a custom HTTPX client. If + not provided, a default factory will be used. + """ - model_config = ConfigDict(arbitrary_types_allowed=True) + model_config = ConfigDict(arbitrary_types_allowed=True) - url: str - headers: dict[str, Any] | None = None - timeout: float = 5.0 - sse_read_timeout: float = 60 * 5.0 - terminate_on_close: bool = True - httpx_client_factory: CheckableMcpHttpClientFactory = ( - create_mcp_http_client - ) + url: str + headers: dict[str, Any] | None = None + timeout: float = 5.0 + sse_read_timeout: float = 60 * 5.0 + terminate_on_close: bool = True + httpx_client_factory: CheckableMcpHttpClientFactory = ( + create_mcp_http_client + ) def retry_on_closed_resource(func): From 3d7dd6fc100dc8c8a3ab04afa4c9640158bb5051 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Thu, 25 Sep 2025 19:52:45 +0100 Subject: [PATCH 06/10] fmt --- src/google/adk/tools/mcp_tool/mcp_session_manager.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index c956ce596d..059fb188c4 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -115,9 +115,7 @@ class StreamableHTTPConnectionParams(BaseModel): timeout: float = 5.0 sse_read_timeout: float = 60 * 5.0 terminate_on_close: bool = True - httpx_client_factory: CheckableMcpHttpClientFactory = ( - create_mcp_http_client - ) + httpx_client_factory: CheckableMcpHttpClientFactory = create_mcp_http_client def retry_on_closed_resource(func): From f5f6a2419740e13b89dfe5d2fe667a7db7793636 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Fri, 26 Sep 2025 08:31:29 +0100 Subject: [PATCH 07/10] fmt --- src/google/adk/tools/mcp_tool/mcp_session_manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index 059fb188c4..80d08563c6 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -38,7 +38,9 @@ from mcp import StdioServerParameters from mcp.client.sse import sse_client from mcp.client.stdio import stdio_client - from mcp.client.streamable_http import streamablehttp_client, McpHttpClientFactory, create_mcp_http_client + from mcp.client.streamable_http import streamablehttp_client + from mcp.client.streamable_http import McpHttpClientFactory + from mcp.client.streamable_http import create_mcp_http_client except ImportError as e: if sys.version_info < (3, 10): From bae0d91b0d0dbf6cfe1c7c43cde9938dd4e26252 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Fri, 26 Sep 2025 08:32:24 +0100 Subject: [PATCH 08/10] refactor: Rename test_init_with_streamable_http_none_httpx_factory to test_init_with_streamable_http_default_httpx_factory for clarity --- tests/unittests/tools/mcp_tool/test_mcp_session_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py index 8a502f12fe..d72634e0d6 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py @@ -173,7 +173,7 @@ def test_init_with_streamable_http_custom_httpx_factory( @pytest.mark.asyncio @patch("google.adk.tools.mcp_tool.mcp_session_manager.streamablehttp_client") - async def test_init_with_streamable_http_none_httpx_factory( + async def test_init_with_streamable_http_default_httpx_factory( self, mock_streamablehttp_client ): """Test that streamablehttp_client is called with custom httpx_client_factory.""" From a1c8f821a9c68e5074fecc00468638300b8ea532 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Fri, 26 Sep 2025 08:44:11 +0100 Subject: [PATCH 09/10] isort --- src/google/adk/tools/mcp_tool/mcp_session_manager.py | 11 ++++++----- .../tools/mcp_tool/test_mcp_session_manager.py | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index 80d08563c6..e0260216c0 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -24,23 +24,24 @@ import sys from typing import Any from typing import Dict -from typing import Protocol from typing import Optional +from typing import Protocol +from typing import runtime_checkable from typing import TextIO from typing import Union -from typing import runtime_checkable import anyio -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel +from pydantic import ConfigDict try: from mcp import ClientSession from mcp import StdioServerParameters from mcp.client.sse import sse_client from mcp.client.stdio import stdio_client - from mcp.client.streamable_http import streamablehttp_client - from mcp.client.streamable_http import McpHttpClientFactory from mcp.client.streamable_http import create_mcp_http_client + from mcp.client.streamable_http import McpHttpClientFactory + from mcp.client.streamable_http import streamablehttp_client except ImportError as e: if sys.version_info < (3, 10): diff --git a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py index d72634e0d6..51655fbaf8 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py @@ -178,6 +178,7 @@ async def test_init_with_streamable_http_default_httpx_factory( ): """Test that streamablehttp_client is called with custom httpx_client_factory.""" from datetime import timedelta + from mcp.client.streamable_http import create_mcp_http_client http_params = StreamableHTTPConnectionParams( From 88bdeb86d8788b83f230c6ac77a0d2abcd1a155d Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Fri, 26 Sep 2025 08:45:50 +0100 Subject: [PATCH 10/10] fmt --- .../adk/tools/mcp_tool/mcp_session_manager.py | 2 + .../mcp_tool/test_mcp_session_manager.py | 39 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/google/adk/tools/mcp_tool/mcp_session_manager.py b/src/google/adk/tools/mcp_tool/mcp_session_manager.py index e0260216c0..0f75078b15 100644 --- a/src/google/adk/tools/mcp_tool/mcp_session_manager.py +++ b/src/google/adk/tools/mcp_tool/mcp_session_manager.py @@ -88,10 +88,12 @@ class SseConnectionParams(BaseModel): timeout: float = 5.0 sse_read_timeout: float = 60 * 5.0 + @runtime_checkable class CheckableMcpHttpClientFactory(McpHttpClientFactory, Protocol): pass + class StreamableHTTPConnectionParams(BaseModel): """Parameters for the MCP Streamable HTTP connection. diff --git a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py index 51655fbaf8..5b827fb170 100644 --- a/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py +++ b/tests/unittests/tools/mcp_tool/test_mcp_session_manager.py @@ -146,7 +146,7 @@ def test_init_with_streamable_http_params(self): @patch("google.adk.tools.mcp_tool.mcp_session_manager.streamablehttp_client") def test_init_with_streamable_http_custom_httpx_factory( - self, mock_streamablehttp_client + self, mock_streamablehttp_client ): """Test that streamablehttp_client is called with custom httpx_client_factory.""" from datetime import timedelta @@ -154,27 +154,27 @@ def test_init_with_streamable_http_custom_httpx_factory( custom_httpx_factory = Mock() http_params = StreamableHTTPConnectionParams( - url="https://example.com/mcp", - timeout=15.0, - httpx_client_factory=custom_httpx_factory, + url="https://example.com/mcp", + timeout=15.0, + httpx_client_factory=custom_httpx_factory, ) manager = MCPSessionManager(http_params) manager._create_client() mock_streamablehttp_client.assert_called_once_with( - url="https://example.com/mcp", - headers=None, - timeout=timedelta(seconds=15.0), - sse_read_timeout=timedelta(seconds=300.0), - terminate_on_close=True, - httpx_client_factory=custom_httpx_factory, + url="https://example.com/mcp", + headers=None, + timeout=timedelta(seconds=15.0), + sse_read_timeout=timedelta(seconds=300.0), + terminate_on_close=True, + httpx_client_factory=custom_httpx_factory, ) @pytest.mark.asyncio @patch("google.adk.tools.mcp_tool.mcp_session_manager.streamablehttp_client") async def test_init_with_streamable_http_default_httpx_factory( - self, mock_streamablehttp_client + self, mock_streamablehttp_client ): """Test that streamablehttp_client is called with custom httpx_client_factory.""" from datetime import timedelta @@ -182,24 +182,21 @@ async def test_init_with_streamable_http_default_httpx_factory( from mcp.client.streamable_http import create_mcp_http_client http_params = StreamableHTTPConnectionParams( - url="https://example.com/mcp", - timeout=15.0 + url="https://example.com/mcp", timeout=15.0 ) manager = MCPSessionManager(http_params) manager._create_client() mock_streamablehttp_client.assert_called_once_with( - url="https://example.com/mcp", - headers=None, - timeout=timedelta(seconds=15.0), - sse_read_timeout=timedelta(seconds=300.0), - terminate_on_close=True, - httpx_client_factory=create_mcp_http_client, + url="https://example.com/mcp", + headers=None, + timeout=timedelta(seconds=15.0), + sse_read_timeout=timedelta(seconds=300.0), + terminate_on_close=True, + httpx_client_factory=create_mcp_http_client, ) - - def test_generate_session_key_stdio(self): """Test session key generation for stdio connections.""" manager = MCPSessionManager(self.mock_stdio_connection_params)