Skip to content
MCP server

Code-Graph-RAG

Turns a multi-language codebase into a graph you can query and edit in plain English

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
CLI, self-hosted
Runs
Locally
Version
0.6.62
Listing updated
3 days ago

About Code-Graph-RAG

Code-Graph-RAG is an open-source MCP server for knowledge and memory. It runs locally on your machine and is started by your AI client.

Instead of searching files by text, this server first parses a repository with Tree-sitter into a graph of functions, classes, modules and the calls and imports between them. Questions you type are translated into Cypher queries against that graph, so answers point at real structure rather than guessed context.

Where a toolchain is installed it layers compiler-level facts on top: libclang for C and C++, go/types for Go, and optional Roslyn, javac and Jedi for C#, Java and Python. A cgr trace command can also merge calls observed at runtime into the graph, which exposes dispatch that static parsing cannot see.

The graph lives in an embedded SQLite file by default; Memgraph and Neo4j are opt-in backends that run the same Cypher. The orchestrator and the query-writing model are configured separately, with ollama as the default and OpenAI, Anthropic, Google, Azure and Cohere as options. The website says the MCP integration exposes 15 tools for indexing, querying, editing and searching.

Install

Run in a terminal

claude mcp add code-graph-rag --env ORCHESTRATOR_API_KEY='<ORCHESTRATOR_API_KEY>' --env CYPHER_API_KEY='<CYPHER_API_KEY>' -- uvx code-graph-rag

Add to claude_desktop_config.json

{
  "mcpServers": {
    "code-graph-rag": {
      "command": "uvx",
      "args": [
        "code-graph-rag"
      ],
      "env": {
        "ORCHESTRATOR_API_KEY": "<ORCHESTRATOR_API_KEY>",
        "CYPHER_API_KEY": "<CYPHER_API_KEY>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "code-graph-rag": {
      "command": "uvx",
      "args": [
        "code-graph-rag"
      ],
      "env": {
        "ORCHESTRATOR_API_KEY": "<ORCHESTRATOR_API_KEY>",
        "CYPHER_API_KEY": "<CYPHER_API_KEY>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "code-graph-rag": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "code-graph-rag"
      ],
      "env": {
        "ORCHESTRATOR_API_KEY": "<ORCHESTRATOR_API_KEY>",
        "CYPHER_API_KEY": "<CYPHER_API_KEY>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "code-graph-rag": {
      "command": "uvx",
      "args": [
        "code-graph-rag"
      ],
      "env": {
        "ORCHESTRATOR_API_KEY": "<ORCHESTRATOR_API_KEY>",
        "CYPHER_API_KEY": "<CYPHER_API_KEY>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "code-graph-rag": {
      "command": "uvx",
      "args": [
        "code-graph-rag"
      ],
      "env": {
        "ORCHESTRATOR_API_KEY": "<ORCHESTRATOR_API_KEY>",
        "CYPHER_API_KEY": "<CYPHER_API_KEY>"
      }
    }
  }
}

Configuration

  • ORCHESTRATOR_PROVIDERLLM provider for the orchestrator agent (openai, anthropic, google, azure, cohere, ollama)
  • ORCHESTRATOR_MODELModel name for the orchestrator agent
  • ORCHESTRATOR_API_KEYAPI key for the orchestrator LLM provider (not needed for the default local ollama provider)
  • CYPHER_PROVIDERLLM provider for Cypher query generation (openai, anthropic, google, azure, cohere, ollama)
  • CYPHER_MODELModel name for Cypher query generation
  • CYPHER_API_KEYAPI key for the Cypher LLM provider (not needed for the default local ollama provider)
  • MEMGRAPH_HOSTHostname of the Memgraph database
  • MEMGRAPH_PORTPort of the Memgraph database
  • TARGET_REPO_PATHPath to the repository to analyze (auto-detected from working directory if not set)

What it does

Tree-sitter graph index
Parses 14 languages into one graph schema of functions, classes, modules and dependencies.
Natural-language queries
Translates plain-English questions into Cypher queries over the code graph.
AST-based editing
Replaces specific functions with a diff preview shown before anything changes.
Dead code detection
Walks call and reference edges from entry points to find unreachable functions.
Structural search and replace
Uses ast-grep patterns to match and rewrite code by structure, not text.
Runtime trace overlay
Merges calls observed in a test run into the graph with the cgr trace command.
Choice of graph backend
Embedded SQLite by default, with Memgraph or Neo4j as opt-in alternatives.

Good for

  • Ask how a function is reached in an unfamiliar monorepo
  • Find unreachable functions before a cleanup
  • Apply a pattern-based rewrite across a whole codebase
  • Check what calls a function before changing its signature
  • Let an agent edit one function surgically, with a diff to review

Pricing

Open source

Free open-source core; paid support and consulting offered, prices not published

Prices change. Check code-graph-rag.com before you buy.

Code-Graph-RAG FAQ

Which LLM does it use?

The orchestrator and the Cypher generator are set separately through environment variables. The registry entry lists openai, anthropic, google, azure, cohere and ollama, with ollama and llama3.2 as the defaults.

Does the graph need a database server?

No. The README says the graph is stored in an embedded SQLite file by default. Memgraph and Neo4j are optional backends.

Which languages are supported?

The website lists 14, among them Python, TypeScript, JavaScript, Rust, Go, Java, C, C++, C#, PHP, Lua, Dart and Julia.

Is there paid support?

The core is free and open source. The website also offers support contracts, consulting, training, custom parsers and managed or on-prem deployment; prices are not published.

Is Code-Graph-RAG free?

Yes. Code-Graph-RAG is open source, so you can use and self-host it for free.

How do I add Code-Graph-RAG to Claude Code?

Run this command in your terminal: claude mcp add code-graph-rag --env ORCHESTRATOR_API_KEY='<ORCHESTRATOR_API_KEY>' --env CYPHER_API_KEY='<CYPHER_API_KEY>' -- uvx code-graph-rag

What are the best alternatives to Code-Graph-RAG?

The closest alternatives to Code-Graph-RAG are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

Alternatives to Code-Graph-RAG

  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 464K GitHub stars
    • Developer tools
  2. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 48.7K GitHub stars
    • Knowledge and memory
  3. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    Not checked yet
    • Remote
    • Open source
    • 34.5K GitHub stars
    • Developer tools
  4. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.5K GitHub stars
    • Developer tools
  5. XERJ

    MCP server

    Local search engine for AI agents with cited answers over your code and docs

    Runs locally
    • Open source
    • 19.2K GitHub stars
    • Knowledge and memory
  6. Ouroboros

    MCP server

    Spec-first layer that pins requirements and verifies results of AI coding agent work

    Runs locally
    • Open source
    • 6.4K GitHub stars
    • Developer tools