Transport-agnostic MCP server.
Receives decoded JSON-RPC messages, dispatches to the Registry for tool/resource
operations, and returns response maps. Transports (stdio, SSE) call
handle_message/2 and write the response back over their I/O channel.
Supported Methods
initialize-- MCP handshake, returns server capabilitiesnotifications/initialized-- client acknowledgement (no reply)ping-- health checktools/list-- list registered toolstools/call-- invoke a toolresources/list-- list registered resourcesresources/read-- read a resourceprompts/list-- list registered promptsprompts/get-- render a prompt with argumentslogging/setLevel-- set server log levelcompletion/complete-- auto-complete tool arguments
Notifications
The server can push notifications to connected transports. Transports
subscribe via subscribe/2 and receive {:mcp_notification, map()} messages.
Summary
Functions
Returns a specification to start this module under a supervisor.
Handle a decoded JSON-RPC message.
Send a notification to all subscribed transports.
Start the server, linked to the calling process.
Subscribe a transport process to server notifications.
Types
@type t() :: %Raxol.MCP.Server{ initialized: boolean(), log_level: :debug | :info | :notice | :warning | :error | :critical | :alert | :emergency, registry: GenServer.server(), resource_subscriptions: %{required(String.t()) => boolean()}, subscribers: [pid()] }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec handle_message(GenServer.server(), map()) :: {:reply, map() | nil}
Handle a decoded JSON-RPC message.
Returns {:reply, response_map} for requests or {:reply, nil} for
notifications (no response needed).
@spec notify(GenServer.server(), String.t(), map()) :: :ok
Send a notification to all subscribed transports.
@spec start_link(keyword()) :: GenServer.on_start()
Start the server, linked to the calling process.
@spec subscribe(GenServer.server(), pid()) :: :ok
Subscribe a transport process to server notifications.
The subscriber receives {:mcp_notification, notification_map} messages.
Automatically unsubscribes when the subscriber process exits.