repo2diagram
Can analyze GitHub repositories by owner/repo or URL and, through the GitHub Action, posts architecture-impact diagrams and blast-radius reports as pull request comments.
Uses local Ollama models to generate module labels for the architecture diagram, keeping analysis private and on-machine.
Supports OpenAI-compatible model endpoints, including OpenAI, OpenRouter, LM Studio, vLLM, and llama.cpp, as configurable providers for module labeling.
Click on "Deploy 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., "@repo2diagramdiagram this repo's architecture and show the blast radius of my changes vs main"
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.
repo2diagram
Turn any codebase into an interactive architecture diagram — in one command.
Runs on your machine with local models (Ollama). Works as a CLI, an MCP server for Claude Code / Claude Desktop / Cursor, and an agent skill.

uvx repo2diagram modelcontextprotocol/python-sdk --openWhy
Every new codebase starts with the same hour of clicking through folders to figure out what talks to what. repo2diagram reads the real import graph, groups files into modules, and (optionally) asks an LLM to label each one — so you get an accurate map, not a hallucinated one.
Real structure, not guesses — modules and arrows come from static analysis of imports (Python, JS/TS incl.
tsconfigpath aliases, Go, Rust, Java/Kotlin/Scala, C#). The LLM only writes the labels.Private by default — works with local models via Ollama, or with no model at all. Your code never has to leave your machine.
Interactive — click any box to see what it does, its files, what it uses and what uses it. Search, pan/zoom, dark mode, export SVG / Mermaid.
PR blast radius —
--diff mainhighlights the modules a branch touches and every module that depends on them, locally or as a GitHub Action comment on every PR.Works in your AI tools — MCP server for Claude Code, Claude Desktop and Cursor; skill for coding agents.
See it on real projects: gallery — ripgrep, the MCP Python SDK, eShopOnWeb, Vercel's AI chatbot, Spring PetClinic and more.
Related MCP server: Weavatrix
Install
pip install repo2diagram # or: uv tool install repo2diagram / pipx install repo2diagramOr run it without installing: uvx repo2diagram.
Usage
repo2diagram # current directory → <name>-architecture.html
repo2diagram ~/code/my-app --open # open in the browser when done
repo2diagram vercel/ai-chatbot # any GitHub repo (owner/repo or URL)
repo2diagram --diff main # highlight what this branch changed + its blast radius
repo2diagram -o ARCHITECTURE.md # Markdown with a Mermaid diagram (renders on GitHub)
repo2diagram -f mermaid -o - # raw Mermaid to stdout
repo2diagram -f json # the full graph for your own tooling
repo2diagram --no-llm # static analysis only — instant, no model needed
repo2diagram --watch # live diagram on localhost that redraws as you codeFlag | What it does |
| Output path; format inferred from |
| Mark modules changed since |
| Skip model calls, use heuristic labels |
| Override the configured model for one run |
| Also draw tests, docs, examples and CI folders |
| Top-down instead of left-to-right |
| Open the HTML when done |
| Serve a live diagram at |
Models
repo2diagram picks a model automatically: a running Ollama first, then Claude if ANTHROPIC_API_KEY is set, otherwise static labels. Configure it once with the CLI:
# Local (default) — free and private
ollama pull qwen2.5-coder:7b
repo2diagram config set provider ollama
# Claude
repo2diagram config set provider anthropic
repo2diagram config set api_key sk-ant-... # or export ANTHROPIC_API_KEY
# Anything OpenAI-compatible: OpenAI, OpenRouter, LM Studio, vLLM, llama.cpp …
repo2diagram config set provider openai
repo2diagram config set base_url http://localhost:1234/v1
repo2diagram config set model qwen2.5-coder-7b-instruct
repo2diagram config set api_key ... # if the server needs one
repo2diagram config show # keys are redacted
repo2diagram doctor # what's installed and which model will be usedSettings live in ~/.config/repo2diagram/config.json (chmod 600). Env vars R2D_PROVIDER, R2D_MODEL, R2D_BASE_URL, R2D_API_KEY override it. Labels are cached in ~/.cache/repo2diagram, so re-runs are instant and only changed modules hit the model.
Use it from Claude Code, Claude Desktop or Cursor (MCP)
repo2diagram setup claude-code --yes # runs: claude mcp add repo2diagram -- repo2diagram mcp
repo2diagram setup claude-desktop --yes # merges into claude_desktop_config.json (backup kept)
repo2diagram setup cursor --yes # merges into ~/.cursor/mcp.jsonOr add it by hand:
{ "mcpServers": { "repo2diagram": { "command": "uvx", "args": ["repo2diagram", "mcp"] } } }Then just ask: "Draw the architecture of this repo", "What's the blast radius of my branch vs main?", "Explain the server/auth module".
Tool | Purpose |
| Mermaid diagram + module table (+ saves the interactive HTML) |
| Modules, import edges, entry points and dependencies as JSON |
| One module in depth: files, uses / used-by, key file excerpts |
| Changed modules and their blast radius vs a git ref |
Inside an MCP client no API key is needed — the tools return the structure and your assistant does the explaining. Pass summarize: true to use your configured model instead.
Blast radius on every pull request (GitHub Action)
Post a diagram of what each PR touches — and which modules depend on it — as a PR comment that updates on every push.
# .github/workflows/architecture.yml
name: Architecture impact
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
impact:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: adityasingh-ops/repo2diagram@v0Locally, the same report is repo2diagram --diff main -f pr.
Use it as an agent skill
Copy skills/repo2diagram into ~/.claude/skills/ (or your agent's skills folder). The agent will reach for it whenever you ask for an architecture overview or a PR impact check.
How it works
Scan — list files (respects
.gitignore), skip vendored and generated folders.Group — open up container folders (
src/,packages/,apps/…) until the repo splits into a readable set of modules; flat packages are drawn file by file.Link — parse imports (Python AST, JS/TS with
tsconfigaliases per package, Go modules, Rustmod/useacross workspace crates, JVM packages, C# namespaces) and count module-to-module references.Label — heuristics, or one small LLM call per module (cached by content hash).
Render — Mermaid with the ELK layout engine, wrapped in a single self-contained HTML file.
Python API
from repo2diagram import build_graph
from repo2diagram.render import render
graph, diff = build_graph("path/to/repo", summarize_with_llm=False, diff_base="main")
print(render(graph, "mermaid"))Contributing
git clone https://github.com/adityasingh-ops/repo2diagram && cd repo2diagram
uv sync && uv run pytestMore import resolvers (Ruby, PHP, Swift, Dart, C/C++) are the most wanted contributions — see resolvers.py.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Search indexed code, trace dependencies, assess change impact, and recall repository memory.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides a semantic understanding of your codebase by parsing with tree-sitter and building a graph of symbols and dependencies. Enables AI assistants to navigate code, analyze changes, and discover architecture using 18 tools with minimal context overhead.12 npm1MIT
- AlicenseNot gradedqualityAmaintenanceProvides a dependency graph of any local repository with tools for change impact, transitive dependents, health audits, and more, enabling AI coding agents to see structure and refactor safely.4,912 npm4MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to generate annotated file trees, retrieve file statistics, list git-changed files, and read file contents from local directories or GitHub repositories.MIT
- AlicenseAqualityAmaintenanceProvides coding agents with repository-aware tools to understand code structure, find existing patterns, and review plans, architecture, and diffs, enabling a consistent engineering workflow across Cursor, Codex, and Claude Code.7MIT