Repograph

io.github.Karry1123由 GitHub 帳號 Karry1123 發布v0.1.1更新於 Nov 2, 2026

Local architecture maps and caller impact analysis with directory clustering and utility folding.

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器:把程式碼庫掃描成架構圖,產生可互動 HTML 地圖,並追蹤變更檔案的呼叫端。

可以做什麼
  • 把本機儲存庫掃描成架構圖,包含檔案節點、匯入邊、巢狀目錄叢集與指標,並排除測試檔與外部套件。
  • 產生自包含的可互動 HTML 架構地圖並可選主題;命令列另可匯出 JSON、Mermaid 與 SVG。
  • 在修改或刪除檔案前,追蹤其直接與間接呼叫端,提供 BFS 層級、受影響叢集與影響範圍。
  • 依檔名啟發式把檔案歸入入口、業務、資料、工具等層,並折疊高扇入的工具檔以減少雜訊。
適用情境
適合在重構或刪除程式碼前確認哪些檔案依賴某個模組,也適合需要直觀了解陌生 JavaScript、TypeScript、Python、Go 或 Rust 儲存庫結構時使用。
執行需求
透過 npx repograph-cli mcp 以 stdio 在本機執行,需要 Node.js 18 或更新版本。不需帳號、API 金鑰或設定檔。工具需傳入儲存庫的絕對路徑,因為伺服器可能在不同工作目錄啟動。開啟 HTML 地圖時需能連線公共 CDN 以載入固定版本的 Cytoscape 與版面配置腳本。
安裝前請注意
產生的 HTML 內嵌檔案路徑與圖資料,分享時應視為儲存庫資訊。開啟地圖會從公共 CDN 下載腳本,但工具本身不會上傳原始碼或圖資料。generate_architecture_html 會寫入檔案,相對輸出路徑以儲存庫路徑為基準解析。分析屬靜態啟發式,可能漏掉計算式匯入、自訂別名與動態載入。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Repograph,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

RepoGraph

Turn any codebase into an interactive architecture map in 2 seconds. Zero server, full privacy, built for Claude & Claude Code.

[RepoGraph demo: click a file for its blast radius, double-click a directory to collapse it]

[npm version] [MIT license] [Node >=18] [Languages]

