In-memory registry for MCP clients attached to one native agent session.
The native provider owns this struct in its GenServer state. Each MCP server still runs as its own client process, but the registry keeps routing data and cleanup logic in-process so tool calls do not need another coordinator hop.
Summary
Types
Tracked state for one MCP server client.
Stable user-facing MCP server name.
Options forwarded from the native provider to MCP clients.
MCP client registry owned by the native provider.
Provider-facing safe tool name.
Functions
Returns the client pid for a started MCP server.
Starts one MCP server if needed and returns the client pid.
Returns an empty registry.
Removes one server from the registry and returns its removed tool names.
Returns the server name for a monitored client pid.
Starts all enabled MCP servers and returns the registry, tools, and startup failure messages.
Stops all tracked MCP clients.
Types
Tracked state for one MCP server client.
@type server_name() :: String.t()
Stable user-facing MCP server name.
@type start_opt() :: {:transport, module()} | {:transport_opts, keyword()} | {:request_timeout, timeout()} | {:notify_pid, pid()} | {:reserved_tool_names, [tool_name()]} | {:supervisor, GenServer.server() | nil}
Options forwarded from the native provider to MCP clients.
@type t() :: %MingaAgent.MCP.Registry{ clients: %{required(server_name()) => client_entry()} }
MCP client registry owned by the native provider.
@type tool_name() :: String.t()
Provider-facing safe tool name.
Functions
Returns the client pid for a started MCP server.
@spec ensure_server(t(), MingaAgent.MCP.ServerConfig.t(), pid(), [start_opt()]) :: {:ok, t(), pid()} | {:error, String.t()}
Starts one MCP server if needed and returns the client pid.
@spec new() :: t()
Returns an empty registry.
Removes one server from the registry and returns its removed tool names.
Returns the server name for a monitored client pid.
@spec start_all([MingaAgent.MCP.ServerConfig.t()], pid(), [start_opt()]) :: {t(), [ReqLLM.Tool.t()], [String.t()]}
Starts all enabled MCP servers and returns the registry, tools, and startup failure messages.
@spec stop_all(t() | nil) :: :ok
Stops all tracked MCP clients.