rustcrates.git / mcp / src / lib.rs
lib.rsannotatedlib.rssource19 lines · 817 B · raw

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 (~/rustcrates/Cargo.toml).

[CommandServer] is the first shared piece: it serves a project's existing command enum as MCP tools by reflection. Derive [schemars::JsonSchema] on a serde enum tagged by a field, hand over one function that runs a command, and every variant is a tool: its doc comment is the description and its fields are the arguments. A variant added to the enum is a tool with no MCP code written for it.

14mod reflect;
15mod server;
17pub use reflect::{CommandTool, ReflectError, command_from_call, command_tools};
18pub use schemars;
19pub use server::{CommandServer, ServeError, ServerIdentity};