Quick Start

Get ContextGraph running and your first project indexed in under five minutes.

Prerequisites

1. Clone and build

Terminal
git clone https://github.com/erenalpaslan/context-graph
cd context-graph
./gradlew build

2. Initialize your project

Run init inside the project you want to index. This creates the .contextgraph/ directory and a default config file.

Terminal
cd /path/to/your/project
/path/to/context-graph/gradlew \
  -p /path/to/context-graph \
  :modules:cli:run --args="init"
Tip
For convenience, create an alias: alias contextgraph="./gradlew :modules:cli:run --args="

3. Index your project

Point the indexer at your project directory. It will discover all supported files, extract nodes and edges, and write them to .contextgraph/graph.db.

Terminal
./gradlew :modules:cli:run --args="index /path/to/your/project"

# Output:
# Indexing /path/to/your/project...
# Done: 142 artifacts, 891 nodes, 1204 edges
#   Skipped (unchanged): 0

4. Search the graph

Terminal
./gradlew :modules:cli:run --args='search "authentication"'

# 8 results for 'authentication':
#   [Class]    AuthController  id=io.example.AuthController  confidence=1.0
#   [Function] authenticate    id=io.example.AuthController.authenticate  confidence=1.0
#   [Concept]  JWT Strategy    id=concept:jwt-strategy  confidence=0.85
#   ...

5. Generate a report

Generates GRAPH_REPORT.md (Markdown summary) and graph.html (interactive D3.js visualization) in the current directory.

Terminal
./gradlew :modules:cli:run --args="report"

6. Connect to an AI agent

Start the MCP server so agents like Claude Desktop can query the graph directly.

Terminal
./gradlew :modules:cli:run --args="serve-mcp"

Add ContextGraph to your Claude Desktop config:

claude_desktop_config.json
{
  "mcpServers": {
    "contextgraph": {
      "command": "/path/to/context-graph/gradlew",
      "args": ["-p", "/path/to/context-graph", ":modules:cli:run", "--args=serve-mcp"]
    }
  }
}