A local-first engine that indexes code, docs, PDFs, and schemas into a queryable graph — then exposes structured context to AI agents through an MCP server.
ContextGraph extracts structure and semantics from every file type and stitches them into a single connected store.
Index Kotlin, Java, Python, JS, Markdown, SQL, PDFs, and YAML in one pass. Incremental re-indexing skips unchanged files via checksums.
Expose 10 graph tools to Claude, Cursor, and any MCP-compatible agent. Agents search, traverse, and build context without reading every file.
Route files through any LiteLLM-compatible model to extract concepts, decisions, and relationships that static analysis can't see.
The graph lives in .contextgraph/graph.db. No cloud, no accounts. Data never leaves your machine unless you say so.
BFS expansion, shortest-path queries, and reverse dependency analysis — powered by JGraphT on top of SQLite FTS5.
Every node traces back to its source file and line number. Ask "where did this concept come from?" and get an exact answer.
Run serve-mcp to expose the knowledge graph to any MCP-compatible agent — Claude, Cursor, Copilot. Agents navigate relationships and build context bundles without reading every file.
Requires Java 17+.
# Clone and build
git clone https://github.com/erenalpaslan/context-graph
cd context-graph && ./gradlew build
# Init + index your project
./gradlew :modules:cli:run --args="init"
./gradlew :modules:cli:run --args="index /path/to/your/project"
# Search
./gradlew :modules:cli:run --args='search "authentication"'
# Start MCP server for AI agents
./gradlew :modules:cli:run --args="serve-mcp"