# codegraph [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/lzehrung/codegraph  
**GitHub Stars:** 11  
**Views:** 4  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/codegraph-3

## Description
CLI, MCP and TS library that turns source code into a map of files, symbols, references, and dependencies using tree-sitter.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/lzehrung/codegraph), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
npm install -g @lzehrung/codegraph
```

2. Install:

```sh
codegraph install
```

3. Install:

```sh
irm https://github.com/lzehrung/codegraph/releases/latest/download/install.ps1 | iex
```

4. Install:

```sh
curl -fsSL https://github.com/lzehrung/codegraph/releases/latest/download/install.sh | sh
```

## Documentation

## What codegraph does

codegraph builds a repository map from source code, covering files, symbols, references, and dependencies. Its MCP interface makes that structural information available to coding agents working against a local repository. The project also ships as a CLI and TypeScript library, so the same analysis can be used directly without an agent.

The repository map is intended to answer questions such as where an implementation lives, which files depend on a symbol, what a change might affect, and which tests are plausible validation targets. Results can include source evidence and next steps bounded to the relevant parts of the codebase.

codegraph complements rather than replaces other developer tools. Text search is still useful for exact strings, while compilers establish language behavior; codegraph supplies the relationships between files and symbols that those tools do not represent as a repository map.

## How it works

Source files are parsed with tree-sitter and converted into a resolved model of repository relationships. The model can represent symbol definitions, references, dependencies, reverse dependencies, exports, and candidate tests. The CLI can search for terms, bundle search hits with related source and dependents, inspect individual targets, and calculate broader change impact.

Analysis can be performed against a working tree or compared across revisions. Review and impact commands summarize changed symbols and possible blast radius, while affected-test analysis derives test paths from changed files and reverse dependencies. Additional inspections identify dependency cycles, unresolved items, highly connected files, duplicate code, undocumented exported symbols, and broken local Markdown links.

The graph can also be exported as JSON, SQLite, Mermaid, or DOT. A packaged viewer presents a human-facing graph UI, while agents are directed toward graph JSON, SQLite, MCP, or structured JSON output instead.

## Setup and configuration

The package requires Node.js 22.16 or newer. Install it globally from npm with:

```bash
npm install -g @lzehrung/codegraph
```

After installation, `codegraph doctor` checks the local setup and `codegraph install` performs the project’s installation step. A typical repository exploration starts with:

```bash
codegraph explore "build review report" --root .
```

Standalone shell and PowerShell installers are also available. They download a self-contained bundle containing Node.js, the CLI, and the matching native runtime. Repository operations accept a root directory, and many commands support JSON output for structured consumption.

## Tools and capabilities

- Explore a repository by combining lexical search with source, dependents, and candidate tests.
- Explain files or targets, inspect semantic references, and list direct or reverse dependencies.
- Review changes, calculate impact, and identify affected test paths between revisions.
- Preview refactoring evidence and rename effects without applying code changes.
- Inspect API surfaces, undocumented exports, cycles, unresolved relationships, hotspots, and duplicate groups.
- Export repository graphs to JSON, SQLite, Mermaid, or DOT, or inspect them in the packaged viewer.

## Limitations and notes

codegraph is not an AST, compiler, or linter. Its output should be used alongside exact text search and compiler checks rather than as a substitute for either. Search queries are lexical, so terms that appear in the code produce the most useful results.

The graph viewer is intended for people, whereas agents should use MCP, graph JSON, SQLite, or structured CLI output. Refactoring and rename-preview operations provide read-only evidence and do not modify source files. External URLs are skipped by the Markdown-link checker, which focuses on local links.

_Full upstream README: https://allmcps.com/mcp/codegraph-3/readme_

