mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-21 23:46:50 +00:00
fix: env parameters exception when configuring SSE or HTTP MCP server (#513)
* fix: _create_streamable_http_session() got an unexpected keyword argument 'env' fix unit error * update md --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -47,17 +47,19 @@ async def load_mcp_tools(
|
||||
args: Optional[List[str]] = None,
|
||||
url: Optional[str] = None,
|
||||
env: Optional[Dict[str, str]] = None,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
timeout_seconds: int = 60, # Longer default timeout for first-time executions
|
||||
) -> List:
|
||||
"""
|
||||
Load tools from an MCP server.
|
||||
|
||||
Args:
|
||||
server_type: The type of MCP server connection (stdio or sse)
|
||||
server_type: The type of MCP server connection (stdio, sse, or streamable_http)
|
||||
command: The command to execute (for stdio type)
|
||||
args: Command arguments (for stdio type)
|
||||
url: The URL of the SSE server (for sse type)
|
||||
env: Environment variables
|
||||
url: The URL of the SSE/HTTP server (for sse/streamable_http type)
|
||||
env: Environment variables (for stdio type)
|
||||
headers: HTTP headers (for sse/streamable_http type)
|
||||
timeout_seconds: Timeout in seconds (default: 60 for first-time executions)
|
||||
|
||||
Returns:
|
||||
@@ -90,7 +92,7 @@ async def load_mcp_tools(
|
||||
)
|
||||
|
||||
return await _get_tools_from_client_session(
|
||||
sse_client(url=url), timeout_seconds
|
||||
sse_client(url=url, headers=headers, timeout=timeout_seconds), timeout_seconds
|
||||
)
|
||||
|
||||
elif server_type == "streamable_http":
|
||||
@@ -100,7 +102,7 @@ async def load_mcp_tools(
|
||||
)
|
||||
|
||||
return await _get_tools_from_client_session(
|
||||
streamablehttp_client(url=url), timeout_seconds
|
||||
streamablehttp_client(url=url, headers=headers, timeout=timeout_seconds), timeout_seconds,
|
||||
)
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user