A workspace hypergraph,
for Rust agents.
An MCP server that combines hybrid BM25 + vector search with a HIR-driven workspace hypergraph built on rust-analyzer — exposing 45+ tools for symbol navigation, call-graph traversal, structural audits, and semantic neighborhood queries.
From keyword search to a queryable model of your workspace.
v2 layers a HIR-driven hypergraph on top of hybrid search — so your agent can audit structure, trace call relationships, and detect duplicate logic with the same query plane.
Hybrid search with RRF fusion
BM25 keyword matching fused with vector similarity via reciprocal-rank fusion. Find code by what it does, not just what it's called.
Persisted hypergraph
HIR-driven LMDB snapshot of cross-crate imports, exports, re-exports, call edges, attributes, signatures, statics, and unsafe blocks.
Pluggable embedding models
Local GPU (Qwen3 on Candle/CUDA), local CPU (BGE on ONNX), or API-backed (OpenRouter). New API models added via config — no recompile.
Safety & quality audits
unsafe_audit, mut_static_audit, recursion_check, channel-capacity, fn-body unwrap/panic/lock-across-await detection.
Call graph & structure
who_calls, calls_from, dead-pub detection, name collisions, forbidden cross-crate edges, Robert Martin instability metrics.
Codemap & semantic overlap
build_codemap produces task-conditioned Mermaid subgraphs; semantic_overlaps clusters duplicate logic across the workspace.
45+ MCP tools, grouped into 13 categories.
Plug the server into Claude Code (or any MCP client) and each tool becomes callable from your agent. Full parameter reference in TOOLS.md.
Query
3Symbol analysis
6Index lifecycle
3Hypergraph build
1Imports / exports
4Reverse lookup
3Call graph
5Workspace structure
6Architecture rules
2Signatures & attributes
5Safety & quality audits
5Doc / API audits
4Semantic & codemap
326 ready-made audit recipes.
The skills/ directory composes these tools into self-contained Claude Code skills. Each is a SKILL.md with prerequisites, step-by-step prompts, and hand-offs to related skills. Install once and invoke as /<skill-name>.
unsafe blocks
rmc-mut-static-auditAudit global mutable state
rmc-attribute-auditAudit attributes & doc-comments
rmc-complexityHotspots by blast radius
rmc-test-vs-prodTest vs production split
rmc-call-graphFn-level call graphs
rmc-reexport-chainTrace pub use chains
mkdir -p ~/.claude/skills ln -s "$(pwd)/skills/"rmc-* ~/.claude/skills/ # then in Claude Code: > /rmc-workspace-overview # kick off a tour of a new repo
Pick your quality / speed / privacy tradeoff.
Semantic search and the embedding-backed audits run on a configurable embedding profile. Switch by passing embedding_profile to the search tools; each profile gets its own independent index.
| Profile | Model | Runtime | Dim |
|---|---|---|---|
| local-gpu-small default | Qwen3-Embedding-0.6B | local Candle / CUDA | 1024 |
| local-qwen3-4b | Qwen3-Embedding-4B | local Candle / CUDA | 2560 |
| local-qwen3-8b | Qwen3-Embedding-8B | local Candle / CUDA | 4096 |
| local-cpu-small | BGE-small-en-v1.5 | local ONNX / CPU | 384 |
| openrouter-qwen3-8b | Qwen3-Embedding-8B | OpenRouter API | 4096 |
# add an API model without recompiling [[profile]] name = "openrouter-text-embedding-3-small" model_id = "openai/text-embedding-3-small" dim = 1536 max_len = 8191
# OpenRouter keys come from the env, never config files export OPENROUTER_API_KEY=sk-or-... # local CPU / GPU profiles need no key
Build, wire it in, index.
Three steps to running. The Nix flake is the easiest path — it ships a dev shell with nightly Rust and the full CUDA toolchain.
# clone and build the release binary git clone https://github.com/molaco/rust-code-mcp.git cd rust-code-mcp cargo build --release # or, with the Nix flake (recommended for CUDA) nix develop github:molaco/rust-code-mcp cargo build --release # binary at target/release/rust-code-mcp
{
"mcpServers": {
"rust-code-mcp": {
"command": "/abs/path/to/rust-code-mcp",
"env": {
"RUST_LOG": "info",
"CUDA_HOME": "/usr/local/cuda",
"LD_LIBRARY_PATH": "/usr/local/cuda/lib64"
}
}
}
}
# inside Claude Code: > index_codebase at /abs/path/to/my-rust-project > build_hypergraph # persisted in LMDB, fingerprinted, reused on next call # then call any of 45+ tools — for example: > unsafe_audit # list every unsafe block, with context > dead_pub_report # find dead pub items across crates > crate_dependency_metric # rank by instability / abstractness > rename_symbol "parse_expr" -> "parse_expression" # preview only > build_codemap seeded by "main" # Mermaid + outline subgraph
One workspace, four indexes, one query plane.
A document index, a vector store, a HIR-driven hypergraph, and rust-analyzer's IDE engine — kept in sync by a Merkle-tree watcher.
Indexing throughput, by profile.
Measured on the project's own repository (~2,280 chunks) with an RTX 3090. Embedding is ~95%+ of indexing time; vector search is exact brute-force KNN — fast at workspace scale regardless of dimension.
Standing on good shoulders.
Each piece is the best-in-class option for its job — and stays a thin wrapper over the upstream library.