trace-mcp 0.1.0 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # trace-mcp
2
2
 
3
- **Framework-aware code intelligence MCP server for Laravel / Vue / Inertia / Nuxt stacks.**
3
+ **Framework-aware code intelligence MCP server 48+ framework integrations across 68 languages.**
4
4
 
5
5
  > Your AI agent reads `UserController.php` and sees a class.
6
6
  > trace-mcp reads it and sees a route → controller → FormRequest → Eloquent model → Inertia render → Vue page → child components — **in one graph.**
@@ -17,150 +17,210 @@ So they brute-read files, guess at relationships, and miss cross-language edges
17
17
 
18
18
  ## The solution
19
19
 
20
- trace-mcp builds a **cross-language dependency graph** from your source code — PHP, TypeScript, Vue SFCs, Blade templates — and exposes it through the [Model Context Protocol](https://modelcontextprotocol.io). Any MCP-compatible agent (Claude Code, Cursor, Windsurf, etc.) gets framework-level understanding out of the box.
20
+ trace-mcp builds a **cross-language dependency graph** from your source code and exposes it through the [Model Context Protocol](https://modelcontextprotocol.io). Any MCP-compatible agent (Claude Code, Cursor, Windsurf, etc.) gets framework-level understanding out of the box.
21
21
 
22
22
  | Without trace-mcp | With trace-mcp |
23
23
  |---|---|
24
- | Agent reads 15 files to understand a feature | Agent calls `get_feature_context` — gets relevant code in one shot |
25
- | Agent doesn't know which Vue page a controller renders | Agent sees `routes_to → renders_component → uses_prop` edges |
26
- | "What breaks if I change this model?" — agent guesses | `get_change_impact` traverses reverse dependencies across PHP + Vue |
27
- | Schema? Agent needs a running database | Migrations are parsed — schema reconstructed from code |
24
+ | Agent reads 15 files to understand a feature | `get_task_context` — optimal code subgraph in one shot |
25
+ | Agent doesn't know which Vue page a controller renders | `routes_to → renders_component → uses_prop` edges |
26
+ | "What breaks if I change this model?" — agent guesses | `get_change_impact` traverses reverse dependencies across languages |
27
+ | Schema? Agent needs a running database | Migrations parsed — schema reconstructed from code |
28
28
  | Prop mismatch between PHP and Vue? Discovered in production | Detected at index time — PHP data vs. `defineProps` |
29
29
 
30
30
  ---
31
31
 
32
- ## What you get
32
+ ## Key capabilities
33
33
 
34
- | Capability | How it works |
35
- |---|---|
36
- | **Request flow tracing** | URL Route → Middleware → Controller → FormRequest → Model → Inertia → Vue Page → Props |
37
- | **Component trees** | ParentChild render hierarchy with props / emits / slots |
38
- | **Schema from migrations** | Table structure reconstructed from migration files no DB connection needed |
39
- | **Event chains** | Event ListenerJob fan-out across async boundaries |
40
- | **Prop mismatch detection** | PHP `Inertia::render()` data vs. Vue `defineProps` catch type drift before production |
41
- | **Change impact analysis** | "What breaks if I touch this?" — reverse dependency traversal across languages |
42
- | **Feature context assembly** | Describe a feature in plain English → get all relevant code within a token budget |
34
+ - **Request flow tracing** URL → Route → Middleware → Controller → Service, across 18 backend frameworks
35
+ - **Component trees** — render hierarchy with props / emits / slots (Vue, React, Blade)
36
+ - **Schema from migrations** no DB connection needed
37
+ - **Event chains** EventListener Job fan-out (Laravel, Django, NestJS, Celery, Socket.io)
38
+ - **Change impact analysis** — reverse dependency traversal across languages
39
+ - **Graph-aware task context** describe a dev task get the optimal code subgraph (execution paths, tests, types), adapted to bugfix/feature/refactor intent
40
+ - **CI/PR change impact reports** automated blast radius, risk scoring, test gap detection, architecture violation checks on every PR
41
+ - **Call graph & DI tree** bidirectional call graphs, NestJS dependency injection
42
+ - **ORM model context** relationships, schema, metadata for 7 ORMs
43
+ - **Dead code & test gap detection** — find untested exports, dead code, coverage gaps
44
+ - **Multi-repo federation** — link graphs across separate repos via API contracts; cross-repo impact analysis
45
+ - **AI-powered analysis** — symbol explanation, test suggestions, change review, semantic search (optional)
43
46
 
44
- ---
47
+ ### Supported stack
48
+
49
+ **Languages (68):** PHP, TypeScript/JavaScript, Python, Go, Java, Kotlin, Ruby, Rust, C, C++, C#, Swift, Objective-C, Dart, Scala, Groovy, Elixir, Erlang, Haskell, Gleam, Bash, Lua, Perl, GDScript, R, Julia, Nix, SQL, HCL/Terraform, Protocol Buffers, Vue SFC, HTML, CSS/SCSS/SASS/LESS, XML/XUL/XSD, YAML, JSON, TOML, Assembly, Fortran, AutoHotkey, Verse, AL, Blade, EJS, Zig, OCaml, Clojure, F#, Elm, CUDA, COBOL, Verilog/SystemVerilog, GLSL, Meson, Vim Script, Common Lisp, Emacs Lisp, Dockerfile, Makefile, CMake, INI, Svelte, Markdown, MATLAB, Lean 4, FORM, Magma, Wolfram/Mathematica
50
+
51
+ **Frameworks:** Laravel (+ Livewire, Nova, Filament, Pennant), Django (+ DRF), FastAPI, Flask, Express, NestJS, Fastify, Hono, Next.js, Nuxt, Rails, Spring, tRPC
52
+
53
+ **ORMs:** Eloquent, Prisma, TypeORM, Drizzle, Sequelize, Mongoose, SQLAlchemy
54
+
55
+ **Frontend:** Vue, React, React Native, Blade, Inertia, shadcn/ui, Nuxt UI, MUI, Ant Design, Headless UI
45
56
 
46
- ## Supported frameworks
57
+ **Other:** GraphQL, Socket.io, Celery, Zustand, Pydantic, Zod, n8n, React Query/SWR, Playwright/Cypress/Jest/Vitest/Mocha
47
58
 
48
- | Layer | Frameworks | What's extracted |
49
- |---|---|---|
50
- | **Backend** | Laravel 6–13 | Routes, controllers, Eloquent relations, migrations, FormRequests, events/listeners, middleware |
51
- | **Templates** | Blade | `@extends`, `@include`, `@component`, `<x-*>` directives, template inheritance |
52
- | **Bridge** | Inertia.js | `Inertia::render()` calls, controller ↔ Vue page mapping, prop extraction & validation |
53
- | **Frontend** | Vue 2 (Options API), Vue 3 (Composition API) | `defineProps`, `defineEmits`, composables, component render trees |
54
- | **Meta-framework** | Nuxt 3 | File-based routing, auto-imports, `useFetch` / `useAsyncData`, server API routes |
55
- | **Languages** | PHP, TypeScript, JavaScript, Vue SFC | Full symbol extraction via tree-sitter |
59
+ > Full details: [Supported frameworks](docs/supported-frameworks.md) · [All tools](docs/tools-reference.md)
56
60
 
57
61
  ---
58
62
 
59
- ## MCP tools
63
+ ## Quick start
60
64
 
61
- ### Project
65
+ ```bash
66
+ npm install -g trace-mcp
67
+ trace-mcp init # one-time global setup (MCP clients, hooks, CLAUDE.md)
68
+ trace-mcp add # register current project for indexing
69
+ ```
62
70
 
63
- | Tool | What it does |
64
- |---|---|
65
- | `get_project_map` | Project overview — detected frameworks, directory structure, entry points |
66
- | `get_index_health` | Index stats — file count, symbol count, edge count, errors |
67
- | `reindex` | Trigger full or incremental re-indexing |
71
+ **Step 1: `init`** one-time global setup. Configures your MCP client (Claude Code, Cursor, Windsurf, or Claude Desktop), installs the guard hook, and adds a tool routing guide to `~/.claude/CLAUDE.md`.
68
72
 
69
- ### Navigation
73
+ **Step 2: `add`** — registers a project. Detects frameworks and languages, creates the index database, and adds the project to the global registry. Run this in each project you want trace-mcp to understand.
70
74
 
71
- | Tool | What it does |
72
- |---|---|
73
- | `search` | Full-text search (FTS5 + BM25) with kind / language / file pattern filters |
74
- | `get_symbol` | Look up a symbol by ID or FQN — returns source code |
75
- | `get_file_outline` | All symbols in a file — signatures only, no bodies |
75
+ All state lives in `~/.trace-mcp/` nothing is stored in your project directory.
76
76
 
77
- ### Framework intelligence
77
+ Start your MCP client and use:
78
+ ```
79
+ > get_project_map to see what frameworks are detected
80
+ > get_task_context("fix the login bug") to get full execution context for a task
81
+ > get_change_impact on app/Models/User.php to see what depends on it
82
+ ```
78
83
 
79
- | Tool | What it does |
80
- |---|---|
81
- | `get_component_tree` | Build Vue/Blade component render tree from a root file |
82
- | `get_change_impact` | Reverse dependency graph — what depends on this file or symbol |
83
- | `get_feature_context` | NLP-driven context assembly — describe a feature, get relevant code within a token budget |
84
+ ### Adding more projects
84
85
 
85
- ### Resources
86
+ ```bash
87
+ cd /path/to/another/project
88
+ trace-mcp add
89
+ ```
86
90
 
87
- | Resource | URI | Description |
88
- |---|---|---|
89
- | Project map | `project://map` | JSON project overview |
90
- | Index health | `project://health` | Index status |
91
+ Or specify a path directly:
92
+ ```bash
93
+ trace-mcp add /path/to/project
94
+ ```
91
95
 
92
- ---
96
+ List all registered projects:
97
+ ```bash
98
+ trace-mcp list
99
+ ```
93
100
 
94
- ## When does it help?
101
+ ### Upgrading
95
102
 
96
- | Scenario | Without trace-mcp | With trace-mcp |
97
- |---|---|---|
98
- | "Add a new field to the User model" | Agent edits model, misses migration, FormRequest, and Vue form | `get_change_impact` shows all dependents — model, migration, request validation, Vue props |
99
- | "What components does this page use?" | Agent greps for import statements, misses dynamic components | `get_component_tree` returns full render tree with props/slots |
100
- | "Refactor the auth flow" | Agent reads files one by one, burns tokens | `get_feature_context("authentication")` assembles relevant code in one call |
101
- | "Does the Vue page match the controller response?" | Manual comparison, easy to miss fields | Prop mismatch detection flags drift automatically |
102
- | "What's the DB schema?" | Need a running database or read raw SQL | Migrations parsed — `get_schema` returns reconstructed tables |
103
+ After updating trace-mcp (`npm update -g trace-mcp`), run:
103
104
 
104
- ---
105
+ ```bash
106
+ trace-mcp upgrade
107
+ ```
105
108
 
106
- ## Quick start
109
+ This runs database migrations and reindexes **all registered projects** with the latest plugins. To upgrade a specific project:
110
+
111
+ ```bash
112
+ trace-mcp upgrade /path/to/project
113
+ ```
114
+
115
+ ### Manual setup
107
116
 
108
- ### 1. Install
117
+ If you prefer manual control, see [Configuration](docs/configuration.md) for all options. You can skip specific init steps:
109
118
 
110
119
  ```bash
111
- npm install -g trace-mcp
120
+ trace-mcp init --skip-hooks --skip-claude-md --skip-mcp-client
112
121
  ```
113
122
 
114
- ### 2. Add to your MCP client
123
+ ### Indexing details
124
+
125
+ **Automatic:** `trace-mcp serve` starts background indexing immediately and launches a file watcher. The server is ready for tool calls right away — results improve as indexing progresses. If the project isn't registered yet, `serve` auto-registers it.
115
126
 
116
- **Claude Code:**
127
+ **Manual:** index a project without starting the server:
117
128
  ```bash
118
- claude mcp add trace-mcp -- trace-mcp serve
129
+ trace-mcp index /path/to/project # incremental (skips unchanged files)
130
+ trace-mcp index /path/to/project --force # full reindex
119
131
  ```
120
132
 
121
- **Claude Desktop / Cursor / Windsurf** (MCP config JSON):
122
- ```json
123
- {
124
- "mcpServers": {
125
- "trace-mcp": {
126
- "command": "trace-mcp",
127
- "args": ["serve"],
128
- "cwd": "/path/to/your/project"
129
- }
130
- }
131
- }
133
+ Files are content-hashed (MD5). On re-index, unchanged files are skipped. Both `serve` and `serve-http` start a file watcher that debounces rapid changes (300ms) and processes deletions immediately.
134
+
135
+ ### Global directory structure
136
+
137
+ All trace-mcp state is centralized:
138
+
132
139
  ```
140
+ ~/.trace-mcp/
141
+ .config.json # global config + per-project settings
142
+ registry.json # registered projects
143
+ topology.db # cross-service topology + federation graph
144
+ index/
145
+ my-app-a1b2c3d4e5f6.db # per-project databases (named by project + hash)
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Getting the most out of trace-mcp
151
+
152
+ trace-mcp works on three levels to make AI agents use its tools instead of raw file reading:
133
153
 
134
- ### 3. Start using it
154
+ ### Level 1: Automatic (works out of the box)
135
155
 
136
- The server auto-indexes on first tool call. No configuration needed for standard Laravel + Vue projects.
156
+ The MCP server provides **instructions** and **tool descriptions** with routing hints that tell AI agents when to prefer trace-mcp over native Read/Grep/Glob. This works with any MCP-compatible client no configuration needed.
137
157
 
158
+ ### Level 2: CLAUDE.md (recommended)
159
+
160
+ Add this block to your project's `CLAUDE.md` (or `~/.claude/CLAUDE.md` for global use) to reinforce tool routing:
161
+
162
+ ```markdown
163
+ ## Code Navigation Policy
164
+
165
+ Use trace-mcp tools for code intelligence — they understand framework relationships, not just text.
166
+
167
+ | Task | trace-mcp tool | Instead of |
168
+ |------|---------------|------------|
169
+ | Find a function/class/method | `search` | Grep |
170
+ | Understand a file before editing | `get_outline` | Read (full file) |
171
+ | Read one symbol's source | `get_symbol` | Read (full file) |
172
+ | What breaks if I change X | `get_change_impact` | guessing |
173
+ | All usages of a symbol | `find_usages` | Grep |
174
+ | Starting work on a task | `get_task_context` | reading 15 files |
175
+ | Quick keyword context | `get_feature_context` | reading 15 files |
176
+ | Tests for a symbol | `get_tests_for` | Glob + Grep |
177
+ | HTTP request flow | `get_request_flow` | reading route files |
178
+ | DB model relationships | `get_model_context` | reading model + migrations |
179
+
180
+ Use Read/Grep/Glob for non-code files (.md, .json, .yaml, config).
181
+ Start sessions with `get_project_map` (summary_only=true).
138
182
  ```
139
- > Use get_project_map to see what frameworks are detected
140
- > Use get_feature_context to find code related to "user registration"
141
- > Use get_change_impact on app/Models/User.php to see what depends on it
183
+
184
+ ### Level 3: Hook enforcement (Claude Code only)
185
+
186
+ For hard enforcement, install the **PreToolUse guard hook** that blocks Read/Grep/Glob on source code files and redirects the agent to trace-mcp tools with specific suggestions. The hook is installed globally by `trace-mcp init`, or manually:
187
+
188
+ ```bash
189
+ trace-mcp setup-hooks --global # install
190
+ trace-mcp setup-hooks --uninstall # remove
142
191
  ```
143
192
 
193
+ This copies the guard script to `~/.claude/hooks/` and adds the hook to your Claude Code settings.
194
+
195
+ **What the hook does:**
196
+ - **Blocks** Read/Grep/Glob/Bash on source code files (`.ts`, `.py`, `.php`, `.go`, `.java`, `.rb`, etc.)
197
+ - **Allows** non-code files (`.md`, `.json`, `.yaml`, `.env`, config)
198
+ - **Allows** Read before Edit — first Read is blocked with a suggestion, retry on the same file is allowed (the agent needs full content for editing)
199
+ - **Allows** safe Bash commands (git, npm, build, test, docker, etc.)
200
+ - **Redirects** with specific trace-mcp tool suggestions in the denial message
201
+
144
202
  ---
145
203
 
146
204
  ## How it works
147
205
 
148
206
  ```
149
- Source files (PHP, TS, Vue, Blade)
207
+ Source files (PHP, TS, Vue, Python, Go, Java, Kotlin, Ruby, HTML, CSS, Blade)
150
208
 
151
209
 
152
210
  ┌──────────────────────────────────────────┐
153
211
  │ Pass 1 — Per-file extraction │
154
212
  │ tree-sitter → symbols │
155
- framework plugins → routes, components,
156
- │ migrations, events, Eloquent models
213
+ integration plugins → routes,
214
+ components, migrations, events,
215
+ │ models, schemas, variants, tests │
157
216
  └────────────────────┬─────────────────────┘
158
217
 
159
218
 
160
219
  ┌──────────────────────────────────────────┐
161
220
  │ Pass 2 — Cross-file resolution │
162
- │ PSR-4 · ES modules · Vue components
163
- Inertia bridge · Blade inheritance
221
+ │ PSR-4 · ES modules · Python modules
222
+ Vue components · Inertia bridge
223
+ │ Blade inheritance · ORM relations │
164
224
  │ → unified directed edge graph │
165
225
  └────────────────────┬─────────────────────┘
166
226
 
@@ -168,130 +228,165 @@ Source files (PHP, TS, Vue, Blade)
168
228
  ┌──────────────────────────────────────────┐
169
229
  │ SQLite (WAL mode) + FTS5 │
170
230
  │ nodes · edges · symbols · routes │
171
- components · migrations
231
+ + optional: embeddings · summaries
172
232
  └────────────────────┬─────────────────────┘
173
233
 
174
234
 
175
- MCP stdio server
176
- 9 tools · 2 resources
235
+ MCP server (stdio or HTTP/SSE)
236
+ 44+ tools · 2 resources
177
237
  ```
178
238
 
179
239
  **Incremental by default** — files are content-hashed; unchanged files are skipped on re-index.
180
240
 
181
- **Plugin architecture** — language plugins (symbol extraction) and framework plugins (semantic edges) are loaded based on project detection. Adding a new framework = implementing `FrameworkPlugin` with `detect()`, `extractNodes()`, and `resolveEdges()`.
241
+ **Plugin architecture** — language plugins (symbol extraction) and integration plugins (semantic edges) are loaded based on project detection, organized into categories: framework, ORM, view, API, validation, state, realtime, testing, tooling.
242
+
243
+ > Details: [Architecture & plugin system](docs/architecture.md)
182
244
 
183
245
  ---
184
246
 
185
- ## Configuration
186
-
187
- Optional. Works out of the box for standard Laravel + Vue projects.
188
-
189
- Create `.trace-mcp.json` in your project root (or add a `"trace-mcp"` key to `package.json`):
190
-
191
- ```jsonc
192
- {
193
- "root": ".",
194
- "include": [
195
- "app/**/*.php",
196
- "routes/**/*.php",
197
- "resources/**/*.vue",
198
- "resources/views/**/*.blade.php",
199
- "src/**/*.{ts,js,vue}"
200
- ],
201
- "exclude": [
202
- "vendor/**",
203
- "node_modules/**",
204
- "storage/**"
205
- ],
206
- "db": {
207
- "path": ".trace-mcp/index.db"
208
- },
209
- "frameworks": {
210
- "laravel": {
211
- "artisan": { "enabled": true, "timeout": 10000 },
212
- "graceful_degradation": true
213
- }
214
- },
215
- "security": {
216
- "max_file_size_bytes": 524288
217
- }
218
- }
219
- ```
247
+ ## Documentation
220
248
 
221
- Config is loaded via [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) — supports `.trace-mcp.json`, `.trace-mcp.yaml`, `package.json`, and more. All values validated with [Zod](https://zod.dev). Environment variable overrides available.
249
+ | Document | Description |
250
+ |---|---|
251
+ | [Supported frameworks](docs/supported-frameworks.md) | Complete list of languages, frameworks, ORMs, UI libraries, and what each extracts |
252
+ | [Tools reference](docs/tools-reference.md) | All 38 MCP tools with descriptions and usage examples |
253
+ | [Configuration](docs/configuration.md) | Config options, AI setup, environment variables, security settings |
254
+ | [Architecture](docs/architecture.md) | How indexing works, plugin system, project structure, tech stack |
255
+ | [Development](docs/development.md) | Building, testing, contributing, adding new plugins |
222
256
 
223
257
  ---
224
258
 
225
- ## Tech stack
259
+ ## Multi-repo federation
226
260
 
227
- | Component | Technology |
228
- |---|---|
229
- | Parsing | [tree-sitter](https://tree-sitter.github.io/) (PHP, TypeScript), [@vue/compiler-sfc](https://github.com/vuejs/core) (Vue SFCs) |
230
- | Database | [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) — WAL mode, FTS5 full-text search |
231
- | Module resolution | [oxc-resolver](https://github.com/nicolo-ribaudo/oxc-resolver) (ESM/CJS), PSR-4 (PHP autoloading) |
232
- | Validation | [Zod](https://zod.dev) — config + input validation |
233
- | Error handling | [neverthrow](https://github.com/supermacro/neverthrow) — Rust-style `Result<T, E>` types |
234
- | MCP | [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk) |
235
- | Build | tsup · vitest · TypeScript 5.7 |
261
+ Real projects are not a single repository. trace-mcp can **link dependency graphs across separate repos** — if microservice A calls an API endpoint in microservice B, trace-mcp knows that changing that endpoint in B breaks clients in A.
236
262
 
237
- ---
263
+ ### How it works
238
264
 
239
- ## Security
265
+ Federation is **automatic by default**. Every time a project is indexed (`serve`, `serve-http`, or `index`), trace-mcp:
240
266
 
241
- - **Path traversal protection** all file access validated against project root
242
- - **Symlink detection** prevents escape from project boundary
243
- - **Secret pattern filtering**configurable regex patterns
244
- - **File size limits** per-file byte cap
245
- - **Artisan whitelist** only safe artisan commands allowed (when Laravel integration is enabled)
267
+ 1. **Registers** the project in the global federation (`~/.trace-mcp/topology.db`)
268
+ 2. **Discovers** services (Docker Compose, workspace detection)
269
+ 3. **Parses** API contractsOpenAPI/Swagger, GraphQL SDL, Protobuf/gRPC
270
+ 4. **Scans** code for HTTP client calls (fetch, axios, Http::, requests, http.Get, gRPC stubs, GraphQL operations)
271
+ 5. **Links** discovered calls to known endpoints from previously indexed repos
272
+ 6. **Creates** cross-repo dependency edges
246
273
 
247
- ---
274
+ ### Example
248
275
 
249
- ## Development
276
+ ```bash
277
+ # Index two separate repos
278
+ cd ~/projects/user-service && trace-mcp add
279
+ cd ~/projects/order-service && trace-mcp add
280
+
281
+ # order-service has: axios.get('/api/users/{id}')
282
+ # user-service has: openapi.yaml with GET /api/users/{id}
283
+ # → trace-mcp automatically links them
284
+
285
+ # Check cross-repo impact
286
+ trace-mcp federation impact --endpoint=/api/users
287
+ # → "GET /api/users/{id} is called by 2 client(s) in 1 repo(s)"
288
+ # [order-service] src/services/user-client.ts:42 (axios, confidence: 85%)
289
+ ```
290
+
291
+ ### Federation CLI
250
292
 
251
293
  ```bash
252
- git clone https://github.com/nickvysotskyi/trace-mcp.git
253
- cd trace-mcp
254
- npm install
255
- npm run build
256
- npm test # 286 tests
257
- npm run dev # watch mode (tsup)
258
- npm run serve # start MCP server (dev)
294
+ trace-mcp federation add --repo=../service-b [--contract=openapi.yaml]
295
+ trace-mcp federation remove <name-or-path>
296
+ trace-mcp federation list [--json]
297
+ trace-mcp federation sync # re-scan all repos
298
+ trace-mcp federation impact --endpoint=/api/users [--method=GET] [--service=user-svc]
259
299
  ```
260
300
 
261
- ### Project structure
301
+ ### MCP tools
262
302
 
303
+ | Tool | What it does |
304
+ |---|---|
305
+ | `get_federation_graph` | All federated repos, their connections, and stats |
306
+ | `get_federation_impact` | Cross-repo impact: what breaks if endpoint X changes (resolves to symbol level) |
307
+ | `get_federation_clients` | Find all client calls across repos that call a specific endpoint |
308
+ | `federation_add_repo` | Add a repo to the federation via MCP |
309
+ | `federation_sync` | Re-scan all federated repos |
310
+
311
+ > Federation builds on top of the topology system. See [Configuration](docs/configuration.md#topology--federation) for options.
312
+
313
+ ---
314
+
315
+ ## CI/PR change impact reports
316
+
317
+ trace-mcp can generate automated change impact reports for pull requests — blast radius, risk scoring, test coverage gaps, architecture violations, and dead code detection.
318
+
319
+ ### CLI usage
320
+
321
+ ```bash
322
+ # Generate a markdown report for changes between main and HEAD
323
+ trace-mcp ci-report --base main --head HEAD
324
+
325
+ # Output to file
326
+ trace-mcp ci-report --base main --head HEAD --format markdown --output report.md
327
+
328
+ # JSON output
329
+ trace-mcp ci-report --base main --head HEAD --format json
330
+
331
+ # Fail CI if risk level >= high
332
+ trace-mcp ci-report --base main --head HEAD --fail-on high
333
+
334
+ # Index before generating (for CI environments without pre-built index)
335
+ trace-mcp ci-report --base main --head HEAD --index
263
336
  ```
264
- src/
265
- ├── db/ # SQLite schema, store, FTS5
266
- ├── indexer/
267
- │ ├── plugins/
268
- │ │ ├── language/ # PHP, TypeScript, Vue parsers
269
- │ │ └── framework/ # Laravel, Vue, Inertia, Nuxt, Blade
270
- │ ├── resolvers/ # PSR-4, ES module resolution
271
- │ └── pipeline.ts # Two-pass indexing engine
272
- ├── tools/ # MCP tool implementations
273
- ├── scoring/ # PageRank, BM25, hybrid scoring
274
- ├── plugin-api/ # Plugin registry + executor
275
- ├── server.ts # MCP server setup
276
- ├── config.ts # Cosmiconfig + Zod
277
- └── cli.ts # Commander CLI
337
+
338
+ ### GitHub Action
339
+
340
+ Add this workflow to get automatic impact reports on every PR:
341
+
342
+ ```yaml
343
+ # .github/workflows/ci.yml (impact-report job runs after build-and-test)
344
+ - name: Index project
345
+ run: node dist/cli.js index . --force
346
+
347
+ - name: Generate impact report
348
+ run: |
349
+ node dist/cli.js ci-report \
350
+ --base ${{ github.event.pull_request.base.sha }} \
351
+ --head ${{ github.event.pull_request.head.sha }} \
352
+ --format markdown \
353
+ --output report.md
354
+
355
+ - name: Post PR comment
356
+ uses: marocchino/sticky-pull-request-comment@v2
357
+ with:
358
+ path: report.md
278
359
  ```
279
360
 
361
+ The full workflow is in [`.github/workflows/ci.yml`](.github/workflows/ci.yml) — it runs `build → test → impact-report` on every PR.
362
+
363
+ ### Report sections
364
+
365
+ | Section | What it shows |
366
+ |---|---|
367
+ | **Summary** | Changed files, affected files count, risk level, gap counts |
368
+ | **Blast Radius** | Files transitively affected by changes (depth-2 reverse dependency traversal) |
369
+ | **Test Coverage Gaps** | Affected symbols with no matching test file |
370
+ | **Risk Analysis** | Per-file composite score: 30% complexity + 25% churn + 25% coupling + 20% blast radius |
371
+ | **Architecture Violations** | Layer rule violations involving changed files (auto-detects clean architecture / hexagonal presets) |
372
+ | **Dead Code** | New exports in changed files that nothing imports |
373
+
280
374
  ---
281
375
 
282
376
  ## Best for
283
377
 
284
- - Laravel + Vue / Inertia / Nuxt full-stack projects
378
+ - **Full-stack projects** in any supported framework combination
285
379
  - Teams using AI agents (Claude, Cursor, Windsurf) for day-to-day development
286
- - Projects where PHP ↔ JavaScript boundaries create blind spots
287
- - CI/CD environments where a running database isn't available
380
+ - **Multi-language codebases** where PHP ↔ JavaScript ↔ Python boundaries create blind spots
381
+ - **Monorepos** with multiple services and shared libraries
382
+ - **Microservice architectures** where API changes ripple across repos
288
383
  - Large codebases where agents waste tokens re-reading files
289
384
 
290
385
  ---
291
386
 
292
387
  ## License
293
388
 
294
- [Elastic License 2.0](LICENSE) — free for personal and internal use. See LICENSE for full terms.
389
+ [Elastic License 2.0 + Ethical Use Addendum](LICENSE) — free for personal and internal use. See LICENSE for full terms.
295
390
 
296
391
  ---
297
392