
CodeGraphContext
Index local code into a graph database to give AI assistants deep, queryable code context.
Add to your client
Copy the config for your MCP client and paste it into its config file.
pip install codegraphcontextPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"codegraphcontext": {
"command": "codegraphcontext",
"args": [
"mcp",
"start"
],
"env": {
"NEO4J_URI": "YOUR_NEO4J_URI",
"NEO4J_USERNAME": "YOUR_NEO4J_USERNAME",
"NEO4J_PASSWORD": "YOUR_NEO4J_PASSWORD"
}
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- Python 3.10 or later
- pip package manager
- Git (optional, for cloning repositories)
- A graph database backend — embedded FalkorDB Lite / KuzuDB requires no setup; external Neo4j is optional via `codegraphcontext neo4j setup`
About CodeGraphContext
A powerful MCP server plus 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 an AI IDE via MCP for AI-powered code understanding. It parses 23 languages with tree-sitter (optionally SCIP) into a graph of functions, classes, methods, inheritance, calls, and imports, then answers questions about callers/callees, class hierarchies, multi-file call chains, dead code, and complexity. Supports embedded backends (FalkorDB Lite, KuzuDB, LadybugDB) or external Neo4j/Nornic DB.
Tools & capabilities (25)
add_code_to_graphPerforms a one-time scan of a local folder to add its code to the graph. Ideal for indexing libraries, dependencies, or projects not being actively modified. Returns a job ID for background processing.
check_job_statusCheck the status and progress of a background job.
list_jobsList all background jobs and their current status.
find_codeFind relevant code snippets related to a keyword (e.g., function name, class name, or content).
analyze_code_relationshipsAnalyze code relationships like 'who calls this function' or 'class hierarchy'.
watch_directoryContinuously monitors a directory and keeps the graph updated.
execute_cypher_queryRun a read-only Cypher query against the code graph.
add_package_to_graphAdd a package to the graph.
find_dead_codeFind potentially unused functions.
calculate_cyclomatic_complexityCalculate the cyclomatic complexity of a function.
find_most_complex_functionsFind the most complex functions in the codebase.
list_indexed_repositoriesList all indexed repositories.
delete_repositoryDelete a repository from the graph.
visualize_graph_queryGenerate a Neo4j visualization URL for a Cypher query.
list_watched_pathsList all watched directories.
unwatch_directoryStop watching a directory.
load_bundleLoad a pre-indexed bundle.
search_registry_bundlesSearch registry bundles.
get_repository_statsGet repository statistics.
discover_codegraph_contextsDiscover .codegraphcontext folders.
switch_contextSwitch the active graph context.
generate_reportGenerate a codegraph report.
find_java_spring_endpointsFind Spring endpoints.
find_java_spring_beansFind Spring beans.
find_datasource_nodesQuery datasource nodes.
What this server can do
CodeGraphContext provides tools for these capabilities — tap one to see every MCP server that does the same:
When to use it
- Ask an AI assistant 'what other functions call get_user_by_id?' or 'if I change calculate_tax, what is affected?'
- Trace full call chains across hundreds of files for impact analysis and debugging
- Explore class hierarchies and find all implementations of a method
- Detect dead/unused code and the most cyclomatically complex functions
- Keep the graph live by watching a directory while you actively develop
- Instantly load pre-indexed .cgc bundles of well-known repositories without re-indexing
Security notes
The MCP protocol connection itself requires no auth. The optional `env` block in the config supplies Neo4j credentials (NEO4J_URI / NEO4J_USERNAME / NEO4J_PASSWORD) only when using an external Neo4j backend; the default embedded database (FalkorDB Lite / KuzuDB) needs none. CGC stores database credentials in ~/.codegraphcontext/.env. The execute_cypher_query tool is documented as read-only.
CodeGraphContext FAQ
Is a Neo4j server required?
No. CodeGraphContext uses an embedded graph database by default (FalkorDB Lite on Unix, or KuzuDB cross-platform), so no extra setup is needed for most users. Neo4j is an optional external backend configured via `codegraphcontext neo4j setup`, and its credentials go in the config's env block.
Which languages are supported?
23 languages including Python, JavaScript, TypeScript/TSX, Java, C, C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, Dart, Perl, Lua, Scala, Haskell, Elixir, Emacs Lisp, HTML, and CSS. Each parser extracts functions, classes, methods, parameters, inheritance, calls, and imports.
How do I configure my AI IDE?
Run `codegraphcontext mcp setup` to auto-detect and configure VS Code, Cursor, Windsurf, Zed, Claude, Gemini CLI, ChatGPT Codex, Cline, RooCode, Amazon Q Developer, Kiro, Goose, or OpenCode. You can also configure manually by adding the mcpServers block to your client's settings, then start the server with `codegraphcontext mcp start`.
What is SCIP indexing?
An optional mode (SCIP_INDEXER=true in ~/.codegraphcontext/.env) where some languages use external SCIP indexers — scip-clang for C/C++ (needs compile_commands.json) and scip-dotnet for C# — for more accurate calls and inheritance than tree-sitter heuristics alone. It falls back to tree-sitter when unavailable.
Alternatives to CodeGraphContext
Compare all alternatives →Microsoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).
Up-to-date, version-specific library documentation injected into your coding agent.
LSP-powered coding agent toolkit: semantic symbol search, references and structural edits.
Compare CodeGraphContext with: