Skip to main content

Module server_mcp

Module server_mcp 

Source
Expand description

Model Context Protocol server exposed at the /mcp endpoint.

Exposes the methods of the server’s API as MCP tools, plus a handful of MCP resources (game lists, enum dumps, reference docs) and prompts for common workflows (“open and inspect a pack”, “edit a DB table”, “manage dependencies”, …). All MCP clients share one Session, separate from the ones of the WebSocket clients.

Each tool call sends its method’s request through the session, like a WebSocket client would, and returns the response as structured content, or as a tool error if it failed. Methods that run as jobs return an MCP task to clients supporting tasks. For other clients, they’re waited for a while, and return the state of their job.

The request structs of the methods are the schema of every tool. Their JsonSchema derive is what rmcp ships to clients to advertise tool arguments, so docstrings on individual fields show up directly in MCP tool listings.

Structs§

JobToolResponse
Response of the tools running as jobs: a task, or the state of the job.
McpServer
MCP server running every tool call on the Session shared by all MCP clients.

Constants§

MCP_CACHE_TTL_MS 🔒
How long clients may cache the server’s discovery info, its lists of tools, prompts and resources, and its resources.
MCP_JOB_WAIT 🔒
How long tools that run as jobs wait for them before returning their state.
PARAMS_ERROR_PREFIX 🔒
Start of the text of the tool errors rmcp returns for params it can’t parse.

Functions§

error_result 🔒
Returns an API error as a tool error.
job_status_result 🔒
Returns the state of a job as structured content, or its error as a tool error, like any other tool, if the job failed.
job_task 🔒
Returns the task of a job of a session.
parse_task_id 🔒
Returns the session and job of a task ID, or None if it’s not one.
resource 🔒
Build a Resource with common fields set.
send_request 🔒
Sends a request of the API to a session and waits for its outcome.
start_tool_transaction 🔒
Starts the Sentry transaction of a tool call, following the MCP tracing spec.
task_id 🔒
Returns the ID of the task of a job, unique across MCP sessions so a task of a removed session isn’t mistaken for a job of the new one.
timestamp 🔒
Returns a time as an ISO 8601 timestamp, as tasks need.
unknown_task 🔒
Returns the error of task IDs that aren’t of a job of the MCP session.
wait_reporting_progress 🔒
Waits for a job like JobRegistry::wait, sending the client a progress notification on each change of the job, if it asked for them.