
Repo Cartographer
io.github.builditwithgkPublished by GitHub account builditwithgkv1.0.1Updated Oct 24, 2026
Maps any repo into an architecture diagram (Mermaid/Graphviz) and enforces architecture rules in CI
Overview
Turns a local repository into an architecture diagram and checks architecture rules, exposing the results as MCP tools.
- What you can do
- Parses a repository folder into deterministic facts: languages, frameworks, entry points, modules, and intra-repo import edges for JavaScript/TypeScript and Python. From those facts it produces a draft Mermaid or Graphviz DOT diagram, plus a self-contained HTML render. A check command flags forbidden cross-boundary imports and dependency cycles against a rules file, and can record existing violations as a baseline so only new ones fail.
- When to use it
- Useful when an assistant needs to explain an unfamiliar codebase, draft an architecture map for a pull request or onboarding doc, or gate merges on architecture rules. The same binary also runs as a plain CLI for humans and CI without an AI client.
- Requirements
- Node.js 18 or later; the package is run locally over stdio, for example via npx. No accounts, API keys, or environment variables are declared. The rendered HTML page loads Mermaid or Viz from a CDN when opened in a browser.
Installation
In SourceWeft
- Open Repo Cartographer in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
repo-cartographer
Understand any codebase in 60 seconds. An MCP server that turns any repository into an architecture diagram.
[TypeScript] [License] [Version] [MCP] [Architecture]
Point your LLM at a folder and get back an architecture map: languages, frameworks, entry points, modules, and an import graph — rendered as a Mermaid diagram you can drop into a PR, a doc, or an onboarding guide.
It is model-agnostic. It speaks the Model Context Protocol over stdio, so it works with Claude Code, Claude Desktop, Cursor, Cline, Copilot, or the OpenAI Agents SDK — no Claude-specific dependency.
Why it's different
The server extracts hard facts. The model does the reasoning.
repo-cartographer never tries to "understand" your code semantically. It parses deterministic facts — file tree, import edges, manifests, framework detection, entry points — and hands your LLM structured JSON plus a draft diagram. Your model turns those facts into the final narrative and a refined diagram.
That split keeps the server small, fast, testable, and portable — and it means the diagram is grounded in what's actually in the repo, not hallucinated.
Example output
Running generate_diagram against this repo produces (a draft the model then refines):
A self-contained, shareable HTML render is committed under examples/ (both a high-level and a file-level detail view).
Install & run
Requires Node.js 18+.
The server communicates over stdio; AI clients launch it that way. You can also use it directly from a terminal — see below.
Command line (no AI needed)
The same binary is dual-mode: with no arguments it's the MCP server; with a subcommand it's a plain CLI for humans and CI.
Zip-friendly: if you point it at an extracted "Download ZIP" folder (repo-main/ wrapper and all), it detects the wrapper and maps the real repo root — noted in the output, never silent.
Two output notations, one strategy: Mermaid because that's where people read it (GitHub renders it natively in PR comments and READMEs), DOT because that's what their tools eat (pipe it into Graphviz, Backstage, or anything else: dot -Tsvg architecture.dot). Both come with the same shareable HTML page and role-colored modules. When the repo has a .cartographer.yml, its diagram: section supplies the defaults for --level, --format and -o; explicit flags always win.
check reads a rules file and flags forbidden cross-boundary imports and dependency cycles — deterministically, no LLM involved, so it's safe to gate a merge:
Adopting on an existing codebase? Record today's violations as an accepted baseline, so only new ones fail the build:
Commit that file; later runs auto-detect it and pass unless a PR introduces a new violation.
Architecture governance in CI (GitHub Action)
A composite action (action.yml) runs check on every PR — failing the
build on an error-level violation and posting a sticky comment with the diagram and
any violations:
This repo dogfoods it in .github/workflows/architecture.yml.
Full design + phases: docs/github-action.md.
Use it with Claude Code
Then ask: "Use repo-cartographer to map ./my-project and draw me an architecture diagram."
Claude Desktop
Add to claude_desktop_config.json:
Use it with the OpenAI Agents SDK
Same server, a different model — the whole point of MCP:
Tools & resources
Most of the time you just want map_repo — "path in, diagram out." Reach for the four granular tools only when you want to compose the steps yourself (e.g. let the model refine the diagram source between generate_diagram and render_diagram).
How it stays fast on big repos
- Languages: JavaScript/TypeScript and Python (v1).
- Skips
node_modules,.git,dist,build,venv,__pycache__,vendor, and other build/dependency/cache directories (plus all hidden dirs). - Caps the number of files scanned and bytes read per file; collapses the import graph to directory level past a threshold. Anything capped is reported in the output — never dropped silently.
- No network calls at scan time. (The rendered HTML pulls Mermaid from a CDN only when you open it in a browser.)
- Deterministic: output is sorted and stable, so diagrams don't churn between runs.
Development
Tests cover the deterministic core — import resolution (JS/TS + Python), module
collapsing, cycle detection, rule globs, baseline diffing, Mermaid rendering and
the check end-to-end path. They run against src/ via tsx, so there is no
build step and no test framework dependency.
Author
Built by Gopi K Aitham (builditwithgk) — see about://author, or scaleup-solutions.in. Available for freelance and contract work on AI, agent, and MCP tooling.
License
MIT
Source: README.md at commit 2da0787
Tools
0Version history
1- v1.0.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts