McpToolRegistryProvider

A provider for creating tool registries that connect to Model Context Protocol (MCP) servers.

This class facilitates the integration of MCP tools into the agent framework by:

  1. Connecting to MCP servers through various transport mechanisms (stdio, SSE)

  2. Retrieving available tools from the MCP server

  3. Transforming MCP tools into the agent framework's Tool interface

  4. Registering the transformed tools in a ToolRegistry

Properties

Link copied to clipboard

Default name for the MCP client when connecting to an MCP server.

Link copied to clipboard

Default version for the MCP client when connecting to an MCP server.

Functions

Link copied to clipboard
fun defaultSseTransport(url: String): SseClientTransport

Creates a default server-sent events (SSE) transport from a provided URL.

Link copied to clipboard
fun defaultStdioTransport(process: Process): StdioClientTransport

Creates a default standard input/output transport for a provided process.

Link copied to clipboard
suspend fun fromClient(mcpClient: Client, mcpToolParser: McpToolDescriptorParser = DefaultMcpToolDescriptorParser): ToolRegistry

Creates a ToolRegistry with tools from an existing MCP client.

Link copied to clipboard
suspend fun fromTransport(transport: Transport, mcpToolParser: McpToolDescriptorParser = DefaultMcpToolDescriptorParser, name: String = DEFAULT_MCP_CLIENT_NAME, version: String = DEFAULT_MCP_CLIENT_VERSION): ToolRegistry

Creates a ToolRegistry with tools from an MCP server using provided transport for communication.