discover_codegraph_contextsLABSCO SUMMARY
A path sandbox is on by default, which is unusual and welcome.
Anything that indexes is restricted to the server's working directory unless CGC_ALLOWED_ROOTS names more, so a stray instruction cannot point it at your home folder. The graph is what the tools are for: dead code and cyclomatic complexity are queries over structure, not text searches, and execute_cypher_query is there for the questions nobody wrote a tool for.
What it is
A code-graph server. It parses repositories with tree-sitter into a graph database, then exposes that graph to an agent: relationships between symbols, complexity metrics, and raw Cypher when the shaped tools are not enough. The embedded database is the default, so there is nothing to run alongside it.
What you get
- Local folders and installed packages indexed into the graph, with repositories listed, removed and counted —
add_code_to_graph,add_package_to_graph,list_indexed_repositories,delete_repository,get_repository_stats - Keyword search over indexed symbols and content, with fuzzy matching and an edit distance —
find_code - Relationship analysis across files, dead code detection, cyclomatic complexity, and the most complex functions ranked —
analyze_code_relationships,find_dead_code,calculate_cyclomatic_complexity,find_most_complex_functions - Raw Cypher against the graph, with query visualisation and report generation —
execute_cypher_query,visualize_graph_query,generate_report - Directories watched for changes, so the graph stays current —
watch_directory,list_watched_paths,unwatch_directory - Job control for long indexing runs —
list_jobs,check_job_status - Java Spring specifics: endpoints, beans and datasource nodes —
find_java_spring_endpoints,find_java_spring_beans,find_datasource_nodes - Multi-project handling: discover indexed contexts in sub-directories and switch the session between them —
discover_codegraph_contexts,switch_context - Package indexing across python, javascript, typescript, java, c, go, ruby, php and cpp
Requirements
pip install codegraphcontext. The database is embedded by default — FalkorDB Lite, with KuzuDB as a cross-platform alternative and Neo4j available through codegraphcontext neo4j setup if you want an external server. Indexing, bundle load, watch and context-switch tools only accept paths under the server's working directory plus whatever you list in CGC_ALLOWED_ROOTS, colon-separated on Linux and macOS, semicolon-separated on Windows. A Docker image is published. Version 0.6.5.
Setup effort
One command — pip install codegraphcontext
USE CASES
Working out what a change will break
Index the repository, then analyse the relationships around the symbol you are about to change to see what depends on it.
Finding what to delete in a codebase nobody has pruned
Run dead-code detection over the graph and rank the most complex functions, so cleanup starts where it pays.
Asking a structural question nobody built a tool for
Write Cypher against the graph directly and visualise the result, instead of waiting for a shaped tool to exist.
Keeping the graph honest while you work
Watch the project directory so edits re-index automatically, and check job status when a large indexing run is in flight.
Jumping between projects in one editor window
Discover the indexed contexts under the parent directory and switch the session to the sub-project you actually opened.
25 tools
Listed in project docs. Your client may show a different list.
switch_contextadd_code_to_graphadd_package_to_graphlist_indexed_repositoriesdelete_repositoryget_repository_statsfind_codeanalyze_code_relationshipsfind_dead_codecalculate_cyclomatic_complexityfind_most_complex_functionsload_bundlesearch_registry_bundleswatch_directorylist_watched_pathsunwatch_directorylist_jobscheck_job_statusexecute_cypher_queryvisualize_graph_querygenerate_reportfind_java_spring_endpointsfind_java_spring_beansfind_datasource_nodesBEFORE YOU INSTALL
What to know first
Tools you get
25 tools named in the project's documentation.
Requires
- codegraphcontext on PATH
- Python 3.10 or later
INSTALLATION
Connect your client
Server setup
pip install codegraphcontextMCP Clients
Any MCP client — setup wizard
cgc mcp setupClaude Desktop
{
"mcpServers": {
"codegraphcontext": {
"command": "cgc",
"args": [
"mcp",
"start"
]
}
}
}Cursor
Open Cursor Settings (Preferences / Settings → Features → MCP)
Click + Add New MCP Server
Enter these fields — Name: CodeGraphContext, Type: command, Command: cgc mcp start
Click Save
Any MCP client — pipx
{
"mcpServers": {
"CodeGraphContext": {
"command": "pipx",
"args": [
"run",
"codegraphcontext",
"mcp",
"start"
],
"disabled": false,
"alwaysAllow": []
}
}
}