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 (Streamable HTTP, 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

Types

Link copied to clipboard

Configuration for connecting to an MCP server over the Streamable HTTP transport.

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, baseClient: HttpClient = HttpClient()): SseClientTransport

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

Link copied to clipboard

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

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

Creates a ToolRegistry with tools from an existing MCP client.

Link copied to clipboard
suspend fun McpToolRegistryProvider.fromProcess(process: Process, clientInfo: Implementation = Implementation(DEFAULT_MCP_CLIENT_NAME, DEFAULT_MCP_CLIENT_VERSION), mcpToolParser: McpToolDescriptorParser = DefaultMcpToolDescriptorParser): ToolRegistry

Creates a Mcp ToolRegistry instance from a process using default standard input/output transport.

Link copied to clipboard
suspend fun fromSseUrl(sseUrl: String, clientInfo: Implementation = Implementation(DEFAULT_MCP_CLIENT_NAME, DEFAULT_MCP_CLIENT_VERSION), mcpToolParser: McpToolDescriptorParser = DefaultMcpToolDescriptorParser): ToolRegistry

Creates a ToolRegistry with tools from an MCP server using a server-sent events (SSE) transport.

Link copied to clipboard
suspend fun fromTransport(transport: Transport, serverInfo: McpServerInfo, 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.

Link copied to clipboard

Creates a ToolRegistry from a Streamable HTTP MCP server.