McpService
MCP (Model Context Protocol) client for integrating external tools with LLMs.
- class pipecat.services.mcp_service.MCPClient(server_params, **kwargs)[source]
Bases:
BaseObject
Client for Model Context Protocol (MCP) servers.
Enables integration with MCP servers to provide external tools and resources to LLMs. Supports both stdio and SSE server connections with automatic tool registration and schema conversion.
- Parameters:
server_params (mcp.StdioServerParameters | mcp.client.session_group.SseServerParameters) – Server connection parameters (stdio or SSE).
**kwargs – Additional arguments passed to the parent BaseObject.
- Raises:
TypeError – If server_params is not a supported parameter type.
- async register_tools(llm)[source]
Register all available MCP tools with an LLM service.
Connects to the MCP server, discovers available tools, converts their schemas to Pipecat format, and registers them with the LLM service.
- Parameters:
llm – The Pipecat LLM service to register tools with.
- Returns:
A ToolsSchema containing all successfully registered tools.
- Return type:
ToolsSchema