claude-graph
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@claude-graphwhat calls the parse_file function"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
claude-graph
A local knowledge graph for Claude Code — structural code intelligence with zero network calls.
Answer structural questions about your codebase in a single MCP tool call — without sending a single byte of code to the cloud.
Why claude-graph?
Claude Code answers structural questions ("what calls this?", "what breaks if I change this file?") by reading source files into context. On any non-trivial codebase that means:
Hundreds of files that may not fit in the context window
Thousands of tokens spent on code Claude won't actually use
No answer at all for repos larger than the context window
claude-graph solves this by building a persistent call graph (functions → calls → functions, files → imports → files, tests → tests_for → source) stored in a local SQLite database. Claude issues a single MCP tool call and gets back only the relevant nodes and edges — typically 7× to 236× fewer tokens than reading the source files directly.
Everything happens on your machine. No embeddings, no cloud API, no telemetry — ever.
Related MCP server: better-code-review-graph
Real benchmark — Django (3,040 files)
Built with
claude-graph buildon a shallow clone of Djangomain.
Build time: 17 seconds
Files: 3,040
Nodes: 45,096 (functions + classes + modules)
Edges: 938,763 (calls + imports + tests_for)Query | Tokens — naive (send matching files) | Tokens — claude-graph | Reduction |
| 112,991 | 15,455 | 7× less |
| 92,539 | 3,143 | 29× less |
| 46,032 | 5,278 | 8× less |
| 155,915 | 659 | 236× less |
Dumping the full Django source naively = 1,475,429 tokens — 7.4× Claude's 200k context window. Claude cannot answer structural questions about Django at all without a tool like this.
Quick start
# 1. Install
pip install claude-graph
# 2. Wire it into your project (writes .mcp.json + .claude/skills/)
cd /path/to/your/project
claude-graph install
# 3. Build the graph
claude-graph buildRestart Claude Code (or run /mcp to confirm claude-graph is connected), then ask:
"What calls
save()in this repo?" "What breaks if I changeauth/middleware.py?" "Isparse_filecovered by tests?"
Features
🔍 Structural queries
Ask Claude things it couldn't answer without reading the entire repo:
Query pattern | What it returns |
| Every function that calls |
| Every function that |
| Every file that imports |
| Test files linked to |
| All symbols defined in |
| Fuzzy search over all function/class names |
📡 Impact radius
Changed a file? Get the blast radius instantly:
claude-graph query callers_of parse_file
# or let Claude Code call get_impact_radius_tool automatically🗺️ Interactive visualization
claude-graph viz # whole graph (capped at 500 nodes)
claude-graph viz --symbol HttpResponse # direct neighborhood of a symbol
claude-graph viz --impact db/models.py # visual blast radius of a file
claude-graph viz --max-nodes 0 # uncapped (may be slow on large repos)The viz renders a self-contained HTML file — no server, works fully offline. Features:
Force-directed D3 layout with drag, zoom, and pan
Click any node to highlight its direct neighborhood + see file/line
Filter panel to toggle node kinds (function / class / module) and edge kinds (calls / imports / tests_for) live
Translucent file-cluster hulls grouping nodes that share a file
Search box to find any node by name
👁️ File watcher
pip install "claude-graph[watch]"
claude-graph watch # auto-rebuilds incrementally on every file change🩺 Health check
claude-graph doctorVerifies grammars, FTS5, git access, MCP wiring, and graph existence — with a pass/fail table and exit code.
Zero network calls
Built for corporate and regulated environments with one hard requirement: everything stays on your machine.
No embeddings, no vector index, no model downloads
No cloud API calls — not even for tokenization
No telemetry, no daemon, no background process
No home-directory writes — everything lives inside your repo (
.claude-graph/,.mcp.json,.claude/skills/)Nothing runs automatically — you or Claude Code call
build_or_update_graphexplicitly
See tests/test_no_network.py for the automated proof: a full build + query + viz + MCP startup cycle with outbound sockets disabled.
MCP tools (used by Claude Code automatically)
Tool | What it does |
| Full build if no graph exists, incremental update otherwise |
| Node / edge / file counts and detected languages |
|
|
| Blast radius of a set of changed files |
| Keyword search over function/class names and signatures |
| Render the graph (or a scoped neighborhood) to a local HTML file |
CLI reference
Command | What it does |
| Full parse of every git-tracked file |
| Re-parses only files changed since the last build |
| Node / edge / file counts ( |
| Writes |
| Starts the MCP server (stdio) — Claude Code launches this itself |
| Interactive HTML graph, opens in browser |
| Auto-rebuild on file change (requires |
| Health check with pass/fail table |
| Run a structural query from the CLI |
| Keyword search from the CLI |
Every command accepts --repo PATH to target a repo other than $CWD.status, install, viz, doctor, query, and search accept --json.
Supported languages
31 built in. Powered by tree-sitter-language-pack which bundles 306 grammars — add any of them with a single .claude-graph/languages.toml entry, no code change needed.
Language | Extensions | |
Python |
| |
JavaScript |
| |
TypeScript |
| |
TSX |
| |
Go |
| |
Rust |
| |
Java |
| |
C# |
| |
Ruby |
| |
C |
| |
C++ |
| |
Swift |
| |
Kotlin |
| |
Scala |
| |
PHP |
| |
Dart |
| |
Elixir |
| |
Bash / Zsh |
| |
Lua |
| |
Zig |
| |
Dockerfile |
| |
HCL / Terraform |
| |
Nix |
| |
CMake |
| |
Solidity |
| |
CUDA |
| |
R |
| |
Julia |
| |
Gleam |
| |
Cairo |
|
Adding a language: drop a .claude-graph/languages.toml into your repo. See claude_graph/default_languages.toml for the schema (extensions, grammar name, node types for functions/classes/imports/calls).
Install options
pip (recommended)
pip install claude-graph
# With file-watching support
pip install "claude-graph[watch]"Docker
docker pull ghcr.io/mohansagark/claude-graph:latest
docker run --rm -v "$PWD:/repo" ghcr.io/mohansagark/claude-graph build
docker run --rm -v "$PWD:/repo" ghcr.io/mohansagark/claude-graph viz --symbol MyClassFrom source
git clone https://github.com/mohansagark/claude-graph.git
cd claude-graph
pip install -e .From a release asset (no PyPI)
Each GitHub Release ships a wheel as a downloadable asset:
pip install https://github.com/mohansagark/claude-graph/releases/download/v0.2.3/claude_graph-0.2.3-py3-none-any.whlRequirements
Python 3.11+
git
macOS, Linux, or Windows
How call resolution works
A
callsedge's source is always a function-kind node — only functions/methods make calls.A
callsedge's target prefers a function match; if none exists, falls back to a class match (instantiation, e.g.Foo()).One edge per call site — if
bar()is called twice, you get two edges. Call frequency is preserved.Cross-file resolution is name-based: a call to
save()matches every function namedsavein the graph. This is a deliberate precision/recall trade-off — better to surface too many candidates for Claude to disambiguate than to miss a real caller.
Known limitations
Name-based call resolution — cross-file calls match by name only, not by scope. Highly common names (
save,get,run) produce over-broad results on large repos.tests_forlinking — naming convention + imports only (test_foo.py↔foo.py,foo.spec.ts↔foo.ts). Tests that don't follow a convention aren't linked.Import resolution — best-effort path matching, not real module resolution. Won't follow
tsconfig.jsonpath aliases or Python namespace packages.Incremental edge re-linking —
claude-graph updateonly re-links edges for changed files. Moving a symbol to another file keeps stale cross-file edges until the next fullclaude-graph build.
Contributing
git clone https://github.com/mohansagark/claude-graph.git
cd claude-graph
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytestReleasing (maintainers)
Bump version in pyproject.toml, then cut a GitHub Release. Publishing the release triggers .github/workflows/publish.yml which uploads to PyPI via OIDC trusted publishing and pushes the Docker image to GHCR — no API tokens stored in this repo.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceCode dependency graph and AI context engine. 10 MCP tools that give Claude, Cursor, and any MCP client full codebase context — impact analysis, dependency tracing, architecture summaries, and interactive arc diagram visualization. Supports TypeScript, JavaScript, Python, and Go.Last updated241,20759Business Source 1.1
- AlicenseBqualityAmaintenanceKnowledge graph for token-efficient code reviews. Builds a structural map of your codebase with Tree-sitter, tracks changes incrementally, and gives AI agents precise context via MCP tools. Features fixed multi-word search, qualified call resolution, dual-mode embedding (ONNX local + LiteLLM cloud), and output pagination.Last updated765MIT
- Alicense-qualityFmaintenanceLiving typed knowledge graph for software projects, exposed over MCP so coding assistants can capture and query modules, capabilities, flows, events, rules and decisions across sessions. SQLite-backed, schema-validated, ships as a Claude Code plugin.Last updatedMIT
- Alicense-qualityCmaintenanceA local, SQLite-backed code index for Claude Code, exposed over MCP, enabling targeted code retrieval without external APIs.Last updated1MIT
Related MCP Connectors
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mohansagark/claude-graph'
If you have feedback or need assistance with the MCP directory API, please join our Discord server