protomcp

Rust SDK for protomcp -- build MCP servers with tools, resources, and prompts in one file, one command.
Install
Add to your Cargo.toml:
[dependencies]
protomcp = "0.1"
tokio = { version = "1", features = ["full"] }
You also need the pmcp CLI:
brew install msilverblatt/tap/protomcp
Quick Start
use protomcp::{tool, ToolResult, ArgDef};
#[tokio::main]
async fn main() {
tool("add")
.description("Add two numbers")
.arg(ArgDef::int("a"))
.arg(ArgDef::int("b"))
.handler(|_ctx, args| {
let a = args["a"].as_i64().unwrap_or(0);
let b = args["b"].as_i64().unwrap_or(0);
ToolResult::new(format!("{}", a + b))
})
.register();
protomcp::run().await;
}
pmcp dev src/main.rs
Tool Groups
Group related actions under a single tool with per-action schemas:
use protomcp::{tool_group, action, ToolResult, ArgDef};
tool_group("math")
.description("Math operations")
.action(action("add")
.description("Add two numbers")
.arg(ArgDef::int("a"))
.arg(ArgDef::int("b"))
.handler(|_ctx, args| {
let a = args["a"].as_i64().unwrap_or(0);
let b = args["b"].as_i64().unwrap_or(0);
ToolResult::new(format!("{}", a + b))
}))
.action(action("multiply")
.description("Multiply two numbers")
.arg(ArgDef::int("a"))
.arg(ArgDef::int("b"))
.handler(|_ctx, args| {
let a = args["a"].as_i64().unwrap_or(0);
let b = args["b"].as_i64().unwrap_or(0);
ToolResult::new(format!("{}", a * b))
}))
.register();
Documentation
License
MIT