mcp
The estate's MCP layer over rmcp.
A project depends on this crate and never names rmcp, so the SDK's version,
fork and features are decided in one place, ../Cargo.toml.
Serving a command enum
A project that already takes commands as a serde enum gets an MCP server with no code per command:
/// Commands the daemon takes.
#[derive(Deserialize, JsonSchema)]
#[serde(tag = "type", rename_all = "snake_case")]
enum Command {
/// Focus the column to the left.
FocusLeft,
/// Resize the focused column.
Resize {
/// Width delta in pixels.
delta: i32,
},
}
CommandServer::new(identity, "type", |command: Command| async move {
send_to_daemon(command).await // Result<serde_json::Value, String>
})?
.without(&["subscribe"]) // commands that are not one call, one answer
.serve_stdio()
.await?;
Each variant is a tool named by its tag value. Its doc comment is the description, and its fields, with their doc comments, are the arguments. A variant added to the enum is a tool the next time the server starts.
| File | What it holds |
|---|---|
src/reflect.rs | A tagged enum's JSON Schema read as a list of tools, and a call turned back into a command. No rmcp types. |
src/server.rs | CommandServer: those tools served over stdio. The only file that touches rmcp. |