Rust MCP server specialist — builds ultra-fast MCP servers using rmcp SDK, tokio async, serde schemas, and proc macro tool registration. Delegate MCP server implementation tasks.
Ships in frootai-deploy-infra-skills. Installing the plugin adds it to Claude Code.
Rust MCP server specialist using the rmcp SDK with tokio async handlers, proc macro tool registration, serde for automatic schema generation, and ultra-high-performance tool serving.
#[tool] proc macro, McpServer, stdio/SSE transport, async tool handlers#[derive(Serialize, Deserialize, JsonSchema)] — auto-generates JSON Schema from Rust typesCancellationToken| Mistake | Why Wrong | Correct Approach |
|---|---|---|
| Implements JSON-RPC manually | Protocol complexity, missing capabilities | rmcp crate: handles protocol, discovery, transport |
| Uses strings for tool parameters | No schema, no validation | #[derive(Deserialize, JsonSchema)] struct — auto-generates schema |
| Blocking I/O in async handlers | Blocks tokio runtime | tokio::task::spawn_blocking for sync code, async clients for HTTP |
unwrap() in tool handlers | Server panics on bad input | Result<T, ToolError> — return structured error |
use rmcp::{McpServer, tool, ToolResult};
use serde::{Deserialize, Serialize};
use schemars::JsonSchema;
#[derive(Deserialize, JsonSchema)]
struct SearchParams {
/// Natural language search query
query: String,
/// Number of results (1-20)
#[serde(default = "default_top")]
top: u32,
}
fn default_top() -> u32 { 5 }
#[derive(Serialize)]
struct SearchResult {
title: String,
content: String,
source: String,
score: f64,
}
#[tool(name = "search_documents", description = "Search knowledge base")]
async fn search_documents(params: SearchParams) -> ToolResult {
let top = params.top.clamp(1, 20);
let results = search_client.search(¶ms.query, top).await
.map_err(|e| ToolError::new(format!("Search failed: {e}")))?;
let docs: Vec<SearchResult> = results.iter().map(|r| SearchResult {
title: r.title.clone(),
content: r.content.clone(),
source: r.source.clone(),
score: r.score,
}).collect();
ToolResult::text(serde_json::to_string_pretty(&docs)?)
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let server = McpServer::new("fai-search", "1.0.0")
.tool(search_documents)
.build();
server.serve_stdio().await?;
Ok(())
}
# Release build with LTO — smallest, fastest binary
cargo build --release
# Result: ~10MB static binary, no dependencies, instant startup
# Cross-compile for Linux (Docker/AKS)
cross build --release --target x86_64-unknown-linux-musl
[package]
name = "fai-search-mcp"
version = "1.0.0"
edition = "2021"
[dependencies]
rmcp = "0.1"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
schemars = "0.8"
anyhow = "1"
reqwest = { version = "0.12", features = ["json"] }
[profile.release]
lto = true
codegen-units = 1
strip = true
rmcp SDK#[derive(Deserialize, JsonSchema)] structsspawn_blocking or async clientsunwrap() in handlers: Panics → Result<T, ToolError>| Scenario | Use This Agent | Don't Use |
|---|---|---|
| Rust MCP server | ✅ | |
| Ultra-high-performance tools | ✅ | |
| General Rust application | ❌ Use fai-rust-expert | |
| TypeScript MCP server | ❌ Use fai-typescript-mcp-expert |
| Play | How This Agent Helps |
|---|---|
| 29 — MCP Server | Fastest MCP: ~10MB binary, sub-ms startup |
What the agent file sets; muted values are Claude Code's defaults
7-day visitors to each agent page
@agent-frootai-deploy-infra-skills:FAI Rust MCP Expertfrom frootai-deploy-infra-skills
npx claudepluginhub frootai/frootai --plugin frootai-deploy-infra-skills327 agents in this plugin
AGENTSAGENTS.md — FrootAI Standalone Agents (Auto-Generated Catalog)> **GENERATED FILE — DO NOT EDIT BY HAND.** Re-run `node scripts/generate-agents-md.js` to refresh.FAI A2A ExpertAgent-to-Agent (A2A) protocol specialist — Google's agent interop standard, AgentCard discovery, task lifecycle, streaming artifacts, push notifications, and multi-agent communication patterns.FAI Accessibility ExpertAccessibility specialist — WCAG 2.2 AA/AAA compliance, ARIA 1.2 patterns, screen reader optimization, keyboard navigation, focus management, and inclusive design for AI chatbots and dashboards.Other plugins' agents for the same job