Rust Builder
A specialized Model Context Protocol (MCP) server designed to scaffold, build, and debug new MCP servers in Rust. Features built-in rmcp patterns, tool generation, and autonomous cargo workflows.
Ask AI about Rust Builder
Powered by Claude Β· Grounded in docs
I know everything about Rust Builder. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
π¦ Rust Builder MCP Server
An autonomous Model Context Protocol (MCP) server designed to build, debug, and maintain Rust projects.
This is a Meta-MCP Server: It is specifically architected to help LLMs (like Claude) build other MCP servers. It provides the AI with "eyes" to understand code structure, "hands" to safely edit files, and a "brain" containing verified MCP patterns.
β‘ Key Features
β Offline Intelligence:
- Zero-Latency Search: Built-in vector search for local Rust documentation (
std, etc.) without API calls. - Local Registry: Queries the local
~/.cargocache for crate versions and features.
β Autonomous Development Workflow:
- "Golden Workflow": Enforces a strict Check β Git Save β Edit β Verify loop.
- Cargo Integration: Autonomously runs
check,test,fmt,clippy, andadd(dependencies).
β Advanced Tooling:
- AST Analysis: Parses Rust code to understand huge files (structs/traits) using minimal tokens.
- Surgical Editing: Uses
patch_filelogic to modify code precisely without overwriting whole files. - Meta-Scaffolding: Generates boilerplate for new MCP Tools, Prompts, and Resources automatically.
π οΈ Tool Suite
The server exposes a comprehensive set of tools to the LLM:
| Category | Tool | Description |
|---|---|---|
| π Eyes | search_rust_docs | Search local documentation (TF-IDF). |
analyze_code | Parse file AST to see structs, fields, and signatures. | |
read_file | Read files with line numbers for precise editing. | |
get_project_structure | Visualize the file tree (ignoring target/git). | |
| β Hands | patch_file | Edit code safely (handles whitespace normalization). |
scaffold_new_tool | Create new MCP tool boilerplate & mod.rs entries. | |
add_dependency | Run cargo add with feature selection. | |
| π§ Brain | get_mcp_template | Retrieve verified rmcp code patterns. |
explain_error | Get rustc --explain output for error codes. | |
| π‘οΈ Safety | check_code | Run cargo check --message-format=json. |
run_tests | Run cargo test (with optional filtering). | |
git_operations | Commit, Diff, Status, or Undo changes. |
π Installation
1. Prerequisites
Ensure Rust is installed and the documentation component is available:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup component add rust-docs
2. Build the Server
git clone https://github.com/CeeArEx/mcp-rust-builder.git
cd mcp-rust-builder
cargo build --release
3. Configure Client
For Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"rust-builder": {
"command": "/ABSOLUTE/PATH/TO/mcp-rust-builder/target/release/mcp-rust-builder",
"args": []
}
}
}
For OpenCode / VS Code (Generic):
{
"mcpServers": {
"rust-builder": {
"command": "/ABSOLUTE/PATH/TO/mcp-rust-builder/target/release/mcp-rust-builder",
"transport": "stdio"
}
}
}
π‘ Usage Examples
Scenario 1: Developing a new Tool
User: "Create a new tool called
weather_fetcherthat takes a city name."
Agent Action:
scaffold_new_tool(name="weather_fetcher", ...)-> Creates file & updatesmod.rs.add_dependency(crate="reqwest", ...)-> Adds HTTP client.patch_file(...)-> Implements logic in the new file.check_code()-> Verifies compilation.
Scenario 2: Debugging
User: "Why is my build failing?"
Agent Action:
check_code()-> Returns error JSON (e.g., ErrorE0308).explain_error(code="E0308")-> Reads compiler explanation.read_file(...)-> Reads the specific lines causing the error.patch_file(...)-> Fixes the types.
Scenario 3: Research
User: "How do I use
std::fs::File?"
Agent Action:
search_rust_docs(query="std::fs::File")-> Returns local HTML documentation summary.
π Project Structure
mcp-rust-builder/
βββ src/
β βββ main.rs # Entry point & Tool Router wiring
β βββ tools/
β β βββ mod.rs # Tool registration
β β βββ analyzer.rs # AST Parsing (syn/quote)
β β βββ surgeon.rs # Smart File Patching
β β βββ search_docs.rs # TF-IDF Search Engine
β β βββ scaffolder.rs # Code Generation
β β βββ git.rs # Version Control
β β βββ testing.rs # Test Runner
β β βββ ... (other tools)
β βββ utils/
β βββ paths.rs # System discovery
βββ Cargo.toml
βββ README.md
π§ Troubleshooting
- "Rust docs not installed": Run
rustup component add rust-docs. - "Git remote error": Ensure you have a git repo initialized. The server expects a
.gitfolder in the working directory to perform safety saves. - "Connection Timeout": The initial documentation indexing happens in the background. If the server is slow to start, ensure
search_docs.rsis usingtokio::spawn.
π License
MIT
