17
17
from types import TracebackType
18
18
from typing import List , Optional , TextIO , Tuple , Type
19
19
20
- from .mcp_session_manager import MCPSessionManager , SseServerParams , retry_on_closed_resource
20
+ from .mcp_session_manager import (MCPSessionManager , SseServerParams , StreamableHTTPServerParams ,
21
+ retry_on_closed_resource )
21
22
22
23
# Attempt to import MCP Tool from the MCP library, and hints user to upgrade
23
24
# their Python version to 3.10 if it fails.
@@ -96,15 +97,15 @@ async def load_tools():
96
97
97
98
Attributes:
98
99
connection_params: The connection parameters to the MCP server. Can be
99
- either `StdioServerParameters` or `SseServerParams `.
100
+ `StdioServerParameters`, `SseServerParams` or `StreamableHTTPServerParams `.
100
101
exit_stack: The async exit stack to manage the connection to the MCP server.
101
102
session: The MCP session being initialized with the connection.
102
103
"""
103
104
104
105
def __init__ (
105
106
self ,
106
107
* ,
107
- connection_params : StdioServerParameters | SseServerParams ,
108
+ connection_params : StdioServerParameters | SseServerParams | StreamableHTTPServerParams ,
108
109
errlog : TextIO = sys .stderr ,
109
110
exit_stack = AsyncExitStack (),
110
111
):
@@ -166,7 +167,8 @@ async def load_tools():
166
167
Args:
167
168
connection_params: The connection parameters to the MCP server. Can be:
168
169
`StdioServerParameters` for using local mcp server (e.g. using `npx` or
169
- `python3`); or `SseServerParams` for a local/remote SSE server.
170
+ `python3`); `SseServerParams` for a local/remote SSE server; or
171
+ `StreamableHTTPServerParams` for local/remote Streamable http server.
170
172
"""
171
173
if not connection_params :
172
174
raise ValueError ('Missing connection params in MCPToolset.' )
@@ -184,7 +186,7 @@ async def load_tools():
184
186
async def from_server (
185
187
cls ,
186
188
* ,
187
- connection_params : StdioServerParameters | SseServerParams ,
189
+ connection_params : StdioServerParameters | SseServerParams | StreamableHTTPServerParams ,
188
190
async_exit_stack : Optional [AsyncExitStack ] = None ,
189
191
errlog : TextIO = sys .stderr ,
190
192
) -> Tuple [List [MCPTool ], AsyncExitStack ]:
0 commit comments