Browse by type
Turn code repositories into a queryable graph for AI agents.
🌐 Languages: - 🇬🇧 English - 🇨🇳 中文 - 🇰🇷 한국어 - 🇺🇦 Українська - 🇷🇺 Русский - 🇯🇵 日本語 - 🇮🇳 தமிழ் - 🇪🇸 Español (Soon)
🌍 Help translate CodeGraphContext to your language by raising an issue & PR on GitHub Issues!
Bridge the gap between deep code graphs and AI context.
A powerful MCP server and CLI toolkit that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for comprehensive code analysis or connect it to your favorite AI IDE via MCP for AI-powered code understanding.
Install in seconds with pip and unlock a powerful CLI for code graph analysis.
The CLI intelligently parses your tree-sitter nodes to build the graph.
Use natural language to query complex call-chains via MCP.
CodeGraphContext is built for the moment when plain text search stops being enough. It turns a repository into a graph of files, symbols, calls, inheritance, imports, and relationships so you can move from "where is this defined?" to "how does this actually connect?" without jumping between tools.
flowchart LR
A[Source code] --> B[Tree-sitter and SCIP indexers]
B --> C[Graph database]
C --> D[CLI queries]
C --> E[MCP server]
D --> F[Direct analysis]
E --> G[AI assistants with repo context]
| Approach | Best for | Tradeoff |
|---|---|---|
grep / file search |
Exact string lookup | Misses relationships and code structure |
| RAG over code chunks | Natural-language retrieval | Can lose symbol-level precision |
| CodeGraphContext | Repository-wide reasoning | Requires an indexing step |
CodeGraphContext is created and actively maintained by:
Shashank Shekhar Singh
- 📧 Email: shashankshekharsingh1205@gmail.com
- 🐙 GitHub: @Shashankss1205
- 🔗 LinkedIn: Shashank Shekhar Singh
- 🌐 Website: codegraphcontext.vercel.app
Contributions and feedback are always welcome! Feel free to reach out for questions, suggestions, or collaboration opportunities.
.cgc bundles - no indexing required! (Learn more)cgc watch).CodeGraphContext transforms source code into a queryable knowledge graph that can be explored through the CLI or AI assistants via MCP.
flowchart TD
A[Code Repository] --> B[Tree-sitter / SCIP Indexing]
B --> C[Knowledge Graph]
C --> D[Graph Database]
D --> E[CLI Toolkit]
D --> F[MCP Server]
F --> G[AI Assistant]
CodeGraphContext parses your source code and builds a comprehensive knowledge graph. This graph can be queried directly via the CLI toolkit or exposed to AI assistants through the MCP server.
flowchart TD
A[Code Repository] -->|Parsed by| B[Tree-sitter / SCIP Indexing]
B -->|Generates| C[Knowledge Graph]
C -->|Stored in| D[(Graph Database)]
D -->|Queried via| E[CLI Toolkit]
D -->|Served by| F[MCP Server]
F -->|Provides context to| G[🤖 AI Assistant]
classDef default fill:#1f2937,stroke:#8b5cf6,stroke-width:2px,color:#fff;
classDef db fill:#0f172a,stroke:#3b82f6,stroke-width:2px,color:#fff;
classDef ai fill:#312e81,stroke:#a855f7,stroke-width:2px,color:#fff;
D:::db
G:::ai
CodeGraphContext parses your source code and builds a comprehensive knowledge graph. This graph can be queried directly via the CLI toolkit or exposed to AI assistants through the MCP server.
flowchart TD
A[Code Repository] -->|Parsed by| B[Tree-sitter / SCIP Indexing]
B -->|Generates| C[Knowledge Graph]
C -->|Stored in| D[(Graph Database)]
D -->|Queried via| E[CLI Toolkit]
D -->|Served by| F[MCP Server]
F -->|Provides context to| G[🤖 AI Assistant]
classDef default fill:#1f2937,stroke:#8b5cf6,stroke-width:2px,color:#fff;
classDef db fill:#0f172a,stroke:#3b82f6,stroke-width:2px,color:#fff;
classDef ai fill:#312e81,stroke:#a855f7,stroke-width:2px,color:#fff;
D:::db
G:::ai
CodeGraphContext provides comprehensive parsing and analysis for the following languages:
| Language | Language | Language | |||
|---|---|---|---|---|---|
| 🐍 | Python | 📜 | JavaScript | 🔷 | TypeScript |
| ☕ | Java | 🔵 | C | ➕ | C++ |
| #️⃣ | C# | 🐹 | Go | 🦀 | Rust |
| 💎 | Ruby | 🐘 | PHP | 🍎 | Swift |
| 🎨 | Kotlin | 🎯 | Dart | 🐪 | Perl |
| 🌙 | Lua | 🚀 | Scala | λ | Haskell |
| 💧 | Elixir | 📜 | Emacs Lisp (elisp) | 🌐 | HTML |
| 🎨 | CSS | ⚛️ | TSX | ⛓️ | Solidity |
Each language parser extracts functions, classes, methods, parameters, inheritance relationships, function calls, and imports to build a comprehensive code graph.
Solidity notes: .sol uses Tree-sitter via tree-sitter-language-pack (no SCIP). Supports Foundry remappings, modifier invocations, using Lib for T, and emit / custom-error revert as CALLS. See docs/docs/contributing_languages.md § Solidity.
CodeGraphContext supports multiple graph database backends to suit your environment:
| Feature | KuzuDB | LadybugDB | FalkorDB Lite | Neo4j / Nornic DB |
|---|---|---|---|---|
| Typical default | Cross-platform fallback when FalkorDB Lite is unavailable | Optional embedded backend | Default on Unix (Python 3.12+, when falkordblite is installed) |
When explicitly configured via cgc config db |
| Setup | Zero-config / Embedded | Zero-config / Embedded | Zero-config / In-process | Docker / External |
| Platform | All (Windows Native, macOS, Linux) | All (Windows Native, macOS, Linux) | Unix-only (Linux/macOS/WSL) | All Platforms |
| Use Case | Desktop, IDE, Local development | Custom research projects | Specialized Unix development | Enterprise, Massive graphs |
| Requirement | pip install kuzu |
pip install ladybug |
pip install falkordblite |
Neo4j Server / Docker / Nornic Cloud |
| Speed | ⚡ Extremely Fast | ⚡ Fast | 🚀 Scalable | |
| Persistence | Yes (to disk) | Yes (to disk) | Yes (to disk) |
When SCIP_INDEXER=true in your CGC config (~/.codegraphcontext/.env), some languages use external SCIP indexers for more accurate calls and inheritance than Tree-sitter heuristics alone.
C and C++ use scip-clang, which requires a compile_commands.json file (a JSON compilation database): one entry per translation unit with the real compiler command (include paths, -D defines, -std, etc.). Without it, scip-clang cannot run; CGC logs a warning and falls back to Tree-sitter for that repo. Typical ways to produce the file: CMake with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON, or wrap your real build with Bear (e.g. bear -- make). CGC also looks under build/ and cmake-build-*/ for that filename.
C# uses scip-dotnet (Roslyn); you need a normal .csproj / .sln and a successful restore—no compile_commands.json.
SCIP is independent of which graph database you use (Kuzu, Neo4j, etc.); the same flag applies to all backends.
CodeGraphContext is already being explored by developers and projects for:
browse all types & interfaces →
$ claude mcp add CodeGraphContext \
-- python -m otcore.mcp_server <graph>