RustCodeGraph
English · 简体中文
Semantic code intelligence for Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini, Antigravity, and Kiro.
Local-first · Rust native · MCP-ready
What It Is
RustCodeGraph indexes a project into a local .rustcodegraph/ knowledge graph. It parses source with tree-sitter, stores symbols, files, calls, imports, framework routes, and cross-file relationships in SQLite, then exposes that graph to coding agents through MCP and a CLI.
Instead of asking an agent to repeatedly grep and read files, RustCodeGraph lets it ask structural questions directly:
- Where is this symbol defined?
- Who calls this function?
- What does this code call?
- What might change if I edit this symbol?
- How does a request, callback, render path, or bridge flow across files?
RustCodeGraph is the Rust port of the original TypeScript CodeGraph implementation, rebuilt around a native CLI, local SQLite index, and MCP workflow.
Quick Start
1. Install
# macOS / Linux
|
# Homebrew (macOS / Linux)
# Windows (PowerShell)
|
# npm, if you already use Node.js
Open a new terminal after installing so rustcodegraph is on your PATH.
2. Connect Your Agent
The installer auto-detects supported agents and writes the MCP configuration they need to launch RustCodeGraph.
Optional for Codex users: add the bundled RustCodeGraph skill and keep rustcodegraph watch --path <project-root> running during active development so Codex is prompted to use fresh indexed context for code search, navigation, flow tracing, and impact analysis.
3. Index a Project
This creates .rustcodegraph/, builds the first index, and enables automatic sync while the MCP server is running.
4. Uninstall
Core Features
| Feature | Summary |
|---|---|
| Local knowledge graph | Stores code structure in project-local SQLite; no external indexing service required. |
| Agent-first context | rustcodegraph_explore returns relevant source, relationships, and flow paths in one response. |
| Search and navigation | Find symbols, callers, callees, and impact radius from CLI or MCP. |
| Auto-sync | Native file watchers keep the graph fresh after edits. |
| Framework awareness | Links routes, components, framework conventions, and bridge boundaries to the code that handles them. See Supported Frameworks and Bridges. |
| Cross-language bridges | Connects common Swift/Objective-C, React Native, Expo Modules, and native-view flows that plain static parsing usually misses. |
| Privacy-first | Code, paths, filenames, symbol names, and queries stay on your machine. |
CLI
MCP Tools
RustCodeGraph exposes a small MCP tool set optimized for coding agents:
| Tool | Purpose |
|---|---|
rustcodegraph_explore |
Primary tool for "how does X work?" and "how does X reach Y?" questions. |
rustcodegraph_node |
Full source for one symbol, overload set, or file, with caller/callee context. |
rustcodegraph_search |
Symbol search by name. |
rustcodegraph_callers |
All known call sites, including callback registrations. |
If a workspace has no .rustcodegraph/ index, the MCP server reports itself inactive and hides its tools. Indexing always remains a user choice.
Supported Agents
rustcodegraph install can configure:
- Claude Code
- Cursor
- Codex CLI
- opencode
- Hermes Agent
- Gemini CLI
- Antigravity IDE
- Kiro
Supported Languages
Source languages: TypeScript/TSX, JavaScript/JSX, Python, Go, Rust, Java, C, C++, C#, PHP, Ruby, Swift, Kotlin, Dart, Pascal/Delphi, Scala, Lua, Luau, Objective-C, and R.
Component, template, and config formats: Razor/Blazor, Svelte, Vue, Astro, Liquid, YAML, Twig, XML, and Java .properties.
Language support is selected automatically from file extensions. RustCodeGraph skips common dependency, build, and cache directories, honors .gitignore, and ignores files larger than 1 MB by default.
Supported Frameworks and Bridges
Backend and web routes: Django, Flask, FastAPI, Express, NestJS, Laravel, Drupal, Rails, Spring, Play Framework, Gin, chi, gorilla/mux, Axum, actix, Rocket, ASP.NET, and Vapor.
Frontend routes and components: React, React Router, Next.js, Svelte/SvelteKit, Vue/Vue Router/Nuxt, and Astro.
Native, mobile, and cross-language flows: SwiftUI, UIKit, Swift/Objective-C bridging, React Native legacy bridge, React Native TurboModules, React Native native events, Expo Modules, and Fabric/Paper native views.
Workspace conventions: Cargo workspaces, TypeScript path aliases, SvelteKit $lib, and Nuxt/Vue auto imports.
Troubleshooting
RustCodeGraph not initialized
Run rustcodegraph init -i in the project directory.
Indexing is slow
Make sure large generated or dependency directories are ignored by .gitignore.
MCP server does not connect
Agents start the server themselves. Check rustcodegraph status, then re-run rustcodegraph install if the agent configuration looks stale.
Migrating from the TypeScript CodeGraph version
Install rustcodegraph and make sure your MCP configuration points at the Rust binary. Existing TypeScript-era CodeGraph configuration is not reused automatically.
More
License
MIT