Skip to main content

Module server

Module server 

Source
Expand description

The MCP server: JSON-RPC 2.0 messages, one per line (Server::handle), the methods initialize, ping, tools/list and tools/call, and the session.

A tool that runs the game is answered by a host of the game’s tools (super::host) that a Launch starts: the game’s tool program, run by cargo (super::child::Cargo), or one in this process (super::host::InProcess). A one-off operation gets a host of its own; the session keeps one from start to stop.

The session’s folder is the client’s first root (roots/list), or the working folder: a relative project is from it. A call whose project is in another cargo workspace than the server’s goes to that workspace’s own server (super::forward), and the tools the server lists follow the session folder’s.

Structs§

Server
The server: where it runs, how it starts hosts, and its session.

Constants§

PROTOCOL_VERSIONS
The MCP protocol versions the server speaks, newest first: it answers with the client’s if it is one of them, else with the first.
ROOTS
The id of the server’s roots/list request.

Traits§

Launch
Starts hosts of a game’s tools.
Link
A host of the game’s tools to send requests to.

Functions§

stale
The limit a host’s answer gets, where no fresh server is started for it, when its engine speaks another contract than version, the server’s (its two contracts and the newer side), and what fixes it: for an older server, a reconnect (in Claude Code: /mcp) starts a fresh one; for a newer one, a reconnect doesn’t, and the project’s own shuyi must be the MCP entry (command mcp install) if the entry runs one installed for every project. A server that forwards first hands the call to a fresh server of its own workspace, and writes the diagnosis alone, beside why that one didn’t start.
tool_result
A tool’s MCP result: the answer as text and as structured content, the picture if there is one, and an error result unless the answer is ok.