Skip to main content

Module mcp

Module mcp 

Source
Expand description

The MCP server at {base}/mcp: Streamable HTTP without sessions or a stream, JSON-RPC in and JSON out. Every tool is a read of the HTTP API, made with the caller’s own credentials, so the MCP server can see exactly what the token can and nothing more.

Structs§

McpError
A JSON-RPC error: code is the error’s own JSON-RPC code (-32602 for an unknown tool), answered with its message as it is; None is an error thrown along the way (an API read that failed, a body of null), which the MCP server answers as -32603 “Internal error” and the assistant hands the model as its message.
Tool
One tool.
ToolRequest
The API path and query a tool reads.

Constants§

INSTRUCTIONS
What the MCP server tells a client about Runlight, and the assistant’s system prompt starts with.
MAX_BATCH
The most messages one batch may hold.
PROTOCOL_VERSIONS
Newest first; a client asking for one we do not know is answered with the newest.

Statics§

TOOLS
The tools, in the order tools/list gives them.

Traits§

ApiRead
Reads one API path with the caller’s credentials: the path (such as /api/stats) and the query’s name and value pairs, in order.

Functions§

call_tool
Runs one tool by name, as the MCP server does; the dashboard’s assistant calls it too. params holds name and arguments. An unknown tool is an error with code -32602; an API read that fails is an error without one.
mcp_response
Answers one POST to the MCP endpoint, already authorised.