CodeGraph (Rust) MCP
codegraph-rust
A Rust code graph for agents: four MCP tools show what an edit will touch, how the architecture fits together and where the fragile spots are
- 905 ★ on the repository
- Last commit
Extended access
Why this level
- Reads all of the project's sources and stores their parse and vector embeddings in `.codegraph/db`
- With a cloud embedding or model provider, code snippets go to an external service along with the key from `.env`
- `codegraph init` appends agent hooks and sections to the project's `AGENTS.md` and `CLAUDE.md`
Install
- Works in
Manual install
git clone https://github.com/Jakedismo/codegraph-rust
cd codegraph-rust
./install-codegraph-full-features.shA source build with all features. For faster macOS builds the Makefile has `make build-llvm` and `make test-llvm`, which need `brew install llvm`.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Reads all of the project's sources and stores their parse and vector embeddings in `.codegraph/db`
- With a cloud embedding or model provider, code snippets go to an external service along with the key from `.env`
- `codegraph init` appends agent hooks and sections to the project's `AGENTS.md` and `CLAUDE.md`
This is third-party code. Review the repository files before installing.
What it does
CodeGraph for Rust parses a project's sources into a syntax tree, links symbols into a graph and stores it with vector embeddings in SurrealDB, which is built into the `codegraph` binary. Each project gets its own store in `.codegraph/db`. The indexing tier sets how deep the parsing goes: `fast` takes nodes and core edges, `balanced` adds language-server symbols and docs, `full` turns on every analyzer, dataflow and architecture. The agent connects the server over MCP and gets four tools. `agentic_context` gathers the context you need and answers questions about the code, `agentic_impact` shows dependency and call chains, that is, what breaks when you change something, `agentic_architecture` describes structure and public APIs, `agentic_quality` finds complex and tightly coupled spots. Inside each tool a model from `.env` works: it picks graph operations itself, chains them and returns file paths, line numbers and short snippets. The same tools are available from the shell with `codegraph agent context "question"`. `codegraph init` offers project-local hooks for Claude Code and Codex, appends a managed section to `AGENTS.md` and `CLAUDE.md` and starts indexing. The `--watch` flag refreshes the index while the server runs.
Who it is for. For developers who work in large repositories with Claude Code, Cursor or Codex and want the agent to look at the links in the code first instead of reading files one by one.
Good fit when
- Before a refactor you need to know which modules a change to a function or type will touch
- The agent burns many tokens reading files to understand an unfamiliar repository
- You need a map of the architecture and public APIs for a Rust, TypeScript, Python, Go, Java or C/C++ project
- Before a review you want to find the most complex and tightly coupled spots
- You want both embeddings and the tool model on your own machine through `ollama` or `lmstudio`
Not a fit when
- You need a ready package with no build: installation runs a script that builds the project from source
- You have neither a local model nor a cloud provider key: indexing needs an embedding model and the agent tools need an LLM
- You want a graph with no model inside and no keys: CodeGraph by colbymchenry builds one on SQLite
Example request
Build a code graph of this project and show which modules break if I change the signature of `UserService`MCP
- Transport
- stdio
- Authentication
- not required
Environment variables
CODEGRAPH_EMBEDDING_PROVIDERrequired- Embedding provider: ollama, lmstudio, jina, openai or onnx.
CODEGRAPH_LLM_PROVIDERrequired- Provider of the tool model: ollama, lmstudio, anthropic, openai, xai or openai-compatible.
CODEGRAPH_CONTEXT_WINDOW- The real context limit of the chosen model; it selects the prompt tier.
Limitations
- The author did not specify a license, so rights to use and copy are undefined, check with the author. The project text names MIT, but there is no `LICENSE` file in the repository.
- The embedded store is opened by one process per project. Stop a running `codegraph start` before `codegraph index`, and connect one client per project. A separate daemon cannot share the store with a running server; a shared database needs your own SurrealDB server and the `CODEGRAPH_SURREALDB_URL` variable.
- The `balanced` and `full` tiers need language servers: `rust-analyzer`, `typescript-language-server`, `pyright-langserver`, `gopls`, `jdtls` or `clangd`. If the one you need is missing, indexing fails at once; for Rust `rust-analyzer --version` is checked from the project folder.
- The `fast` tier is the default and turns off language servers, enrichment and dataflow, so `Uses` and `References` edges stay out of the graph. How complete the answers are depends on the chosen tier and the model.
- Analysis across several repositories and custom graph schemas are on the author's roadmap and do not exist yet.
How to disable. Remove the `codegraph` block from the agent's MCP config and stop `codegraph start`. Delete a project's index with `rm -rf <project>/.codegraph/db`. The Claude Code and Codex hooks added by `codegraph init` live in the project settings, and the `# codegraph` section in `AGENTS.md` and `CLAUDE.md` is removed by hand.
FAQ
How does CodeGraph for Rust find out what breaks when I edit something?
The `agentic_impact` tool walks the graph: it builds dependency and call chains from the symbol you name and answers in a structured form with file paths, line numbers and short snippets. A call looks like `agentic_impact({"query": "UserService"})`.
Can I get by with local models?
Embeddings can come from `ollama`, `lmstudio` and `onnx`, the tool model from `ollama` and `lmstudio`. Cloud options exist too: `jina` and `openai` for embeddings, `anthropic`, `openai`, `xai` and any OpenAI-compatible server for the model.
Where does the project graph live, and do projects mix?
Each project gets its own SurrealKV store in `.codegraph/db`, and the `schema/codegraph_v2.surql` schema is applied on first indexing. Data from different projects never overlaps, and the folder gets its own `.gitignore`.
Do secrets end up in the index?
Indexing respects `.gitignore` and filters common secret patterns: `.env`, `credentials.json`, `*.pem` and API keys.
Which indexing tier should I start with?
The default is `fast`: quicker and smaller, but without language servers. Take `balanced` for navigation and docs, `full` for dataflow and architecture signals. Set the tier with the `--index-tier` flag, the `CODEGRAPH_INDEX_TIER` variable or the `tier` setting in the config.
Do I have to re-index by hand after edits?
No, if the server starts with `--watch`: the watcher re-indexes changed files inside the same process. The standalone `codegraph daemon start` suits the case when no server is running.
Discussion
No questions or reviews yet.
Related
MCP serversLocal code graph for agents: an MCP server returns entry points, symbol links and change impact in one call
Local code structure graph: builds a repository map with tree-sitter and serves the assistant only the context a change actually touches over MCP
Indexes a codebase into a knowledge graph and gives the agent call chains, change blast radius and code search over MCP
The /graphify skill builds a knowledge graph of a project's code, docs and PDFs so the agent queries the graph instead of grepping
An MCP server and CLI that build a knowledge graph of a monorepo and let an agent query, understand and edit multi-language code
codesight maps a project in one run: routes, DB models, dependencies, env vars. It gives the map to an agent as files or through an MCP server
Comparison with similar tools
Entries that share the main search query, and how they differ.
| Entry | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| CodeGraph (Rust) (this entry) | no | not required | 905 | |
| CodeGraph | no | not required | 74,886 | a graph on SQLite with no external services and no keys; here an embedded model forms the answers on top of a SurrealDB graph |
| code-graph-rag | no | not required | 5,277 | a knowledge graph for a monorepo with natural-language queries, an MCP server and a CLI |
| codebase-memory-mcp | no | not required | 47,260 | answers structural queries about functions, classes, calls and routes locally |
README in short
The repository holds a Cargo workspace of separate crates, four install scripts (full, cloud, fast for macOS and basic), a sample config in `config/example.toml`, installation and usage guides, a description of the agent command line and the `agentic_test_cases.py` test scenarios. The main project page shows a sample tool answer, the table of indexing tiers, accuracy measurements per tier and a diagram of the MCP client, server and graph store.