Airsc is free for everyone. If it helps you, support it with $2–$20.

Support
SkillCautionAgent workflow & memoryAdvanced

CodeGraphContext

CodeGraphContext · CodeGraphContext/CodeGraphContext

Indexes local code into a queryable graph to provide AI agents with deep structural context of your codebase.

An MCP server plus a CLI tool that indexes local code into a graph database to provide context to AI assistants.

4.3k stars833License: MITUpdated 9 days ago0 opens

Preview

▍

What you can do with it

  • Help the agent navigate complex dependencies between files and functions
  • Generate visual maps or explanations of application logic flows
  • Improve code review quality by providing the agent with broader project context

Safety check

Caution

Usable, but read the notes first.

  • ●Installer downloads a remote script and pipes it to the shell.README.md

Automated scan of the repo files. Always review code you run.

From the README

🏗️ CodeGraphContext (CGC)

Turn code repositories into a queryable graph for AI agents.

🌐 Languages:

🌍 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.


📍 Quick Navigation


✨ Experience CGC

👨🏻‍💻 Installation and CLI

Install in seconds with pip and unlock a powerful CLI for code graph analysis.

🛠️ Indexing in Seconds

The CLI intelligently parses your tree-sitter nodes to build the graph.

🤖 Powering your AI Assistant

Use natural language to query complex call-chains via MCP.


Why CodeGraphContext?

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]

Comparison at a glance

ApproachBest forTradeoff
grep / file searchExact string lookupMisses relationships and code structure
RAG over code chunksNatural-language retrievalCan lose symbol-level precision
CodeGraphContextRepository-wide reasoningRequires an indexing step

Common use cases

  • Trace call chains across files and packages.
  • Understand class hierarchies, imports, and module boundaries.
  • Find dead code, hotspots, and unexpected dependencies.
  • Give an AI assistant the same structural context a maintainer would use.

FAQ

  • Do I need a remote service? No. CGC works locally with embedded backends or with external graph databases when you want them.
  • Is it only for one language? No. It supports a broad mix of mainstream languages and keeps expanding.
  • Can I use it with an AI assistant? Yes. That is one of the main reasons the MCP server exists.

Project Details


👨‍💻 Maintainer

CodeGraphContext is created and actively maintained by:

Shashank Shekhar Singh

Contributions and feedback are always welcome! Feel free to reach out for questions, suggestions, or collaboration opportunities.


Star History

Star History Chart ↗


Features

  • Code Indexing: Analyzes code and builds a knowledge graph of its components.
  • Relationship Analysis: Query for callers, callees, class hierarchies, call chains and more.
  • Pre-indexed Bundles: Load famous repositories instantly with .cgc bundles - no indexing required! (Learn more)
  • Live File Watching: Watch directories for changes and automatically update the graph in real-time (cgc watch).
  • Interactive Setup: A user-friendly command-line wizard for easy setup.
  • Dual Mode: Works as a standalone CLI toolkit for developers and as an MCP server for AI agents.
  • Multi-Language Support: Full support for 23 programming languages.
  • Flexible Database Backend: FalkorDB Lite (Default), KuzuDB, LadybugDB, FalkorDB Remote, Nornic DB, or Neo4j (all platforms via Docker/native).

🏗️ Architecture & Workflow

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,st
View source on GitHub