# code-graph-rag [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/vitali87/code-graph-rag  
**GitHub Stars:** 5314  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/code-graph-rag

## Description
The ultimate RAG for your monorepo. Query, understand, and edit multi-language codebases with the power of AI and knowledge graphs

## Claude Desktop Quick Installation
No confirmed install details yet, so no config is published. Follow the setup steps in the repository above.

## Documentation

## What code-graph-rag does

code-graph-rag MCP server indexes a repository as a language-agnostic knowledge graph, allowing an agent to reason about code relationships rather than relying only on text search. It extracts functions, classes, methods, modules, imports, and other structural relationships from a multi-language codebase.

The indexed graph supports natural-language questions about repository structure, retrieval of source by name or intent, and code changes through AST-based patches. Changes can be reviewed through a diff preview before they are applied. The system can also inspect code against language practices or user-defined standards, identify potentially unused code by following call and reference edges, and search or rewrite code using AST patterns through ast-grep.

Supported languages with full support include Python, TypeScript, TSX, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart, and Julia. Scala is in development. Ruby, Kotlin, Swift, Elixir, Haskell, Solidity, Bash, and Nix receive structural support through the ast-grep layer.

## How it works

Tree-sitter provides the base parsing layer. The parser converts source files into AST information and places the resulting entities and relationships into one graph schema shared across languages. When the relevant toolchain is available, additional facts can come from libclang for C and C++, go/types for Go, and optional Roslyn, javac, and Jedi integrations for C#, Java, and Python.

The interactive RAG layer turns a natural-language request into a Cypher query, runs that query against the graph, and uses the returned code context to produce an answer or guide an edit. The default graph is an embedded SQLite file, so a separate database service is not needed. Memgraph and Neo4j can be selected as alternative backends and use the same Cypher query model.

Runtime information can be added with `cgr trace`, which records calls from a test run or imports production eBPF profiles. These observations supplement static analysis and can reveal dispatch paths that static parsing cannot establish alone.

## Setup and configuration

Install the package from PyPI with `uv` or `pipx`. The recommended installation includes the `treesitter-full`, `ast-grep`, and `semantic` extras:

```bash
uv tool install "code-graph-rag[treesitter-full,ast-grep,semantic]"
```

The same package can be installed with `pipx`. Running the indexer uses `cgr start --update-graph`; starting the interactive experience uses `cgr start`. Python 3.12 or newer and `ripgrep` are required. The default embedded SQLite backend needs no Docker, database server, or CMake. Installing from the repository is available when the latest development code is needed.

## Tools and capabilities

- Index repositories into a shared, multi-language knowledge graph.
- Ask natural-language questions grounded in indexed code relationships.
- Retrieve functions, classes, and methods by name or intent.
- Apply AST-based edits with a reviewable diff preview.
- Optimize code against language practices or custom standards.
- Find dead code through call and reference relationships.
- Search and rewrite code with ast-grep patterns.
- Merge test or eBPF runtime traces into the graph.

## Limitations and notes

Tree-sitter remains the baseline, so compiler-derived facts depend on the corresponding toolchain being available. Runtime tracing only covers code that actually executes, while compiler frontends only cover code their toolchains can build. Scala support is still in development, and the ast-grep languages provide structural rather than the same full level of analysis as the primary supported languages.

The default graph is local and embedded in SQLite. Memgraph and Neo4j are optional rather than required. Package releases and repository tags follow different release cadences, so installing from PyPI and installing from the repository can produce different code states.

_Full upstream README: https://allmcps.com/mcp/code-graph-rag/readme_