👉 Try the interactive live demo (zustand's architecture, generated with one command)

Find the files that matter before changing the code. RepoGraph scans local imports, groups source files by directory and likely architectural layer, and writes an interactive HTML map. Directory clustering and utility folding help keep shared helpers from turning the view into a spiderweb. Three MCP tools let Claude inspect architecture and trace the impact of a proposed change.

“2 seconds” describes the quickstart experience, not a measured performance guarantee. Scan time and HTML size depend on the repository; a small map can be ~40 KB. No account, server, or configuration file is required.

Quickstart

sh
npx repograph-cli .

Open the printed file:///.../repograph.html link. Click a file to see its incoming callers in cyan and outgoing dependencies in red. Double-click directory boxes to collapse or expand them. Press f to fit the graph to the viewport. Search matches subsequences in full file paths; the minimap lets you jump around large graphs.

Node.js 18 or newer is required. Scanning stays on your machine. The HTML embeds your file paths and graph data, so treat it as repository information when sharing. Opening the interactive map downloads pinned Cytoscape/layout scripts from public CDNs; no source or graph data is sent by RepoGraph. The CDN scripts must be reachable on first opening. SVG, JSON, and Mermaid exports need no browser CDN scripts.

CLI reference

text
repograph [path] [options]repograph mcp
Options:  -o, --output <file>       Write to a file  --theme <theme>           dark | light | matrix (default: dark)  --max-depth <n>           Maximum directory nesting (default: 6)  --no-collapse-utils      Show utility candidates immediately  --format <format>        html | json | mermaid | svg (default: html)  -V, --version            Show version  -h, --help               Show help

The path defaults to .. HTML defaults to ./repograph.html in your current working directory and prints its absolute file URL after writing. Other formats print to stdout unless --output is supplied. Output directories are created automatically. --max-depth 0 scans only root files.

sh
npx repograph-cli ./my-app --output ./architecture.html --theme matrixnpx repograph-cli . --format json > graph.jsonnpx repograph-cli . --format mermaid --output architecture.mmdnpx repograph-cli . --format svg --output architecture.svgnpx repograph-cli . --max-depth 10 --no-collapse-utils

The static SVG arranges files in entry → business → unknown → data → util columns. Mermaid exports preserve nested directory subgraphs. Both include utility candidates; HTML initially hides folded utilities and their edges.

Use with Claude

Install from the MCP Registry

RepoGraph is listed on the official MCP Registry as io.github.Karry1123/repograph. Registry-aware clients can install it by that name; the manual Claude setup below also works.

Claude Desktop

Add this entry to claude_desktop_config.json, merging it with existing servers:

json
{  "mcpServers": {    "repograph": {      "command": "npx",      "args": ["-y", "repograph-cli", "mcp"]    }  }}

Restart Claude Desktop, then ask: “Scan my repository at /absolute/path/to/project and show the impact of changing src/core/graph.ts.” Use an absolute repository path; the MCP server may start with a different working directory. Windows paths work too, for example F:\\RepoGraph in JSON.

Claude Code

sh
claude mcp add repograph -- npx -y repograph-cli mcp

Ask Claude to generate an architecture map before a refactor, or find all transitive callers of a module before editing it. MCP mode uses stdio for the protocol and writes errors only to stderr.

Tools

ToolArgumentsResult
scan_repository_graphpath (absolute repo root), maxDepth (int, default 6), collapseUtils (bool, default true)Full ArchitectureGraph JSON: nodes, edges, nested clusters, metrics. Use for structure and hub files.
generate_architecture_htmlpath, outputPath (default ./repograph.html, relative to path), theme (dark / light / matrix)Writes a self-contained interactive map; returns { success, filePath, nodeCount }. Use when a person wants a visual.
query_impact_pathpath, changedFile (repo-relative, e.g. src/core/graph.ts)Direct and transitive callers with BFS depth, affected clusters, blast radius. Use before editing or deleting a file.

Each tool performs its own fresh static scan of path on every call, so no prior scan is needed. Tools are annotated readOnlyHint: true except generate_architecture_html, which writes one file.

For HTML generation, a relative outputPath is resolved against the repository path. An absolute output path is used directly. The tools use a utility fan-in threshold of 15. Missing changed files return an error with the closest matching IDs. transitiveDependents includes direct callers at depth 1; blastRadius counts unique affected files and excludes the changed file itself.

How the map works

Imports become edges

Each source file becomes a node with a forward-slash relative ID. Local imports become directed edges from importer to dependency. JavaScript and TypeScript use Babel, with a regex fallback for unsupported syntax. Repeated references of the same type are combined with an edge weight. External packages are dropped. Class inheritance through an imported binding gets an inheritance edge; import() gets a dynamic edge.

RepoGraph tries source extensions, directory index files, NodeNext .js → .ts equivalents, and a heuristic @/ → src/ alias. It does not execute code or load project-specific compiler plugins. Computed imports and custom aliases can be missed.

Layers give the graph meaning

LayerFile or directory cluesColour
Entrycontroller, route, router, handler, api, endpoint, cli, app, server, main; root indexCyan
Businessservice, usecase, core, domain, logic, managerMagenta
Datarepo, repository, model, schema, entity, store, db, dao, migrationAmber
Utilutil, utils, helpers, common, shared, lib, constants, types, config; high fan-inSlate
UnknownEverything elseIndigo

Classification checks entry, business, data, then utility clues. It is an explainable filename heuristic, not a semantic judgement about your design. Clusters reflect the first two directory levels and retain nested parents.

Utility folding reduces noise

Files with more than 12 incoming callers and at most two outgoing dependencies, or utility-like names, are folding candidates. CLI/API default to 12; MCP defaults to 15. Folded nodes and their edges stay in the graph data and impact analysis but disappear from the initial HTML view. “Show utilities” reveals them. Degree counts use unique neighboring files, not repeated imports.

Blast radius follows callers

Impact analysis performs a breadth-first search over reverse edges. It handles cycles, visits each file once, and records the shortest caller depth. The inspector lists direct callers and dependencies; the highlight traces both full transitive chains. If a cycle belongs to both chains, the dependency highlight takes precedence.

Dead-code warnings count files with no incoming local edges that do not look like entry points. Treat these as review hints: frameworks, reflection, external consumers, and dynamic loading can all create valid files with no static callers. Coupling factor is average unique out-degree; density is edges divided by n * (n - 1) (zero for fewer than two files). LOC counts nonblank source lines, including comments.

Supported languages and scan rules

LanguageResolution
JavaScript / TypeScriptESM imports/re-exports, require(), dynamic imports, imported superclass bindings; JS/JSX/MJS/CJS/TS/TSX/MTS/CTS
Pythonimport a.b, absolute and relative from imports, .py modules and __init__.py packages
GoSingle imports and import blocks; paths under the root go.mod module resolve to every scanned .go file in the target directory
Rustmod x; resolves to x.rs or x/mod.rs; use crate::... resolves modules under src/

Root and nested .gitignore rules are respected. RepoGraph skips dependency, build, cache, and editor directories, including node_modules, .git, dist, build, out, coverage, __pycache__, .venv, venv, .next, .nuxt, target, vendor, .idea, .vscode, and .cache. Symlinks are skipped to prevent cycles. Files larger than 1.5 MB and *.min.js are excluded. Test/spec files are excluded from the main graph, with their count retained as metrics.excludedTestFiles.

Python, Go, and Rust resolution is intentionally static and heuristic: workspace manifests, build tags, Python import hooks, Rust macros, and non-root Go modules are not evaluated. Only files included in the scan can become nodes or targets.

Where it fits

This table describes the tools' focus rather than a feature-completeness or performance benchmark. Check each project's current documentation for its full capabilities.

RepoGraphMadgeCodeSeeGitingest
Primary outputLocal interactive HTML architecture mapModule dependency graphsCode exploration and mapping platformRepository text context
WorkflowCLI + three MCP toolsDependency analysis CLI/APIPlatform workflowIngest code for LLM context
Main emphasisLayers, utility folding, caller impactModule relationships and cyclesCollaborative code understandingShareable code context
RepoGraph's approachNo server; embedded graph snapshotComplementary dependency toolingDifferent platform modelComplementary text-first tooling

Programmatic use

ts
import { analyzeRepository } from 'repograph-cli/dist/src/api.js';import { impactPath } from 'repograph-cli/dist/src/core/graph.js';import { renderToHtml } from 'repograph-cli/dist/src/renderer/htmlTemplate.js';
const graph = await analyzeRepository('.', {  maxDepth: 6,  collapseUtils: true,  utilThreshold: 12,});const impact = impactPath(graph, 'src/api.ts');const html = renderToHtml(graph, { theme: 'dark' });

createServer() and startMcpServer() are exported from dist/src/index.js; importing the module does not start a transport. The graph data model lives in src/types.ts and ships with generated TypeScript declarations.

Contributing

sh
npm installnpm run buildnode dist/bin/cli.js . --output demo/self.htmlnode dist/bin/cli.js . --format jsonnode dist/bin/cli.js . --format mermaid

During development, use npm run dev -- .. On Windows PowerShell installations that block npm.ps1, use npm.cmd. Keep path IDs portable, avoid executing scanned code, and test resolution changes against a small repository containing the relevant imports. Include reproduction steps and the expected edges in bug reports or contributions.

License

MIT © 2026 Karry. See LICENSE.

Roadmap · star to vote

  • TypeScript/JavaScript
  • Python
  • Go
  • Rust
  • Java/Kotlin (unlocks at 200 ⭐)
  • C# (300 ⭐)
  • PHP/Ruby (500 ⭐)
  • Monorepo workspace + tsconfig paths alias resolution (200 ⭐)
  • VS Code extension (1000 ⭐)

Star to vote, open a Language Support Request issue, and share the imports and project layout you need supported. These thresholds guide priorities rather than promise delivery dates.

來源:README.md,提交 dd0b91b

工具

3

scan_repository_graph

Scan a local codebase into an architecture graph. Test files and external imports are excluded.

輸入參數path必填maxDepthcollapseUtils

generate_architecture_html

Write a self-contained interactive architecture map of a local codebase.

輸入參數path必填themeoutputPath

query_impact_path

Find direct and transitive callers of a changed file, with BFS depths and affected clusters.

輸入參數path必填changedFile必填

版本歷史

1
  1. v0.1.1最新Oct 26, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分