CodeImpact MCP
CodeImpact MCP helps you answer a practical question before changing code: what else is likely to move if I touch this file?
It builds a dependency graph for a local TypeScript/JavaScript repo, then exposes a small set of read-only MCP tools for:
- dependency lookup
- blast-radius analysis
- lightweight gate-style change review
Current status: local-first and dogfooded, not published yet.
Tools
get_dependencies
For one file, returns:
- what it imports
- what imports it
- exports
- fan-in / fan-out
- a simple high-coupling signal
analyze_impact
For one or more changed files, returns:
- directly affected files
- transitively affected files
- total affected files
- cascade depth
- a graph-based risk score
gate_check
For one or more changed files, returns a bounded recommendation:
PASSWARNBLOCK
This is a graph-only heuristic, not a full engineering safety system. It does not know about tests, runtime behavior, data migrations, or production traffic.
Installation
Requirements
- Node.js 22+
- npm
- a local TypeScript/JavaScript repo you want to inspect
Install
cd ~/projects/code-impact-mcp
npm install
Build
npm run build
Run locally
Development mode:
npm run dev
Compiled server mode:
npm run build
npm start
Optional quick transport smoke check after the server is up:
npm run smoke
Fast local verification
npm test
npm run build
Focused graph/tool verification:
npx vitest run tests/graph.test.ts tests/tools.test.ts
First useful local usage path
The simplest honest first run is:
- point the tools at a real local repo
- inspect one important file with
get_dependencies - run
analyze_impacton a likely change target - use
gate_checkfor a quick pass/warn/block signal
Example target repo from local dogfooding:
~/projects/openclaw-tasks
Example progression:
get_dependenciesforsrc/routes.tsanalyze_impactforsrc/routes/index.tsgate_checkfor the same file with a chosen threshold
Example request shapes
get_dependencies
{
"projectRoot": "/Users/you/projects/openclaw-tasks",
"file": "src/routes.ts"
}
analyze_impact
{
"projectRoot": "/Users/you/projects/openclaw-tasks",
"files": ["src/routes/index.ts"]
}
gate_check
{
"projectRoot": "/Users/you/projects/openclaw-tasks",
"files": ["src/routes/index.ts"],
"threshold": 0.2
}
Tool behavior notes
Path expectations
projectRootshould be an absolute path to the repo root- file inputs should be repo-relative paths like
src/routes.ts tsconfigPathis optional and should be relative toprojectRoot
Resolver behavior
The graph currently supports:
- ESM imports
- ESM re-exports
- CommonJS
require(...) - NodeNext-style
.jsimport specifiers that point back to.tssource files
Error behavior
The tool layer returns bounded JSON errors instead of crashing for:
- invalid project roots
- broken or missing
tsconfig - missing files in the built graph
What the outputs mean
Risk score
The current riskScore is a simple graph-derived heuristic based on how many files are affected relative to graph size.
Treat it as:
- useful for quick comparison
- good enough for first-pass triage
- not a substitute for test/runtime knowledge
gate_check recommendation
PASSmeans low graph impact right nowWARNmeans review is recommended before proceedingBLOCKmeans the current change shape looks too risky for the chosen threshold
A good mental model is: CodeImpact tells you where to look next, not whether the code is truly safe.
Limitations
- explanation quality is still intentionally compact
- no distinction yet between runtime imports and type-only imports
- no CI integration yet
- no registry/publish flow yet
- no dashboard or reporting surface yet
Current repo scripts
npm run dev # run local MCP server with tsx
npm test # vitest run
npm run build # TypeScript compile to dist/
npm start # run compiled MCP server
npm run smoke # basic local MCP client smoke path
Publish readiness
Current state is closer to publish than before, but still in polish mode.
Before any package/publish step, the priority remains:
- keep local-first install/run obvious
- keep tool output explanations understandable
- keep dogfooding on real repos
At this point the project looks close to controlled publish-prep, but should still be treated as local-first until that step is explicitly started.