Get the FREE Ultimate OpenClaw Setup Guide →

code-graph-rag

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio vitali87-code-graph-rag uvx vitali87/code-graph-rag sync \
  --env UVX_HOST="http://localhost" \
  --env UVX_PORT="11434" \
  --env UVX_LOG_LEVEL="info"

How to use

Code-Graph-RAG exposes a retrieval-augmented generation workflow for codebases. Once running through the MCP interface, you can query the codebase knowledge graph, fetch relevant functions, classes, and modules, and even edit code using AST-aware operations. The system supports multiple languages via Tree-sitter parsing and stores data in Memgraph, enabling natural language questions like 'show me all functions related to authentication' or 'update the error handling pattern in login flow' and returning both high-level results and exact code snippets. In addition, you can execute shell-like tasks, generate Cypher queries for graph exploration, and leverage AI-assisted code optimizations or refactors. The MCP integration with Claude Code lets you issue natural language commands to inspect or modify the repository, then apply surgical changes with previews.

How to install

Prerequisites:

  • Python 3.12+ and uv (Python package manager) installed
  • Git installed
  • Optional: Docker and Docker Compose for Memgraph-based setups
  1. Clone the repository and enter the project:
git clone https://github.com/vitali87/code-graph-rag.git
cd code-graph-rag
  1. Install dependencies for Python/uv workflow (basic Python support):
uv sync
  1. For full multi-language support (recommended):
uv sync --extra treesitter-full
  1. Install development tools (optional but recommended):
make dev
  1. Copy and configure environment variables:
cp .env.example .env

Edit .env with the appropriate settings (endpoints, model providers, API keys, etc.).

  1. Run the MCP-enabled server via uvx (as described in the MCP config):
uvx vitali87/code-graph-rag sync
  1. Verify the server is running and accessible on the configured port, then connect via Claude Code or your MCP client to start querying and editing codebases.

Additional notes

Tips and notes:

  • Ensure Python 3.12+ is installed and that uv is available in your PATH.
  • If you plan to use cloud models (OpenAI/Google Gemini), provide the necessary API keys in the environment (.env) as documented in the config section of the repository.
  • For locally hosted models, you need Ollama or equivalent as per the project prerequisites.
  • Docker-based Memgraph setups require Docker and Docker Compose; ensure the Memgraph service is up before starting queries.
  • The environment variables in the MCP config example provide sensible defaults; adjust LOG level, host, and port as needed.
  • When running in development, you can rely on the provided Makefile targets for pre-commit hooks and tests.
  • If you encounter synchronization issues with Tree-sitter grammars, re-run the sync step or use uv sync --extra treesitter-full to ensure full grammars are installed.

Related MCP Servers

Sponsor this space

Reach thousands of developers