Loading...
Loading...
A knowledge graph is a structured map of relationships in your codebase. Instead of treating files as isolated text, it understands that UserCard.tsx imports from types.ts, calls getUser() from db.ts, and is rendered by ProfilePage.tsx.
Without a knowledge graph, Claude searches for files by name and guesses at relationships. With one, it can answer questions like "what breaks if I change this interface?" or "which components depend on this utility function?" This is the difference between a text editor and an IDE.
The code-review-graph MCP server is the most practical way to add knowledge graph capabilities to Claude Code. Installation takes three steps:
.mcp.json configuration file so Claude loads it automaticallyThe indexing process parses your source files, extracts imports, exports, function calls, and type references, then stores them as nodes and edges in a local database.
Once installed, the graph builder walks your project tree and creates nodes for every file, function, class, type, and export. Edges represent relationships: imports, calls, extends, implements, and renders. A typical Next.js project with 50 files generates thousands of edges.
Configure which directories to include and exclude. You want src/ indexed but not node_modules/ or .next/. Keep the graph focused on code you actually maintain.
The real power is in queries. Ask the graph "what depends on User type?" and get every file that imports or references it. Ask "what does auth.ts export?" and get a complete list of its public API. These queries replace manual grep searches with structured, relationship-aware lookups.
Claude can use these queries automatically during code review to check whether a proposed change affects downstream consumers. This catches breaking changes before they ship.
Impact analysis is the killer feature. Before modifying a function signature, query the graph to find every caller. Before renaming a type, find every file that references it. Before deleting a component, confirm nothing renders it.
Without impact analysis, refactoring is guesswork. You rename a function, deploy, and discover three pages broke because they were calling the old name. With a knowledge graph, Claude shows you every affected file before you make the change.
Set up a knowledge graph for your project and run your first queries:
code-review-graph to your .mcp.json and verify it loads in your next Claude sessionsrc/ directory and check the node and edge countstypes.ts or utils.ts)Want automated graph updates? The AI Brain Pro package includes hooks that re-index your knowledge graph on every commit so it never goes stale. View pricing →