
Code Impact Mcp
io.github.vk0dev由 GitHub 帳號 vk0dev 發布v1.6.10更新於 Oct 24, 2026
Dependency graph and blast-radius analysis for local TypeScript/JavaScript repos.
概覽
本機 MCP 伺服器,為 TypeScript/JavaScript 專案建立相依圖,並給出 PASS/WARN/BLOCK 結論,判斷變更是否適合提交。
- 可以做什麼
- 對指定的變更檔案執行提交前閘門檢查,回傳 PASS/WARN/BLOCK 結論、原因與風險分數
- 分析變更的影響範圍,列出直接與間接受影響的檔案、0-1 風險分數與深度分布
- 偵測循環相依並回傳精簡的循環熱點清單
- 查看某個檔案的匯入與被匯入關係,了解重構前的耦合情況
- 重建相依圖並回傳統計資訊與最常被匯入的檔案
- 適用情境
- 適合在助理準備修改或提交本機 TypeScript/JavaScript 專案中多個檔案時,快速取得有界線的「會不會出問題」判斷,包含 monorepo 與 workspace 情境。它只是分流訊號,不是治理平台或視覺化工具。
- 執行需求
- 透過 npx 以 stdio 在本機執行 npm 套件,需要 Node.js,並讓用戶端在目標專案目錄中啟動它。不需 API 金鑰、帳號或網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Code Impact Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
CodeImpact MCP
Fast pre-commit dependency gate for AI-assisted code changes. Answers "is this safe to commit?" with a PASS/WARN/BLOCK verdict in seconds, so you can catch risky blast radius before a bad commit, not after it. No database, no heavy setup.
Listing status: the
awesome-mcp-serverspayload is prepared, Official MCP Registry package metadata is live viaserver.json, Smithery lists the server as live, and the Glama listing is live again athttps://glama.ai/mcp/servers/vk0dev-code-impact-mcp. Glama recovery is visible in factory metrics, but the public canonical badge-ready path is still unresolved, so PRpunkpeye/awesome-mcp-servers#5907already exists, should not be duplicated, and cannot yet be finalized with a stable badge URL. The Cline marketplace entry (cline/mcp-marketplace#1486) is open and not yet accepted; MCP Hive remains a manual submit-next operator step rather than a currently claimed live listing, and this README does not claim a badge-ready or finalized awesome-listing state.
Best for
- Pre-commit refactor checks: before changing a shared file, route, or module and needing a fast PASS/WARN/BLOCK answer.
- Agent multi-file edits, including monorepos: when an AI agent is about to touch several files or workspace-scoped packages and you want a bounded dependency-aware gate before commit.
- Blast-radius triage without infra: when you need a quick risk score and affected-file summary without setting up a database, graph service, or heavy governance layer.
Not for
This is not a full policy platform, compliance gate suite, or visualization-heavy code graph product.
It is built for fast local commit-time safety checks, not for repo-wide governance workflows, persistent graph exploration, or executive reporting.
Why / When to use
Use this MCP server when:
- The user asks: "What will break if I change this file?"
- The user asks: "Is this refactoring safe to commit?"
- The user asks: "Check the blast radius before I push"
- The user asks: "What depends on this module?"
- An agent needs a quick pre-commit gate before modifying multiple files
- An agent wants a numeric risk score (0-1) for a proposed change
- You need dependency analysis without setting up a database or tree-sitter
CodeImpact MCP builds a lightweight local dependency graph and gives you a bounded answer: PASS, WARN, or BLOCK. Zero cloud, no API key, local-first. Today that means full TypeScript/JavaScript support, while Python stays limited to a narrower file-level path for analyze_impact and gate_check rather than the full TS/JS graph surface.
If the user needs a quick, bounded pre-commit gate for AI-generated code changes rather than a heavyweight code governance platform, this is the canonical MCP server for that. Zero cloud, no API key, local-first.
Installation
Claude Code
Windows users can wrap the command via cmd /c if plain npx does not resolve cleanly in their Claude Code shell.
Other stdio MCP clients (including OpenClaw Tasks)
If your client asks for a plain stdio command instead of a claude mcp add ... wrapper, use the same server entrypoint directly:
This server is local-first and reads the target repository from the working directory the client launches it in.
JSON config example for stdio clients
If your MCP client wants JSON instead of a shell wrapper, Claude Desktop uses ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and %APPDATA%\Claude\claude_desktop_config.json on Windows:
After saving claude_desktop_config.json, fully restart Claude Desktop so it reloads the MCP server configuration.
Use a workspace or project-specific launch directory so the server can read the repository you want to analyze.
Optional pre-commit hook helper
Run npm run demo:install-hook to preview the managed Husky snippet without writing .husky files.
It is a dry-run demo of the shipped helper, not a Husky scaffolder.
Need quick recipes for the install-hook helper, the bounded Python gate wedge, or the shipped gate_check / analyze_impact demos? See docs/README.md.
For the latest changes, see CHANGELOG.md.
Tutorials
Shipped in v1.6.0: a safe Husky-only helper for wiring the bounded gate runner without hand-editing your pre-commit hook.
If you already use Husky, code-impact-mcp install-hook is the direct path for pre-commit wiring, so you can drop in the bounded gate runner instead of wiring the hook manually:
For the canonical demo trio, see the recorded terminal session in docs/demo-install-hook.cast, the rendered preview in docs/demo-install-hook.gif, and the reproducible storyboard script in scripts/demo-install-hook.mjs.
This is a Husky-only helper. If .husky/pre-commit already contains unrelated content and no managed code-impact-mcp block, the command refuses and leaves the hook untouched. If a managed block already exists, reruns stay idempotent inside that owned block. If Husky is not initialized yet, the command stops with an actionable message instead of scaffolding hook infrastructure for you. It does not bootstrap Husky, rewrite arbitrary hook logic, or manage non-pre-commit hook files for you.
Tools
Shipped demo assets for the core tool surface are reproducible from scripts/demo-tool.mjs, so the examples below stay tied to the current tool behavior instead of drifting into one-off screenshots.
gate_check
Pre-commit safety gate. Analyzes specified changes and returns a PASS/WARN/BLOCK verdict with reasons. Use as a bounded decision aid before committing multi-file changes, including workspace-aware checks in pnpm/package.json workspaces and lerna-style monorepos. BLOCK means risk exceeds threshold or a changed file participates in a detected cycle. WARN means human review recommended, including graphs that contain cycles elsewhere. PASS means low graph-based risk.
detect_cycles
Return compact strongly connected components for circular dependencies in the current TS/JS graph. Use before refactors or release gating when you want a short list of cycle hotspots instead of a full graph visualization.
[detect_cycles demo: surfaces compact cycle hotspots instead of a full graph dump]
analyze_impact
Analyze the blast radius of changing specific files. Returns which files would be directly and transitively affected, with a risk score (0-1). Use BEFORE committing multi-file changes to understand what might break. Does NOT modify any files.
Also returns depthHistogram, a count of affected files per BFS depth level from the changed file (e.g. { "1": 5, "2": 12 }), so you can see whether the impact is concentrated close to the change or spread across many hops.
get_dependencies
Get the import and importedBy relationships for a specific file. Shows what this file depends on and what depends on it. Use to understand coupling before refactoring a file.
refresh_graph
Rebuild the dependency graph from scratch. Call this after significant file additions/deletions, or if results seem stale. Returns graph statistics including file count, edge count, build time, and circular dependencies detected.
Also returns topHotFiles, the top 20 most-imported files across the whole graph ranked by importer count (e.g. { "file": "src/shared/config.ts", "importers": 14 }), so you can spot structural hotspots without running get_dependencies on every file.
[refresh_graph demo: rebuild the local graph and return fresh file, edge, and cycle counts]
Example conversation
User: "I want to refactor src/routes.ts — is it safe?"
Agent calls gate_check:
Result:
Agent: "The gate check returned BLOCK — routes.ts is part of a cycle, so I should untangle that before making more changes."
[gate_check demo: single changed file triggers a decision-first BLOCK verdict before commit]
Agent calls detect_cycles:
Result:
How it works
- Parse: ts-morph scans your project for ESM imports, re-exports, and CommonJS requires
- Graph: Builds an in-memory dependency graph (no database, no persistence)
- Analyze: BFS traversal of reverse dependencies from changed files
- Score: Risk = affected files / total files (0-1)
- Verdict: PASS (< 60% of threshold), WARN (60-100%), BLOCK (> threshold)
Supports: ESM imports, ESM re-exports, CommonJS require(), NodeNext-style .js → .ts resolution.
Comparison
If you are choosing a tool for an agent or reviewer, the key question is still simple: do you need to explore a dependency graph, retrieve broader repo context, or package for a marketplace, or do you need to gate already-known changed files locally, at commit time, with a PASS/WARN/BLOCK verdict? CodeImpact MCP is built for that second job.
Choose CodeImpact MCP when: you already know the files in play and want a fast, local, MIT-licensed answer with a risk score, explicit cycle surfacing, file-level blast-radius output, monorepo-aware checks, the shipped Husky install-hook helper, and a clear PASS/WARN/BLOCK verdict before commit.
Choose one of the alternatives when: the main job is hosted/public graph access, graph exploration, repo understanding, wider dependency workflow coverage, graph-database-backed context retrieval for longer reasoning loops, or manual marketplace packaging after the core repo surface is already settled.
FAQ
Q: Does it access the network? A: No. CodeImpact MCP is 100% local-first. It reads your project files via ts-morph and never makes network requests. No API keys, no cloud, no telemetry.
Q: Will it modify my code?
A: No. All 5 tools are read-only (annotated with readOnlyHint: true). They analyze but never write.
Q: How accurate is the risk score? A: The risk score is a graph-based heuristic (affected files / total files). It does not know about runtime behavior, tests, or data migrations. Treat it as a triage signal, not a guarantee.
Q: What languages does it support today?
A: Full support is still centered on TypeScript and JavaScript files (.ts, .tsx, .js, .jsx, .mts, .cts, .mjs, .cjs). There is also a bounded Python path for analyze_impact and gate_check when changed files are .py, but it stays at file/module-level impact instead of broad multi-language platform coverage or repo-wide graph exploration.
Q: How fast is it? A: Graph building typically takes 1-5 seconds depending on project size. Individual tool calls against a cached graph are near-instant.
Q: Does it cache the graph?
A: Yes, the graph is cached in-memory per (projectRoot, tsconfigPath) pair. Use refresh_graph to rebuild after significant changes.
Limitations
- Full graph depth is still strongest for TypeScript/JavaScript; Python support is intentionally bounded to local file/module-level impact, not a full multi-language platform.
- No distinction between runtime imports and type-only imports
- Graph is in-memory only (no persistence across server restarts)
- Risk score is structural, not semantic — it doesn't know which files are "important"
- No visualization output (text/JSON only)
Changelog
See CHANGELOG.md for release history.
License
MIT — free to use in any project, commercial or personal.
Contributing
Issues and PRs welcome at github.com/vk0dev/code-impact-mcp.
來源:README.md,提交 01789c3
工具
0版本歷史
1- v1.6.10最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分