# Graph Indexer for Cursor

> Add Graph Indexer to Cursor with npx graph-indexer init: it writes .cursor/mcp.json so Cursor gets exact references and call graphs from a local index.

Graph Indexer for Cursor is a local MCP server that gives Cursor's agent exact references, call graphs and change impact for your project. Run `npx graph-indexer init` and it writes `.cursor/mcp.json` with a `graph-indexer` server, then adds a short instructions block to `AGENTS.md`.

## How do I add Graph Indexer to Cursor?

From the repository root, with Node.js 22.5 or later:

```bash
npx graph-indexer init
```

`init` configures Cursor when it finds a `.cursor` directory or a `.cursorrules` file. If Cursor is not detected, force it with `npx graph-indexer init --agents cursor`, or configure every supported agent at once with `--all`.

## What does `npx graph-indexer init` change for Cursor?

For Cursor, `init` touches two files plus `.gitignore`:

| File | Content |
|---|---|
| `.cursor/mcp.json` | A `graph-indexer` entry under `mcpServers`, merged with existing servers |
| `AGENTS.md` | A managed block with the lookup rules and when to call `find_references`, `call_graph`, `change_impact` and `check_changes` |
| `.gitignore` | `.graph-indexer/`, where the local index lives |

Use `--dry-run` to preview the changes and `--no-instructions` to skip the `AGENTS.md` block.

## What does the manual Cursor configuration look like?

The entry `init` writes to `.cursor/mcp.json` is:

```json
{
  "mcpServers": {
    "graph-indexer": {
      "command": "npx",
      "args": ["-y", "graph-indexer@3", "serve", "--repo", "${workspaceFolder}"]
    }
  }
}
```

If you run Graph Indexer from a local checkout, `init --local` writes the absolute paths of Node.js and of that checkout's `bin/graph-indexer.mjs` instead of `npx`.

## Does Cursor run the Graph Indexer hooks?

Partly, and only if you opt in. `npx graph-indexer init --hooks` writes the hooks to `.claude/settings.json`, and the Graph Indexer README notes that Cursor also runs those Claude Code hooks. The hook command answers Cursor's camelCase events with Cursor's own `additional_context` field. Hooks are optional: the MCP tools work without them.

## What does Cursor gain from Graph Indexer?

Cursor's agent gets eight read-only tools over stdio. The ones that change its behaviour most:

- `find_references` returns every use of a symbol, bound through scopes, imports and receiver types, grouped by file and enclosing function. It says whether the list is complete.
- `call_graph` shows callers and callees across files, with confidence per edge.
- `change_impact` returns dependents by distance and the tests to run before you change a signature.
- `check_changes` flags syntax errors, calls that no longer fit and removed names still in use, without a build.

Against the TypeScript compiler on 400 nestjs symbols, `find_references` reached 99.7% precision and 96.2% recall, where grep reached 12.8% precision. Graph Indexer is not a type checker: generics, reflection, `any` and dependency-injection tokens are only partly visible. See [the tools reference](/tools/) and [how it works](/how-it-works/).

## Frequently asked questions

### Why does the Cursor entry use ${workspaceFolder}?

Passing --repo ${workspaceFolder} points Graph Indexer at the workspace open in Cursor, so the server indexes that project and not whichever directory the editor happens to start it from.

### Where do the lookup instructions go for Cursor?

init adds its managed block to AGENTS.md, which Cursor reads, not to a Cursor rules file. The block sits between graph-indexer:start and graph-indexer:end markers, so re-running init updates it in place.

### Does Graph Indexer replace Cursor's own codebase search?

No. It adds exact tools alongside it. Cursor's search is for finding where something lives; find_references and call_graph answer which call sites are real, which a name search cannot tell apart.

### Can I use it in a monorepo with Cursor?

Yes. The Twenty CRM monorepo with 28,512 files was indexed in 51 seconds at 99.9% precision and 92.4% recall for references. Later syncs of unchanged code took 1.8 seconds.

---

Updated: 2026-10-08 · Graph Indexer 3.0.0 · https://graph-indexer.vercel.app/agents/cursor/
