trusty-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
tRUSTy-code 1.0
A Rust-only, non-LLM neural co-pilot (~751K params) and pure-Rust MCP server (trusty-mcp) that cuts LLM token usage (57%–92%) while helping coding agents produce more accurate, idiomatic, borrow-safe Rust code.
tRUSTy-code 1.0 does not generate English prose or chat on its own. Instead, it turns Rust source code into typed AST + Control-Flow + Data-Flow + Borrow graphs and runs two from-scratch Relational Graph Convolutional Networks (R-GCNs) inside a single native Rust binary with zero Python runtime dependency:
TrustyCodeEncoder(653,377params) — Trained with InfoNCE contrastive learning on 6,000 real functions across 413crates.iocrates to map Rust code graphs and developer queries into a shared 128-d embedding space.TrustyBorrowAndBugGNN(97,866params) — Trained onrustc-verified code mutations to rank borrow/type error repair strategies (97.2%Top-1 /99.7%Top-3) and flag silent panic/allocation/unsaferisks (98.3%Top-1) in1–25 ms.
PyTorch ↔ pure-Rust inference parity is verified across golden test vectors at max_abs_diff = 2.38e-6 (< 1e-4).
How It Works (Plain English)
Normal coding agents read entire .rs files from top to bottom (15k–50k+ tokens per query) and paste hundreds of lines of raw cargo check stderr back into the cloud prompt on every error loop.
tRUSTy-code 1.0 sits locally between your Rust repository and any MCP-capable LLM (Antigravity IDE, Google Antigravity SDK, Claude Code, or local Ollama/Qwen):
rust_repo_outline: Strips function bodies and returns a compact API skeleton (structs, enums, traits,implheaders, signatures, line ranges) in ~5–10% of the tokens.rust_neural_search: Scores function graphs usingTrustyCodeEncoder+ structural lexical fusion and returns top-k25-line slices with exactfile:start..endspans.rust_symbol_slice: Extracts one target function/type plus itsimplblocks and 1-hop local type definitions without dumping whole files.rust_check_compact: Runscargo check --message-format=json, deduplicates cascading errors, runsTrustyBorrowAndBugGNNto rank the top-3 fix strategies, and probes micro-patches viarustc.rust_safety_audit: RunsTrustyBorrowAndBugGNN+ deterministicsynrules to catch.unwrap()panic risks,&Vec<T>/.clone()smells, and undocumentedunsafeblocks thatcargo checkpasses silently.
Related MCP server: codememory
Creating New Code: Why LLM + tRUSTy-code Produces More Accurate Rust for Fewer Tokens
While a 751K-parameter graph model cannot invent whole applications by itself, pairing an LLM (Claude, Gemini, or local Qwen) with tRUSTy-code as a co-pilot directly improves generated Rust quality while slashing token spend at every stage of writing code:
Before Writing — Zero-Hallucination API Wiring (
~90%fewer input tokens):
Instead of guessing crate fields/lifetimes or reading50k–100ktokens of raw files, the LLM callsrust_repo_outlineandrust_symbol_sliceto see exact structs, traits, and lifetimes (Hook<'a>,Result<Value, Fail>,&[Finding]) in a tiny focused window—raising first-try compile accuracy.During Writing — Shorter Borrow-Checker Fix Loops (
~65%–80%fewer retry tokens):
When newly generated Rust hitsE0382,E0502,E0596, orE0277,rust_check_compactsuppresses cascading domino errors and feeds the LLM compact ranked repair hints ([rustc-verified]when micro-probed), turning 3–4 noisy compiler round-trips into 1.After Writing — Stopping "Lazy LLM Hacks" (
cargo checkpasses, production panics):
LLMs frequently insert.unwrap(),&Vec<String>, or.clone()inside loops just to satisfy the borrow checker. Runningrust_safety_audit(~1–25 ms) right after generation catches silent panic andunsafeUB bugs before the task finishes.
Honest Boundaries (When Not to Use tRUSTy-code)
Real-life testing across 100k+ LOC unseen crates (clap_builder, hyper, serde_json, rayon, indexmap) and a 7,578-LOC production Rust security workspace surfaced clear boundaries:
Greenfield single-file scripts (
<100LOC): Fixed MCP tool-schema overhead (~450tokens) costs more than reading a 30–60 line.rsfile directly; use onlyrust_check_compact/rust_safety_auditafter writing.Verbatim log/string-literal search & unexpanded
macro_rules!: Plaingrep/rgwins here becauseTrustyCodeEncoderhashes AST nodes and identifiers rather than raw string literals or unexpanded macro bodies.v1.0
#[test]ranking noise:trusty-mcpcurrently indexes#[test]functions alongside production code, which can crowd out production functions in test-heavy crates and inflatePanicUnwrapRiskcounts (67/78flags in our real-world audit were inside#[test]functions). Filtering#[test]by default is the top v1.1 priority.
Benchmarks & Real-World Validation

