# CodeGraphContext

> An MCP server and CLI toolkit that indexes local code into a graph database to give AI assistants and developers queryable repository context.

CodeGraphContext (CGC) is an open-source MCP server and CLI toolkit created by Shashank Shekhar Singh. It parses source code into a graph of files, symbols, calls, inheritance and imports, then exposes that graph to developers through the command line and to AI assistants through the Model Context Protocol. It is installed with pip and released under the MIT License.

## What It Is

CGC indexes a local repository with Tree-sitter (and optional SCIP indexers for more accurate calls and inheritance in some languages) and stores the result in a graph database. You can query it directly with commands such as `cgc index`, `cgc list` and `cgc analyze`, or start the MCP server so an AI assistant can ask structural questions in plain English, such as who calls a function or what a class inherits from.

## How the Workflow Works

After `pip install codegraphcontext`, `cgc index .` builds the graph for the current project. Analysis commands cover callers, call chains, class hierarchies, dead code and cyclomatic complexity. `cgc watch` keeps the graph updated as files change, and a `.cgcignore` file (gitignore syntax) excludes paths. Graphs can be visualized as interactive standalone HTML explorers, and a web explorer on the project site can scan a public GitHub or GitLab repository.

## MCP Server Mode

`cgc mcp setup` is a wizard that configures supported clients, including VS Code, Cursor, Windsurf, Zed, Claude, Gemini CLI, ChatGPT Codex, Cline, RooCode, Amazon Q Developer, Kiro, Goose and OpenCode. `cgc mcp start` then launches the server. An opt-in GCF output format is documented as reducing tool response tokens.

## Databases, Languages and Bundles

FalkorDB Lite is the default backend on Unix with Python 3.12+; KuzuDB, LadybugDB, remote FalkorDB, Nornic DB and Neo4j are also supported. The README lists 23 supported languages, including Python, JavaScript, TypeScript, Java, C/C++, C#, Go, Rust and HCL. Pre-indexed `.cgc` bundles for popular repositories can be loaded without re-indexing. A Docker image is available for running without a local Python install.

## Features
- Code indexing into a knowledge graph via Tree-sitter and optional SCIP
- Caller, callee, class hierarchy and call-chain analysis
- Dead code and cyclomatic complexity detection
- Live file watching with automatic graph updates
- MCP server for AI assistants
- Interactive graph visualization
- Pre-indexed .cgc bundles
- Support for 23 programming languages
- Multiple graph database backends
- Interactive setup wizard
- Docker image
- Optional token-optimized GCF output format
- Ignore files via .cgcignore

## Integrations
VS Code, Cursor, Windsurf, Zed, Claude, Gemini CLI, ChatGPT Codex, Cline, RooCode, Amazon Q Developer, Kiro, Goose, OpenCode, Neo4j, FalkorDB, KuzuDB, LadybugDB, Nornic DB, Docker

## Platforms
WINDOWS, MACOS, LINUX, ANDROID, API, VSC_EXTENSION, JETBRAINS_PLUGIN, CLI

## Pricing
Open Source

## Version
0.6.13

## Links
- Website: https://cgc.codes
- Documentation: https://codegraphcontext.github.io/
- Repository: https://github.com/CodeGraphContext/CodeGraphContext
- EveryDev.ai: https://www.everydev.ai/tools/codegraphcontext
