
Clap MCP
by gakonst
Transform any Rust Clap CLI into a Model Context Protocol server using a simple derive macro.
What it does
Clap MCP bridges the gap between Rust command-line applications built with the clap library and the Model Context Protocol. It allows developers to expose their existing CLI subcommands as MCP tools automatically, enabling AI models to execute CLI logic with typed parameters.
Tools
- Automatic Command Mapping: Every subcommand defined in your
clapParser is automatically converted into an MCP tool. - Type Mapping: CLI arguments are mapped to tool parameters with proper type preservation.
- Dual-Mode Execution: The application can run as a traditional CLI or as an MCP server (via stdio or HTTP) based on a flag.
Installation
Add clap-mcp to your Cargo.toml dependencies and derive McpMode on your CLI struct:
[dependencies]
clap-mcp = "0.1"
To run as an MCP server (stdio):
./your-cli --mcp
Supported hosts
- Claude Desktop
Quick install
cargo add clap-mcpInformation
- Pricing
- free
- Published
- 4/26/2026
- stars