1. From-Scratch ML Evaluation (Zero Crate Overlap Across Train/Val/Test)
Trained on 413 cached crates (encoder: 4,200 / 900 / 900; repair: 1,680 / 360 / 360; 0 shared crates across splits):
Model | Task | Metric (Held-Out Test Set, 95% Bootstrap CI) | vs Best Baseline |
| Semantic Code Retrieval ( | Hybrid MRR | TF-IDF |
| Borrow/Type Fix Strategy ( | Macro-F1 | LogReg |
| Safety & Idiom Risk ( | Macro-F1 | LogReg |

2. Token Reduction & Real-Life Engineering Results
Benchmark Suite | Scope | Baseline |
| Result |
12-Task MCP Payload ( | 4 Rust categories ( |
|
| 92.55% saved ( |
Google Antigravity SDK ( | 4 live |
|
| 57.38% total saved ( |
Broken 5-File App ( | 5 compile errors + 3 silent UB/panic/clone bugs |
|
| 65.07% saved + caught hidden UB |
Live Blind A/B AI Subagent Trial | 3 real tasks ( |
|
| -41.7% tool calls, -23.0% tool tok |
Real Repo Audit ( | Workspace check + outline + safety audit + neural search |
|
| ~91.5% fewer tokens, |
20-Query Unseen Discovery ( | 5 unseen 100k-LOC crates, zero file hints |
|
| Exposed v1.0 |

Quick Start
1. Build the Pure-Rust MCP Binary
cd mcp-server
cargo build --release
cd ..Verify PyTorch ↔ Rust neural parity (max_abs_diff < 1e-4):
./mcp-server/target/release/trusty-mcp verify-parity ./models/golden_parity.json --models-dir ./models2. Connect to Claude Code or Antigravity
Claude Code:
.mcp.jsonin this repo registerstrusty_codeautomatically, or register globally:claude mcp add trusty_code -- "$(pwd)/mcp-server/target/release/trusty-mcp" serve --models-dir "$(pwd)/models"Antigravity IDE: Open this repo as your workspace (uses
.agents/skills/trusty-code/SKILL.mdandAGENTS.md) or addtrusty_codeto~/.gemini/config/mcp_config.json.Google Antigravity SDK (
google-antigravity): Seesdk_agent/trusty_agent.py:from sdk_agent.trusty_agent import build_trusty_agent agent = build_trusty_agent(backend="hosted") # or "local_openai" / "litert"
3. Run Directly in Terminal
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"rust_safety_audit","arguments":{"path":"./benchmarks/fixtures/real_task_hub/src"}}}' \
| ./mcp-server/target/release/trusty-mcp serve --models-dir ./models4. Reproduce Benchmarks or Re-Train From Scratch
python3.11 -m venv .venv
./.venv/bin/pip install -r requirements.txt
# Run both benchmark suites
./.venv/bin/python benchmarks/run_benchmarks.py
./.venv/bin/python benchmarks/real_life_benchmark.py
# Optional: re-extract cached crates.io corpus & retrain PyTorch R-GCNs
cargo run --release --manifest-path extractor/Cargo.toml
./.venv/bin/python -m ml.train_encoder
./.venv/bin/python -m ml.train_repair
./.venv/bin/python -m ml.export_and_plotRepository Layout
extractor/— Rust crate extracting AST/CFG/Data-Flow/Borrow graphs +rustc-labeled mutations.ml/— Pure-PyTorch R-GCN training, bootstrap CIs, parity export, and plots (results/ml/).models/— Pretrained pure-JSON weights (encoder_weights.json,repair_gnn_weights.json,golden_parity.json).mcp-server/— Pure-Rust neural inference & MCP stdio server (trusty-mcp).sdk_agent/— Google Antigravity SDK integration + local OpenAI-compatible eval server.benchmarks/— 12-tasktiktoken/SDK suite (run_benchmarks.py) + 4-suite real-life benchmark (real_life_benchmark.py).
License
Licensed under the Apache License, Version 2.0. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Multiple MCP tools, persistent graph memory, token-saving data pointers, and more.
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Cuts coding agent token burn up to 72% continuously via contradiction-free memory & verification.
Related MCP Servers
- AlicenseCqualityAmaintenanceAn MCP server that provides structural codebase indexing and surgical query tools to drastically reduce token usage through symbol-level searches and transitive impact analysis. It supports multiple languages and integrates with git to help AI agents understand code dependencies and the impact of changes in sub-millisecond time.721,229MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to locally search, query, and understand codebases with token-efficient context, dependency graphs, history, architecture diagrams, and metrics through MCP.15 npm3MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to retrieve hyper-targeted, token-efficient context from a codebase by querying a locally built AST knowledge graph, and to persist cross-session agent memory through 17 MCP tools. All indexing and retrieval run entirely offline, so proprietary code never leaves the machine.18 PyPI2MIT
- AlicenseBqualityBmaintenanceEnables AI coding agents and local LLMs to store and recall project memory, compact verbose logs, look up code symbols, create and rewind workspace snapshots, detect risky commands and loops, pack context optimally, and draft tokens through MCP tools.102Apache 2.0