CodeGraphContext

v1.0.0Developer Toolsstable

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.

hacktoberfest2025social-winter-of-code
Share:
3,365
Stars
0
Downloads
0
Weekly
0/5

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

Index Python code into Neo4j for AI-powered understanding.
Query code structure and analyze dependencies with natural language.
LicenseMIT License
Languagepython
Versionv1.0.0
UpdatedMay 22, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx codegraphcontext

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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 | bash
2

Index 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/project
3

Verify 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-code
4

Set 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 setup
5

Start 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/project

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

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.

Quick Config Preview

{ "mcpServers": { "codegraphcontext": { "command": "npx", "args": ["-y", "codegraphcontext"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides