Production-ready MCP (Model Context Protocol) transport implementation for UTCP.
MCP is a protocol for connecting AI assistants to external data sources and tools. This transport supports JSON-RPC 2.0 communication over HTTP/HTTPS with SSE support.
Summary
Functions
Calls a tool using the MCP transport.
Calls a tool with streaming support using the MCP transport.
Returns a specification to start this module under a supervisor.
Closes the MCP transport.
Deregisters a tool provider from the MCP transport.
Creates a new MCP transport with the given options.
Registers a tool provider with the MCP transport.
Sends a JSON-RPC notification to the MCP server.
Sends a JSON-RPC request to the MCP server.
Starts the MCP transport GenServer.
Returns whether this transport supports streaming.
Returns the transport name.
Functions
@spec call_tool(String.t(), map(), ExUtcp.Types.provider()) :: ExUtcp.Types.call_result()
Calls a tool using the MCP transport.
@spec call_tool_stream(String.t(), map(), ExUtcp.Types.provider()) :: ExUtcp.Types.stream_call_result()
Calls a tool with streaming support using the MCP transport.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec close() :: :ok
Closes the MCP transport.
@spec deregister_tool_provider(ExUtcp.Types.provider()) :: ExUtcp.Types.deregister_result()
Deregisters a tool provider from the MCP transport.
@spec new(keyword()) :: %ExUtcp.Transports.Mcp{ connection_timeout: term(), logger: term(), max_retries: term(), pool_opts: term(), retry_config: term(), retry_delay: term() }
Creates a new MCP transport with the given options.
@spec register_tool_provider(ExUtcp.Types.provider()) :: ExUtcp.Types.register_result()
Registers a tool provider with the MCP transport.
@spec send_notification(String.t(), map(), ExUtcp.Types.mcp_provider()) :: :ok | {:error, String.t()}
Sends a JSON-RPC notification to the MCP server.
@spec send_request(String.t(), map(), ExUtcp.Types.mcp_provider()) :: ExUtcp.Types.call_result()
Sends a JSON-RPC request to the MCP server.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the MCP transport GenServer.
@spec supports_streaming?() :: true
Returns whether this transport supports streaming.
@spec transport_name() :: String.t()
Returns the transport name.