Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 53 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
npx @colbymchenry/codegraph
```

<sub>Interactive installer configures Claude Code automatically</sub>
<sub>Interactive installer configures Claude Code and Cursor automatically</sub>

</div>

Expand Down Expand Up @@ -69,35 +69,35 @@ We ran the same complex task 3 times with and without CodeGraph:
### 🔄 How It Works

```
┌─────────────────────────────────────────────────────────────────┐
┌─────────────────────────────────────────────────────────────────
│ Claude Code │
│ │
│ "Implement user authentication" │
│ │ │
│ ▼ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Explore Agent │ ──── │ Explore Agent │ │
│ └────────┬────────┘ └────────┬────────┘ │
│ ┌─────────────────┐ ┌─────────────────┐
│ │ Explore Agent │ ──── │ Explore Agent │
│ └────────┬────────┘ └────────┬────────┘
│ │ │ │
└───────────┼────────────────────────┼─────────────────────────────┘
│ │
▼ ▼
┌──────────────────────────────────────────────────────────────────
│ CodeGraph MCP Server
┌──────────────────────────────────────────────────────────────────┐
│ CodeGraph MCP Server │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Search │ │ Callers │ │ Context │ │
│ │ "auth" │ │ "login()" │ │ for task │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │
│ └────────────────┼────────────────┘
│ ▼
│ ┌───────────────────────┐
│ │ SQLite Graph DB │
│ │ • 387 symbols │
│ │ • 1,204 edges │
│ │ • Instant lookups │
│ └───────────────────────┘
└──────────────────────────────────────────────────────────────────
│ │ │ │ │
│ └────────────────┼────────────────┘ │
│ ▼ │
│ ┌───────────────────────┐ │
│ │ SQLite Graph DB │ │
│ │ • 387 symbols │ │
│ │ • 1,204 edges │ │
│ │ • Instant lookups │ │
│ └───────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘
```

**Without CodeGraph:** Explore agents use `grep`, `glob`, and `Read` to scan files → many API calls, high token usage
Expand Down Expand Up @@ -162,15 +162,16 @@ npx @colbymchenry/codegraph
```

The interactive installer will:
- Configure the MCP server in `~/.claude.json`
- Set up auto-allow permissions for CodeGraph tools
- Add global instructions to `~/.claude/CLAUDE.md` (teaches Claude how to use CodeGraph)
- Ask which IDE(s) to configure (Claude Code, Cursor, or both)
- Configure the MCP server (`.claude.json` and/or `.cursor/mcp.json`)
- Set up auto-allow permissions for CodeGraph tools (Claude Code)
- Add instructions to teach your IDE how to use CodeGraph
- Install Claude Code hooks for automatic index syncing
- Optionally initialize your current project

### 2. Restart Claude Code
### 2. Restart Your IDE

Restart Claude Code for the MCP server to load.
Restart Claude Code or Cursor for the MCP server to load.

### 3. Initialize Projects

Expand All @@ -181,7 +182,9 @@ cd your-project
codegraph init -i
```

That's it! Claude Code will now use CodeGraph tools automatically when a `.codegraph/` directory exists.
That's it! Your IDE will now use CodeGraph tools automatically when a `.codegraph/` directory exists.

> **Note for Cursor users:** CodeGraph MCP tools are only available in **Agent mode**, not in Composer.

<details>
<summary><strong>Manual Setup (Alternative)</strong></summary>
Expand All @@ -193,12 +196,11 @@ If you prefer manual configuration:
npm install -g @colbymchenry/codegraph
```

**Add to `~/.claude.json`:**
**Add to `~/.claude.json` or `./.cursor/mcp.json`:**
```json
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": ["serve", "--mcp"]
}
Expand Down Expand Up @@ -296,21 +298,34 @@ codegraph serve --mcp # Start MCP server

### `codegraph` / `codegraph install`

Run the interactive installer for Claude Code integration. Configures MCP server and permissions automatically.
Run the interactive installer for IDE integration. Configures MCP server and permissions automatically.

```bash
codegraph # Run installer (when no args)
codegraph install # Run installer (explicit)
npx @colbymchenry/codegraph # Run via npx (no global install needed)
```

The installer will:
1. Ask for installation location (global `~/.claude` or local `./.claude`)
2. Configure the MCP server in `claude.json`
3. Optionally set up auto-allow permissions
4. Add global instructions to `~/.claude/CLAUDE.md` (teaches Claude how to use CodeGraph)
5. Install Claude Code hooks for automatic index syncing
6. For local installs: initialize and index the current project
# Interactive mode (prompts for IDE selection and location)
codegraph # Run installer (when no args)
codegraph install # Run installer (explicit)
npx @colbymchenry/codegraph # Run via npx (no global install needed)

# Non-interactive mode (skip prompts)
codegraph install --ide=claude --location=local # Claude Code only (local)
codegraph install --ide=cursor # Cursor only (always local)
codegraph install --ide=all --location=local # Both IDEs (local)
codegraph install --ide=claude,cursor # Both IDEs (prompts for location)
```

**Interactive installer flow:**
1. Asks which IDE(s) to configure (Claude Code, Cursor, or both)
2. Asks for installation location (global or local) - defaults to local
3. Configures the MCP server (`.claude.json` and/or `.cursor/mcp.json`)
4. Sets up auto-allow permissions (Claude Code only)
5. Adds instructions to teach your IDE how to use CodeGraph
6. Installs Claude Code hooks for automatic index syncing
7. For local installs: optionally initializes and indexes the current project

**Non-interactive mode:**
- Useful for CI/CD pipelines and scripts
- Auto-detects non-TTY shells and uses defaults
- Can specify IDE(s) and location via flags to skip all prompts

### `codegraph init [path]`

Expand Down
Loading