Rust framework for building Model Context Protocol servers and clients.
Note
Part of the PulseEngine toolchain. Provides the MCP implementation used across PulseEngine's AI-assisted development infrastructure.
use pulseengine_mcp_macros::{mcp_server, mcp_tools};use schemars::JsonSchema;use serde::{Deserialize,Serialize};#[derive(Debug,Clone,Serialize,Deserialize,JsonSchema)]pubstructGreetParams{pubname:Option<String>,}#[mcp_server(name = "My Server")]#[derive(Default,Clone)]pubstructMyServer;#[mcp_tools]implMyServer{/// Greet someone by namepubasyncfngreet(&self,params:GreetParams) -> anyhow::Result<String>{let name = params.name.unwrap_or_else(|| "World".to_string());Ok(format!("Hello, {name}!"))}}#[tokio::main]asyncfnmain() -> Result<(),Box<dyn std::error::Error>>{MyServer::configure_stdio_logging();MyServer::with_defaults().serve_stdio().await?.run().await}The #[mcp_server] and #[mcp_tools] macros generate the protocol implementation. Tool schemas are derived from your Rust types via JsonSchema.
| Crate | Description |
|---|---|
| mcp-protocol | MCP types, JSON-RPC, schema validation |
| mcp-server | Server infrastructure with McpBackend trait |
| mcp-client | Client for connecting to MCP servers |
| mcp-transport | stdio, HTTP, WebSocket transports |
| mcp-auth | Authentication, API keys, OAuth 2.1 |
| mcp-security | Input validation, rate limiting |
| mcp-logging | Structured logging with credential sanitization |
| mcp-macros | #[mcp_server], #[mcp_tools], #[mcp_resource] |
- hello-world — Minimal server
- hello-world-with-auth — With authentication
- resources-demo — Resource templates with
#[mcp_resource] - ui-enabled-server — MCP Apps extension (SEP-1865)
Implements MCP 2025-11-25: tools, resources, prompts, completions, sampling, roots, logging, progress, cancellation, tasks, and elicitation.
MIT OR Apache-2.0
Part of PulseEngine — a WebAssembly toolchain for safety-critical systems, with formally verified components