Quick Start

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

Prerequisites

1. Clone and build the launcher

installDist produces a native launcher script, so every later command runs directly instead of paying a Gradle startup.

Terminal
git clone https://github.com/erenalpaslan/context-graph
cd context-graph
./gradlew :modules:cli:installDist

# Put it on your PATH
export PATH="$PWD/modules/cli/build/install/contextgraph/bin:$PATH"

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
contextgraph init

3. Index your project

The indexer discovers supported files, parses source to a tree-sitter AST, resolves references between symbols, and writes nodes and edges to .contextgraph/graph.local.db.

Terminal
contextgraph index .

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

Later, contextgraph refresh re-parses only what changed. If you would rather not think about it at all, enable the watcher: contextgraph config set watcher.enabled true then contextgraph watch.

4. Search the graph

Terminal
contextgraph 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
contextgraph report

6. Connect to an AI agent

Start the MCP server so agents can query the graph directly. The tool that matters is contextgraph.explore: one call, one natural-language question, and the answer comes back with verbatim source rather than pointers to go read.

Terminal
contextgraph serve-mcp

Add ContextGraph to your client config — point it at the launcher, not at Gradle:

claude_desktop_config.json
{
  "mcpServers": {
    "contextgraph": {
      "command": "/path/to/context-graph/modules/cli/build/install/contextgraph/bin/contextgraph",
      "args": ["serve-mcp"]
    }
  }
}

See the MCP Server reference for every tool, resource and prompt the server exposes.