Expand description
brontes: transform clap CLIs into MCP servers.
brontes walks a clap::Command tree, exposes every reachable command as an
MCP tool, and ships a complete MCP server
runtime over stdio so the resulting agent surface plugs straight into Claude
Desktop, Cursor, and VSCode.
§Two-line quick start
use clap::Command;
#[tokio::main]
async fn main() -> brontes::Result<()> {
let cli = Command::new("my-cli")
.version("0.1.0")
.subcommand(Command::new("greet").about("Say hi"))
.subcommand(brontes::command(None)); // [1] mount
let matches = cli.clone().get_matches();
match matches.subcommand() {
Some(("mcp", sub)) => brontes::handle(sub, &cli, None).await, // [2] dispatch
Some(("greet", _)) => { println!("hi"); Ok(()) }
_ => Ok(()),
}
}For tiny CLIs whose only purpose is the MCP server, collapse the
ceremony into one line with run:
use clap::Command;
#[tokio::main]
async fn main() -> brontes::Result<()> {
brontes::run(Command::new("my-cli").version("0.1.0"), None).await
}§Capabilities
generate_tools— walk aclap::Commandtree into aVec<rmcp::model::Tool>for offline inspection, editor-config generation, or hand-rolled server wiring.command,handle,run— mount themcpsubtree and serve the generated tool list over stdio (mcp start) or streamable HTTP (mcp stream --host <addr> --port <num>).Config— selectors, annotations, per-flag schema overrides, default environment variables, server identity overrides, per-command description mode and full-text override.Selector,Middleware— first-match-wins routing rules and an async middleware boundary for wrapping tool execution.
Bug reports and feature requests: https://github.com/tj-smith47/brontes/issues.
Modules§
- selectors
- Built-in factory functions for
CmdMatcherandFlagMatcher.
Structs§
- Config
- User-facing configuration for the
mcpsubtree. - Middleware
Ctx - Per-call context handed to
Middleware. - Selector
- Filtering rules that decide which commands become MCP tools and which flags those tools expose.
- Tool
Annotations - Annotation hints attached to an MCP tool.
- Tool
Input - Request payload for a tool invocation.
- Tool
Output - Response payload from a tool invocation.
Enums§
- Description
Mode - Which clap field provides the primary text for an MCP tool description.
- Error
- Errors produced by brontes.
- Schema
Type - Coarse JSON Schema type for a clap flag.
Functions§
- command
- Build the
mcpsubcommand subtree, ready to mount on a parent CLI. - generate_
tools - Walk
root, apply safety filters, apply first-match-wins selectors, and produce the MCP tool list ready to register with a server. - handle
- Dispatch an
mcpsubcommand match. - run
- One-call sugar: mount the
mcpsubtree, parseargv, dispatch.
Type Aliases§
- Boxed
Next - One-shot async callable that runs the wrapped exec step.
- CmdMatcher
- Match a command by its space-joined path (e.g.,
"my-cli sub leaf"). - Flag
Matcher - Match a flag by inspecting its
clap::Argdescriptor. - Middleware
- Wrap tool-call execution with custom async logic.
- Middleware
Result - What a middleware (and the underlying exec step) ultimately produces.
- Result
- Result alias for fallible brontes operations.