
How to add CodeGraphContext to Cursor
Index local code into a graph database to give AI assistants deep, queryable code context. Paste the config into ~/.cursor/mcp.json and restart Cursor.
Last updated June 14, 2026 · 3.8k★ · stdio · no auth
Cursor config for CodeGraphContext
pip install codegraphcontext{
"mcpServers": {
"codegraphcontext": {
"command": "codegraphcontext",
"args": [
"mcp",
"start"
],
"env": {
"NEO4J_URI": "YOUR_NEO4J_URI",
"NEO4J_USERNAME": "YOUR_NEO4J_USERNAME",
"NEO4J_PASSWORD": "YOUR_NEO4J_PASSWORD"
}
}
}
}Setup steps
- 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
- 2Paste the CodeGraphContext config below into the "mcpServers" object.
- 3Fill in placeholder secrets, then save.
- 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
- 5Ask Cursor to use one of CodeGraphContext's tools to confirm it's connected.
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`
What CodeGraphContext can do in Cursor
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.
Security
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 + Cursor FAQ
Where is the Cursor config file?
Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the CodeGraphContext config there under the "mcpServers" key and restart the client.
Is CodeGraphContext safe to use with Cursor?
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.
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`.