CodeGraphContext
Indexes local Python code into a Neo4j graph database to provide AI assistants with deep code understanding and relationship analysis. Enables querying code structure, dependencies, and impact analysis through natural language interactions.
What is CodeGraphContext?
CodeGraphContext is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to indexes local python code into a neo4j graph database to provide ai assistants with deep code understanding and relationship analysis. enables querying code structure, dependencies, and impact analysi...
Indexes local Python code into a Neo4j graph database to provide AI assistants with deep code understanding and relationship analysis. Enables querying code structure, dependencies, and impact analysis through natural language interactions.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Indexes local Python code into a Neo4j graph database to pro
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx codegraphcontextConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use CodeGraphContext
CodeGraphContext (CGC) indexes local codebases into a graph database and exposes the resulting code knowledge graph to AI assistants via an MCP server. It supports 23 programming languages and multiple graph database backends including FalkorDB Lite (zero-config default), KuzuDB, and Neo4j. By connecting your AI assistant to CGC, you can ask natural language questions about function call chains, class hierarchies, dead code, and dependency relationships across large codebases without manually navigating files.
Prerequisites
- Python 3.10 or later with pip
- Git (optional, for cloning repositories to index)
- Neo4j, KuzuDB, or FalkorDB if not using the default embedded FalkorDB Lite
- An MCP-compatible client such as Claude Desktop, VS Code, or Cursor
Install CodeGraphContext
Install the package globally using pip. If the cgc or codegraphcontext command is not found after install, run the provided post-install fix script.
pip install codegraphcontext
# If command not found after install:
curl -sSL https://raw.githubusercontent.com/CodeGraphContext/CodeGraphContext/main/scripts/post_install_fix.sh | bashIndex your codebase
Navigate to or specify the root of the repository you want to analyze. CGC will crawl the source files and build a knowledge graph. Indexing time depends on codebase size.
codegraphcontext index /path/to/your/projectVerify the index
List all indexed repositories to confirm the index was created successfully. You can also run dead-code or complexity analysis at this point.
codegraphcontext list
codegraphcontext analyze dead-codeSet up the MCP server
Run the MCP setup command, which auto-detects your installed AI clients (Claude Desktop, Cursor, VS Code, Windsurf, Zed) and writes the required MCP configuration entries.
codegraphcontext mcp setupStart the MCP server
Launch the MCP server so your AI assistant can connect and query the code graph. Optionally enable live file watching so the graph updates as you edit code.
codegraphcontext mcp start
# Or with live watching:
codegraphcontext watch /path/to/your/projectCodeGraphContext Examples
Client configuration
Manual configuration for Claude Desktop if the auto-setup did not configure it. Adjust the path if codegraphcontext is not on the system PATH.
{
"mcpServers": {
"codegraphcontext": {
"command": "codegraphcontext",
"args": ["mcp", "start"]
}
}
}Prompts to try
After connecting, ask your AI assistant questions that leverage the code knowledge graph.
- "Show me all functions that call process_payment in this codebase"
- "Trace the full call chain from main() to the database layer"
- "Find dead code in the auth module"
- "What classes inherit from BaseModel?"
- "Which modules have the highest cyclomatic complexity?"Troubleshooting CodeGraphContext
codegraphcontext command not found after pip install
Run the post-install fix script: curl -sSL https://raw.githubusercontent.com/CodeGraphContext/CodeGraphContext/main/scripts/post_install_fix.sh | bash. Alternatively, ensure your Python scripts directory is on your PATH (e.g., ~/.local/bin on Linux/macOS).
Neo4j connection refused when using Neo4j backend
Ensure Neo4j is running and set the environment variables NEO4J_URI (e.g. bolt://localhost:7687), NEO4J_USERNAME, and NEO4J_PASSWORD in ~/.codegraphcontext/.env before indexing.
C/C++ or C# files are not indexed
SCIP indexing for C, C++, and C# requires a compile_commands.json (C/C++) or .csproj file (C#) in the project root. Set SCIP_INDEXER=true in your environment and ensure these files are present before running codegraphcontext index.
Frequently Asked Questions about CodeGraphContext
What is CodeGraphContext?
CodeGraphContext is a Model Context Protocol (MCP) server that indexes local python code into a neo4j graph database to provide ai assistants with deep code understanding and relationship analysis. enables querying code structure, dependencies, and impact analysis through natural language interactions. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install CodeGraphContext?
Follow the installation instructions on the CodeGraphContext GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with CodeGraphContext?
CodeGraphContext works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is CodeGraphContext free to use?
Yes, CodeGraphContext is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
CodeGraphContext Alternatives — Similar Developer Tools Servers
Looking for alternatives to CodeGraphContext? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up CodeGraphContext in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use CodeGraphContext?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.