rustapi-mcp
Native Model Context Protocol (MCP) integration for RustAPI.
This crate allows you to expose your existing RustAPI routes as discoverable tools for LLMs and AI agents (Claude, Cursor, custom agents, etc.) with full respect for your middleware, validation, auth, and observability layers.
Status
Core implementation complete (discovery, tools/list, real tools/call via proxy into normal RustAPI pipeline, HTTP JSON-RPC transport, concurrent runner with run_rustapi_and_mcp).
See the Native MCP Orchestration Plan for the original milestone breakdown. Polish items (docs, snapshots, tests, auth) remain before full release.
Goals (v1)
- Opt-in via
protocol-mcpfeature - Automatic tool discovery from your route metadata + OpenAPI schemas
- Tool invocations execute through the normal RustAPI request pipeline (no bypass)
- Support for the recommended HTTP + SSE transport (stdio later)
- Strong security defaults (explicit exposure control, never auto-expose everything)
Usage (planned shape)
use *;
use ;
async
async
Feature Flag
In rustapi-rs:
[]
= { = "...", = ["protocol-mcp"] }
Or with the meta feature:
= { = "...", = ["protocol-all"] }
Design Principles
- Follows the same facade contract as the rest of RustAPI.
- New internal crate (
rustapi-mcp) behind theprotocol-mcpfeature. - Tool calls must go through existing
Router, layers, interceptors, extractors, and validation. - Explicit exposure model by default (no accidental leakage of internal routes).
Related
- Main roadmap: see top-level
README.md - Detailed plan:
memories/native_mcp_orchestration_plan.md - Master task list:
memories/TASKLIST.md
License
MIT OR Apache-2.0 (same as the rest of the workspace)