fix: replace Tuple type with TypeAlias for server params in MCP client
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
"""MCP (Model Context Protocol) client for integrating external tools with LLMs."""
|
"""MCP (Model Context Protocol) client for integrating external tools with LLMs."""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from typing import Any, Dict, List, Tuple
|
from typing import Any, Dict, List, TypeAlias
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@ except ModuleNotFoundError as e:
|
|||||||
logger.error("In order to use an MCP client, you need to `pip install pipecat-ai[mcp]`.")
|
logger.error("In order to use an MCP client, you need to `pip install pipecat-ai[mcp]`.")
|
||||||
raise Exception(f"Missing module: {e}")
|
raise Exception(f"Missing module: {e}")
|
||||||
|
|
||||||
|
ServerParameters: TypeAlias = StdioServerParameters | SseServerParameters | StreamableHttpParameters
|
||||||
|
|
||||||
class MCPClient(BaseObject):
|
class MCPClient(BaseObject):
|
||||||
"""Client for Model Context Protocol (MCP) servers.
|
"""Client for Model Context Protocol (MCP) servers.
|
||||||
@@ -42,7 +43,7 @@ class MCPClient(BaseObject):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
server_params: Tuple[StdioServerParameters, SseServerParameters, StreamableHttpParameters],
|
server_params: ServerParameters,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Initialize the MCP client with server parameters.
|
"""Initialize the MCP client with server parameters.
|
||||||
|
|||||||
Reference in New Issue
Block a user