Packages

MCP (Model Context Protocol) server and client for Raxol. Provides JSON-RPC 2.0 protocol handling, tool/resource registry, stdio and SSE transports. Auto-derives agent tools from your widget tree.

Current section

Files

Jump to
raxol_mcp lib raxol mcp supervisor.ex
Raw

lib/raxol/mcp/supervisor.ex

defmodule Raxol.MCP.Supervisor do
@moduledoc """
Supervision tree for the MCP subsystem.
Starts the Registry and Server. The stdio transport is NOT started
automatically (it takes over stdin/stdout) -- use `mix mcp.server`
or start it explicitly.
## Children (rest_for_one)
1. `Raxol.MCP.Registry` -- ETS-backed tool/resource store
2. `Raxol.MCP.Server` -- transport-agnostic message router
"""
use Supervisor
@doc "Start the MCP supervisor."
@spec start_link(keyword()) :: Supervisor.on_start()
def start_link(opts \\ []) do
Supervisor.start_link(__MODULE__, opts, name: __MODULE__)
end
@impl true
def init(opts) do
registry_name = Keyword.get(opts, :registry_name, Raxol.MCP.Registry)
server_name = Keyword.get(opts, :server_name, Raxol.MCP.Server)
children = [
{Raxol.MCP.Registry, name: registry_name},
{Raxol.MCP.Server, name: server_name, registry: registry_name}
]
Supervisor.init(children, strategy: :rest_for_one)
end
end