High-quality Rust SDK for Model Context Protocol (MCP) with full TypeScript SDK compatibility
io.github.paiml/pmcp — Model Context Protocol (MCP) Rust SDK
io.github.paiml/pmcp provides a high-quality Rust SDK for Model Context Protocol (MCP). It is described as having full TypeScript SDK compatibility. Repository metadata lists topics including mcp, rust, and sdk, and the name io.github.paiml/pmcp. The provided README excerpt presents the project as “PMCP - Pragmatic Model Context Protocol” and includes quality/CI badges.
🛠️ Key Features
Rust SDK for MCP
Full TypeScript SDK compatibility
Quality gate badges (from the README excerpt)
🚀 Use Cases
Build MCP integrations using Rust
Reuse or mirror a TypeScript SDK interface in Rust
⚡ Developer Benefits
Compatibility with TypeScript SDK
MCP-focused SDK with project-scoped topics (e.g., mcp, sdk)
⚠️ Limitations
Tool count and detailed functionality are not included in the provided data (only a partial README excerpt).
Production-grade Rust implementation of the Model Context Protocol (MCP) - 16x faster than TypeScript, built with Toyota Way quality principles
Overview
PMCP is a complete MCP ecosystem for Rust, providing everything you need to build, test, and deploy production-grade MCP servers — in Rust, or from configuration alone:
🧩 Config-Driven Servers - Build SQL & OpenAPI/HTTP MCP servers from a config.toml, or serve a governed Excel workbook from a compiled bundle — all no Rust required (pmcp-server-toolkit, pmcp-sql-server, pmcp-openapi-server, pmcp-workbook-server)
🤝 Agents & Teams - Build deploy-anywhere agents and small teams: the agent loop (pmcp-agent), four reference team servers (pmcp-team-servers), and a portable AI-Package format (pmcp-package) — driven from the cargo pmcp agent/team/package verbs
🦀 pmcp SDK - High-performance Rust crate with full MCP protocol support
⚡ cargo-pmcp - CLI toolkit for scaffolding, testing, and development
📚 pmcp-book - Comprehensive reference guide with 27 chapters
🎓 pmcp-course - Hands-on course with quizzes and exercises
🤖 AI Agents - Kiro and Claude Code configurations for AI-assisted development
Why PMCP?
Performance: 16x faster than TypeScript SDK, 50x lower memory
Safety: Rust's type system + zero unwrap() in production code
Quality: Toyota Way principles - zero technical debt tolerance
Complete: SDK, tooling, documentation, and AI assistance in one ecosystem
Quick Start
Choose your path based on experience and preference:
New in v2.9 — this removes the biggest blocker to putting organizational data behind MCP: you no longer need a Rust programmer. Describe a production MCP server over a SQL database or any OpenAPI / HTTP backend in a config.toml — declare the backend, a handful of curated tools, and a Code Mode policy — and a prebuilt binary serves it. No Rust, no recompiling. Curated tools cover the common ~20%; Code Mode handles the long-tail ~80% by generating queries against your schema/spec under a static, default-deny policy. A business analyst curates the API slice in config; the toolkit does the rest.
SQL — SQLite / Postgres / MySQL / Athena (runnable from a checkout of this repo):
bash
cargo install pmcp-sql-server
# Seed a tiny demo DB, then serve it from config alone — two curated tools# (list_books, books_by_author) + Code Mode for the long tail.
sqlite3 /tmp/pmcp-sqlite-explorer.db < crates/pmcp-sql-server/examples/sqlite-explorer.sql
pmcp-sql-server \
--config crates/pmcp-sql-server/examples/sqlite-explorer.toml \
--schema crates/pmcp-sql-server/examples/sqlite-explorer.sql
OpenAPI / HTTP — any REST backend, with six outgoing-auth models including OAuth passthrough (the server holds no standing credential and forwards the caller's own token, so it can only act as the signed-in user):
bash
cargo install pmcp-openapi-server
# Curated configs ship with the crate — e.g. a London Tube (api_key) showcase and# a Microsoft-Graph / Excel "Contoso" (oauth_passthrough) example. These talk to a# live backend, so supply any required credential per the example's comments.## `base_url` is a SLOT, not a baked literal, so the endpoint comes from the# environment too — the same package moves between environments unchanged.
TFL_BASE_URL=https://api.tfl.gov.uk TFL_APP_KEY=<your-key> \
pmcp-openapi-server --config crates/pmcp-openapi-server/examples/london-tube.toml
Excel workbook — a governed spreadsheet, served as one MCP tool per output table (no config.toml, no schema; the single input is a compiled bundle@version directory). Author inputs and outputs as named Excel Tables and each output table becomes its own well-named, well-typed MCP tool with a DAG-derived input schema:
bash
cargo install pmcp-workbook-server
# Preview the exact tool surface an AI will see — BEFORE you compile or deploy:
cargo pmcp workbook explain pricing.xlsx # e.g. calculate_tax, estimate_refund# Compile a governed workbook to a deterministic bundle (ingest → lint → compile →# reconcile → fail-closed gate → write), then serve one calculation tool per output# table — plus explain / get_manifest / diff_version / render_workbook — from the bundle alone.
cargo pmcp workbook compile pricing.xlsx --workflow quote --approver alice
pmcp-workbook-server --bundle-dir bundles/quote@1.0.0
Want to extend and deploy it?cargo pmcp new my-server --kind sql-server (or --kind openapi-server / --kind workbook-server) scaffolds the same config-driven server as a small crate, ready for cargo pmcp deploy to AWS Lambda / Google Cloud Run / Cloudflare / pmcp.run.
# Install the mcp-developer subagent (user-level - works across all projects)
curl -fsSL https://raw.githubusercontent.com/paiml/rust-mcp-sdk/main/ai-agents/claude-code/mcp-developer.md \
-o ~/.claude/agents/mcp-developer.md
# Restart Claude Code
Build your server:
code
You: "Create a weather forecast MCP server with tools for getting current conditions and 5-day forecasts"
Claude Code: [Invokes mcp-developer subagent]
I'll create a production-ready weather MCP server using cargo-pmcp.
$ cargo pmcp new weather-mcp-workspace
$ cd weather-mcp-workspace
$ cargo pmcp add server weather --template minimal
[Implements type-safe tools with validation]
[Adds comprehensive tests and observability]
[Validates quality gates]
✅ Production-ready server complete with 85% test coverage!
What you get: Production-ready code following Toyota Way principles, with comprehensive tests, structured logging, metrics collection, and zero clippy warnings.
# Create workspace
cargo pmcp new my-mcp-workspace
cd my-mcp-workspace
# Add a server using a template
cargo pmcp add server myserver --template minimal
# Start development server with hot-reload
cargo pmcp dev --server myserver
# Generate and run tests
cargo pmcp test --server myserver --generate-scenarios
cargo pmcp test --server myserver
# Build for production
cargo build --release
Available templates (cargo pmcp add server <name> --template <t>):
Workflows: Multi-step orchestration with array indexing support
MCP Apps: Rich HTML UI widgets with live preview and browser DevTools
MCP Tasks: Shared client/server state with task lifecycle management — see the Task-Augmented Tool Results (SEP-1686) chapter for returning a CallToolResult that points at a related task
Agent Skills (SEP-2640): Register an Agent Skill in ~5 lines and serve it on BOTH a SEP-2640 skill surface AND a parallel MCP prompt fallback — byte-equal by construction (skills feature, opt-in)
Tower Middleware: DNS rebinding protection, CORS, security headers
Typed Client Helpers: call_tool_typed, get_prompt_typed, and auto-paginating list_all_* with bounded safety cap
Performance: 16x faster than TypeScript, SIMD-accelerated parsing
Quality: Zero unwrap(), comprehensive error handling
Full-lifecycle development toolkit — from scaffolding to production deployment.
bash
cargo install cargo-pmcp
bash
cargo pmcp new my-workspace # Scaffold a new workspace
cargo pmcp add server my-server # Add a server with best-practice template
cargo pmcp dev --server my-server # Dev server with hot-reload
cargo pmcp test --server my-server # Auto-generated scenario tests
cargo pmcp loadtest run # Load test with latency percentiles
cargo pmcp pentest run # Security audit (32 checks, SARIF output)
cargo pmcp preview --open # Browser-based widget preview
cargo pmcp workbook explain wb.xlsx # Preview an Excel workbook's MCP tool surface
cargo pmcp deploy --target aws-lambda # Deploy to AWS Lambda, GCR, or Cloudflare
cargo pmcp deploy logs --tail# Stream production logs
Covers the full development lifecycle: scaffolding, dev mode, testing, load testing, security pentesting, MCP Apps preview, schema management, multi-target deployment, secrets, and OAuth setup.
Build production MCP servers over SQL and HTTP backends from a config.toml alone — the toolkit synthesizes curated tools + a Code Mode long tail, so exposing organizational data over MCP no longer needs a Rust programmer.
The backend-agnostic library: config types, the [[tools]] synthesizer, Code Mode wiring, and the connector/auth seams that the binaries below build on.
Shape-A binary serving a governed Excel workbook as one named MCP tool per output table (e.g. calculate_tax, estimate_refund) plus infrastructure tools (explain / get_manifest / diff_version / render_workbook) from a compiled bundle@version directory alone — no config.toml, no schema. The Excel reader and JS code-mode are compile-time only and absent from the served binary (purity gate).
These binaries have cargo pmcp new --kind {sql-server,openapi-server,workbook-server} scaffold siblings that generate the same config-driven server as a small, deployable crate. See Path 1 above and the Config-Driven SQL Servers / OpenAPI / Config-Driven Workbook Servers chapters in the pmcp-book.
📚 pmcp-book (Reference Guide)
27-chapter comprehensive reference guide to building MCP servers with pmcp.
Build rich HTML UI widgets served from MCP servers — works with ChatGPT, Claude, and other MCP clients.
What it does:
Preview: Live widget preview with dual proxy/WASM bridge modes
Author: File-based widgets in widgets/ directory with hot-reload
Scaffold: cargo pmcp app new generates a complete MCP Apps project
Publish: ChatGPT-compatible manifest and standalone demo landing pages
Test: 20 E2E browser tests via chromiumoxide CDP
Quick start:
bash
# Scaffold a new MCP Apps project
cargo pmcp app new my-widget-app
cd my-widget-app
# Run the server
cargo run
# Preview in browser (separate terminal)
cargo pmcp preview --url http://localhost:3000 --open
# Generate deployment artifacts
cargo pmcp app build --url https://my-server.example.com
Examples:
Chess App — Interactive chess board with move validation
Everything so far builds MCP servers — things that wait to be called. An agent is
the other side: it owns a decision loop, so it is an MCP client. PMCP ships that loop
as a crate and scaffolds it from the CLI, so you can watch an agent make decisions
before writing any Rust.
bash
# Scaffold a runnable agent package (AgentPackage manifest + crate)
cargo pmcp agent new research-agent
cd research-agent
# Run the loop offline first — no network, no API key
cargo pmcp agent dev --source fixed
# Then against a local model (defaults to Ollama at http://localhost:11434/v1)
cargo pmcp agent dev --source openai-compat --model llama3.2
# Run a two-member reference team in one process
cargo pmcp team dev
The agent's identity — instructions, model slot, token and iteration limits — lives in
an agent.package.json manifest, not in code, so the same package moves from your
laptop to a deployment unedited. Only --source changes when you swap where completions
come from; the loop does not.
The crates behind it:
🤖 pmcp-agent - The AgentEngine loop over three seams (completion source, tool invoker, store), plus AgentServer for exposing an agent as an MCP tool that is sampled by its caller
👥 pmcp-team-servers - Four reference team servers and the in-process composition runtime cargo pmcp team dev drives
📦 pmcp-package - The portable AI-Package format (AgentPackage, TeamPackage) that makes an agent a description rather than a binary
bash
# One AgentEngine, run twice: standalone, then hosted-sampled — no network, no key
cargo run -p pmcp-agent --example s50_standalone_vs_sampled
PMCP speaks two MCP protocol eras out of one binary: v1 (2025-11-25) and v2
(2026-07-28). The era is negotiated per request, not per process — the same server answers a
v1 client with sessions and a v2 client without them, concurrently, on the same port. You do not
run two fleets, and you do not choose an era at build time.
Throughout this project an era is written v1/v2 with its date string, while the crate is always
written with its name attached — "pmcp 2.18". A bare version number never means a protocol era.
Opting in, by role:
Servers — one explicit call, ServerBuilder::with_supported_protocol_versions(...), listing your v1 version alongsidePROTOCOL_VERSION_2026_07_28. The default accept-list is v1-only by design, so upgrading the crate alone leaves a server answering v1 only. See examples/s47_v2_stateless_mrtr.rs.
Clients — one explicit call, ClientBuilder::with_protocol_version(...). Without it a client stays on v1, exactly as before.
Agents — already done for you. pmcp-agent's invoker prefers v2 and falls back to v1, so an agent scaffolded with cargo pmcp agent new speaks v2 wherever the server supports it.
There is also a server-side lever in the opposite direction — opting out of v1:
--no-default-features on its own proves nothing (it also strips the HTTP transport, so v1 would
appear severed only because nothing was compiled). full-v2 is the positive feature list: exactly
what full carries, minus v1-compat.
Published 2026-08-16. The in-flight line is pmcp 2.19.0, still unreleased — its entry at the
top of the changelog is the authoritative list of what is landing next.
Two protocol eras, one binary: pmcp serves both MCP 2025-11-25 (v1) and 2026-07-28 (v2), negotiated per request — see Protocol Versions above
Credential storage (2.18.0): one machine, one credential store — pmcp::shared::credential_store addressed by (issuer, account, server), with an on-disk FileCredentialStore that cargo pmcp auth writes through
Agents & Teams: the pmcp-agent loop, four reference team servers, and the portable AI-Package format — see Agents & Teams above
MCP Apps: Rich interactive HTML UI widgets served from MCP servers — works with ChatGPT, Claude Desktop, and other MCP clients. Live preview with browser-style DevTools (resizable panel, network/events/protocol/bridge tabs)
MCP Tasks: Shared client/server task lifecycle with pluggable stores (in-memory and DynamoDB) and task variables — the v2 shape is an extension and is still provisional
Conformance Test Suite: 19-scenario conformance engine across 5 domains with cargo pmcp test conformance and mcp-tester conformance CLI integration
Tower Middleware: DNS rebinding protection, CORS with origin-locked headers, configurable security headers — production-ready HTTP stack
PMCP Server: MCP server exposing SDK developer tools (test, scaffold, schema export) via Streamable HTTP, deployed on AWS Lambda
Uniform Constructor DX: Default impls, builders, and constructors for all protocol types — dramatically improved ergonomics
85 examples in examples/: runnable coverage of the SDK surface (119 example targets across the whole workspace)
The SDK ships 85 runnable examples in examples/ — 119 example targets across the
whole workspace — covering the full SDK surface:
bash
# Basic examples
cargo run --example c01_client_initialize # Client setup
cargo run --example s01_basic_server # Basic server
cargo run --example c02_client_tools # Tool usage# Type-safe tools (v1.6.0+)
cargo run --example s16_typed_tools --features schema-generation
cargo run --example s17_advanced_typed_tools --features schema-generation
# Advanced features
cargo run --example s28_authentication # OAuth/Bearer
cargo run --example t01_websocket_transport # WebSocket
cargo run --example m01_basic_middleware # Middleware chain# Agent Skills (SEP-2640) — dual-surface skill + prompt
cargo run --example s44_server_skills --features skills,full
cargo run --example c10_client_skills --features skills,full
# Agents & Teams — an agent loop, and four reference servers cooperating
cargo run --example s49_sampling_host
cargo run -p pmcp-agent --example s50_standalone_vs_sampled
cargo run -p pmcp-team-servers --example doc_review_team --features runtime
# MCP 2026-07-28 (v2) — start the SERVER first, in its own terminal; each client# takes the server address as its argument and defaults to where the server binds
cargo run --example s47_v2_stateless_mrtr --features full # serves on 127.0.0.1:8147
cargo run --example s48_v2_mrtr_client --features full # then, in another terminal
cargo run --example s53_v2_agent_client --features full # the pmcp-agent connector, v2 with v1 fallback# MCP 2026-07-28 (v2) Tasks — same rule: server first, then the agent
cargo run --example s50_v2_tasks_server --features full # serves on 127.0.0.1:8150
cargo run --example s51_v2_tasks_agent --features full
# Testing (mcp-tester is a standalone Cargo project in examples/26-server-tester)
cargo install mcp-tester && mcp-tester test http://localhost:8080
# AI-assisted development# See ai-agents/README.md for Kiro and Claude Code setup