# GitNexus — Code Intelligence Setup Guide

Canonical: https://mygearhut.com/articles/guides/gitnexus-guide
Author: Miraz (https://www.miraz.dev/about)
Published: 2026-09-20
Category: guides
Editorial policy: https://mygearhut.com/editorial

Index any repo into a local knowledge graph and wire GitNexus MCP into Cursor or Claude Code — impact analysis, call chains, and safer agent edits.

## Why agents need a map


LLM coding tools see files, not architecture. They rename a function without knowing forty callers exist. **GitNexus** indexes a repository into a **local knowledge graph** — dependencies, call chains, clusters, execution flows — and exposes it via **MCP tools** so agents query structure before editing.


Zero-server option: Web UI runs in-browser for exploration. For daily agent work, MyGearHut recommends **CLI + MCP** on repos you actively ship.


Project: `github.com/abhigyanpatwari/GitNexus` · Web demo: `gitnexus.vercel.app`


## Two ways to use GitNexus


| Mode | Best for |
|------|----------|
| **Web UI** | Quick tour of unfamiliar OSS repos |
| **CLI + MCP** | Cursor, Claude Code, Windsurf — production agent loops |


This guide focuses on CLI + MCP.


## Prerequisites

- Node.js 18+ and npm
- Git repo on disk
- MCP-capable editor (Cursor, Claude Code, etc.)

## Install CLI


```bash
npm install -g gitnexus
```


Verify:


```bash
gitnexus --version
```


## One-time MCP setup


From any directory:


```bash
gitnexus setup
```


This detects installed editors, registers MCP servers, may add hooks for Claude Code, and can scaffold `AGENTS.md` / `CLAUDE.md` snippets — review diffs before committing.


## Index your repository


```bash
cd ~/projects/my-app
gitnexus analyze
```


Force full rebuild after large refactors:


```bash
gitnexus analyze --force
```


Index data lives under `.gitnexus/` in the repo — add to `.gitignore` if you do not want it committed (team policy call).


## MCP tools agents gain (core set)


| Tool | What it does |
|------|----------------|
| `query` | Hybrid search — find symbols, flows, processes |
| `context` | 360° view of a symbol — refs, callers, clusters |
| `impact` | Blast radius — what breaks if you change X |
| `detect_changes` | Map git diff → affected processes |
| `rename` | Coordinated multi-file rename using graph |
| `cypher` | Raw graph queries (power users) |
| `list_repos` | All indexed repos on your machine |


Exact tool count grows between releases — run MCP catalog in your editor after updates.


## Wire into Claude Code / Cursor


After `gitnexus setup`, restart the editor. Confirm MCP server **gitnexus** is connected (green in MCP panel).


**Starter prompt once indexed:**


```plain text
Before editing, use GitNexus impact tool on [function/module].
Summarize callers and risk. Then propose a minimal plan.
Do not edit until I approve.
```


Agents with graph access make fewer "surprise breakages."


## Local backend + Web UI (optional)


Serve all indexed repos without re-uploading:


```bash
gitnexus serve
```


Open the Web UI — it detects the local server. Chat exploration uses the same graph; good for onboarding teammates.


Manual MCP stdio mode:


```bash
gitnexus mcp
```


Editors usually manage this via `setup`; manual mode helps debugging.


## Daily operator workflows


### Pre-refactor

1. `gitnexus analyze` if index stale
2. Ask agent: `impact` on symbol
3. Plan mode → implement → run tests

### Pre-commit


```plain text
Use detect_changes on my current git diff.
List affected processes I should retest.
```


### Onboarding to legacy codebase

1. Index repo
2. Web UI or agent `query` for entrypoints
3. Document findings in team `CLAUDE.md`

## Performance notes

- Large monorepos: first index takes time; incremental updates are faster
- Web-only mode is browser-memory limited (~thousands of files)
- CLI local index scales better for daily agent use

Check license (PolyForm Noncommercial for upstream) before commercial redistribution. **Fixes:** MCP missing → `gitnexus setup` + restart editor; stale graph → `analyze --force`; wrong repo → `list_repos` and explicit `repo` param.


## Pair with MyGearHut stack

- [Claude Code From Zero](https://mygearhut.com/articles/guides/claude-code-from-zero) — agent basics first
- [Two-Model Code Review](https://mygearhut.com/articles/guides/two-model-code-review) — graph-informed review pass
- [Boris Cherny Principles](https://mygearhut.com/articles/guides/boris-claude-principles) — plan before blast-radius edits

## Copy-paste CLAUDE.md block


```markdown
## GitNexus
- Run impact/detect_changes before multi-file refactors
- Index refreshed weekly or after architecture changes
- Prefer graph-backed rename over manual search-replace
```


---


**Safer agent edits start with a map.** More setup guides in the [MyGearHut free library](https://mygearhut.com/articles/guides) — **The Gear Drop** for MCP and agent ops updates.
