Code-Graph-RAG
MCP server by vitali87 Community
Code-Graph-RAG indexes multi-language codebases into a knowledge graph and lets you query, edit and optimise that code in plain English. It is aimed at developers working in mixed-language monorepos.
Install Code-Graph-RAG
Built from the published package, never by AI.
claude mcp add code-graph-rag -- uvx code-graph-ragRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"code-graph-rag": {
"args": [
"code-graph-rag"
],
"command": "uvx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"code-graph-rag": {
"args": [
"code-graph-rag"
],
"command": "uvx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"code-graph-rag": {
"args": [
"code-graph-rag"
],
"command": "uvx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add code-graph-rag -- uvx code-graph-rag{
"mcpServers": {
"code-graph-rag": {
"args": [
"code-graph-rag"
],
"command": "uvx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add code-graph-rag uvx code-graph-ragGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the code-graph-rag block.
About
Code-Graph-RAG is an MCP server that parses a multi-language codebase into a knowledge graph. It uses Tree-sitter as the parser, with compiler-grade frontends and runtime traces added where available. The graph records functions, classes, methods, modules and the relationships between them. By default it is stored in an embedded SQLite file, so no database server is needed.
Once the graph exists, users can ask questions in natural language, retrieve the source of named functions or classes, and edit code with AST-based patching and a diff preview. The tool can also optimise code, find dead code, search and rewrite by AST pattern with ast-grep, and merge runtime call traces into the graph. It is aimed at developers and teams who want an AI assistant to work over a mixed-language codebase. It also runs as an MCP server for clients such as Claude Code.
Written from the project's README and checked against it.
Tools it gives your assistant
Index a repositoryParses a repository into a knowledge graph with the cgr start --update-graph command.Ask questionsAnswers natural language questions about the codebase, grounded in the graph structure.Retrieve source codeReturns the actual source of a function, class or method by name or by intent.Edit codeEdits code with AST-based surgical patching and a diff preview before any change is made.Optimise codeOptimises code against language best practices or the user's own coding standards.Find dead codeWalks call and reference edges from entry points to find dead code.Structural search and rewriteSearches and rewrites code by AST pattern with ast-grep.Runtime call tracingTraces a test run with cgr trace and merges the observed calls into the graph.
What you need
- Python 3.12 or newer
- ripgrep
- Linux (x86_64, aarch64), macOS or Windows x64
| Setting | Needed | What it is |
|---|---|---|
ORCHESTRATOR_Environment variable | Optional | LLM provider for the orchestrator agent (openai, anthropic, google, azure, cohere, ollama) Default: ollama |
ORCHESTRATOR_Environment variable | Optional | Model name for the orchestrator agent Default: llama3.2 |
ORCHESTRATOR_Environment variable, secret | Optional | API key for the orchestrator LLM provider (not needed for the default local ollama provider) |
CYPHER_Environment variable | Optional | LLM provider for Cypher query generation (openai, anthropic, google, azure, cohere, ollama) Default: ollama |
CYPHER_Environment variable | Optional | Model name for Cypher query generation Default: llama3.2 |
CYPHER_Environment variable, secret | Optional | API key for the Cypher LLM provider (not needed for the default local ollama provider) |
MEMGRAPH_Environment variable | Optional | Hostname of the Memgraph database Default: localhost |
MEMGRAPH_Environment variable | Optional | Port of the Memgraph database Default: 7687 |
TARGET_Environment variable | Optional | Path to the repository to analyze (auto-detected from working directory if not set) |
From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.
Try asking
- Index this repository and then tell me how the payment module is structured.
- Show me the source of the function that handles user login.
- Find dead code in this project starting from the main entry points.
Good to know
- The native extension cgr-graph-rs installs only on the listed platforms and CPython 3.12 or newer.
- A runtime trace only sees code that ran during the trace.
- A compiler frontend only covers code that its toolchain can build.
- Running cgr start with --clean deletes every project in the shared graph.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to Code-Graph-RAG
All alternatives →Turns GitHub repositories into architecture diagrams, written explanations, Mermaid source and narrated explainer videos. Built for developers who want to understand a codebase, and for AI agents that need to read one.
Mocks, records, and chaos-tests HTTP(S) dependencies for development and testing. One port serves many protocols, including gRPC, WebSockets, and LLM chat APIs. Built for developers and testers who need stand-in services during tests.
Provides MCP server and CLI tools that let AI coding agents build, test and manage iOS and macOS projects with Xcode and simulators. It is aimed at developers working on Apple platform apps.
Creates editable draw.io diagrams in AI chat from Mermaid, PlantUML, CSV or draw.io XML. Built for people who want diagrams from text prompts that stay editable in draw.io.
Indexes your code, git history, tests and decisions on your machine so AI coding agents can query the index instead of re-reading files. Built for developers who want fewer files opened and clearer answers about change risk and code health.
Gives your AI assistant hosted codebase intelligence for repos indexed on repowise.dev. Use it to ask how code works, what a change may break, and which tests to run.
Compare with GitDiagram, mockserver or XcodeBuildMCP
Code-Graph-RAG: common questions
Does Code-Graph-RAG need a database server?
No. The graph is stored in an embedded SQLite file by default, and Memgraph and Neo4j are optional backends.
Which programming languages does Code-Graph-RAG support?
Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart, Julia and Lean 4 are listed as fully supported. Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash and Nix have structural support.
Is Code-Graph-RAG free to use?
The source says Code-Graph-RAG is open source and free to use under the MIT licence. It also mentions paid managed cloud and on-premise options as separate enterprise services.
How do I install Code-Graph-RAG?
In Claude Code run claude mcp add code-graph-rag -- uvx code-graph-rag. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is Code-Graph-RAG the official server?
Code-Graph-RAG is a community project by vitali87, not verified by a company domain.
Is Code-Graph-RAG free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is Code-Graph-RAG safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to Code-Graph-RAG?
Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.
Does Code-Graph-RAG work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
