aarondb/mcp/server

mcp/server — Model Context Protocol entry point

JSON-RPC MCP server: handle_request/2 dispatches tool calls through the gateway (which enforces auth) and the rag semantic-intent layer. start/1 exposes a typed actor for request/response integration.

Types

pub type JsonRpcError {
  JsonRpcError(
    code: Int,
    message: String,
    data: option.Option(json.Json),
  )
}

Constructors

pub type JsonRpcRequest {
  JsonRpcRequest(
    jsonrpc: String,
    id: option.Option(String),
    method: String,
    params: option.Option(dynamic.Dynamic),
  )
}

Constructors

pub type JsonRpcResponse {
  JsonRpcResponse(
    jsonrpc: String,
    id: option.Option(String),
    result: option.Option(json.Json),
    error: option.Option(JsonRpcError),
  )
}

Constructors

pub type ServerMessage {
  Request(JsonRpcRequest, process.Subject(JsonRpcResponse))
  Stop
}

Constructors

Values

pub fn execute_tool(
  db: process.Subject(transactor.Message),
  name: String,
  args: dynamic.Dynamic,
) -> Result(json.Json, String)
pub fn send_response(response: JsonRpcResponse) -> Nil
pub fn start(
  db: process.Subject(transactor.Message),
) -> Result(process.Subject(ServerMessage), actor.StartError)

Start the MCP request actor and return its typed message subject.

Search Document