-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_index.yaml
More file actions
393 lines (361 loc) · 10.6 KB
/
Copy path_index.yaml
File metadata and controls
393 lines (361 loc) · 10.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
version: "1.0"
namespace: code_graph
entries:
- name: definition
kind: ns.definition
readme: file://README.md
meta:
title: Code Graph
description: Cross-file PHP code analysis — dependency trees, call chains, usage search
# ===========================================================================
# Dependencies
# ===========================================================================
- name: dependency.mcp
kind: ns.dependency
component: butschster/mcp-server
version: ">=0.1.0"
# ===========================================================================
# Shared Libraries
# ===========================================================================
- name: php_extractor
kind: library.lua
source: file://php_extractor.lua
modules:
- treesitter
- name: resolver_lib
kind: library.lua
source: file://resolver_lib.lua
- name: graph_lib
kind: library.lua
source: file://graph_lib.lua
- name: index_lib
kind: library.lua
source: file://index_lib.lua
modules:
- fs
- registry
- treesitter
- json
- logger
imports:
extractor: code_graph:php_extractor
resolver: code_graph:resolver_lib
graph: code_graph:graph_lib
- name: query_lib
kind: library.lua
source: file://query_lib.lua
imports:
graph: code_graph:graph_lib
- name: format_lib
kind: library.lua
source: file://format_lib.lua
- name: tool_lib
kind: library.lua
source: file://tool_lib.lua
modules:
- time
# ===========================================================================
# Index Process (Actor)
# ===========================================================================
- name: processes
kind: process.host
host:
workers: 8
lifecycle:
auto_start: true
- name: index_process
kind: process.lua
source: file://index_process.lua
method: main
modules:
- fs
- registry
- treesitter
- json
- logger
- time
imports:
index_lib: code_graph:index_lib
query_lib: code_graph:query_lib
graph: code_graph:graph_lib
- name: index_service
kind: process.service
process: code_graph:index_process
host: code_graph:processes
lifecycle:
auto_start: true
stable_threshold: 3s
restart:
max_attempts: 5
initial_delay: 2s
backoff_factor: 2.0
# ===========================================================================
# MCP Tools
# ===========================================================================
# --- code_index: trigger project indexing ---
- name: code_index
kind: function.lua
source: file://code_index.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_index"
mcp.description: >
Index a PHP project for cross-file analysis. Scans all .php files,
extracts classes, methods, functions, and all references (calls, type hints,
inheritance, imports). Must be run before other code_graph tools.
mcp.inputSchema:
type: "object"
properties:
project:
type: "string"
description: "Project identifier (uses default if omitted)"
path:
type: "string"
description: "Subdirectory to index (default: entire project)"
force:
type: "boolean"
description: "Force re-index even if already indexed"
mcp.annotations:
readOnlyHint: true
# --- code_deps: file dependency tree ---
- name: code_deps
kind: function.lua
source: file://code_deps.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_deps"
mcp.description: >
Show file/namespace dependency tree. Displays what a file imports
(and transitively) and what files import it.
mcp.inputSchema:
type: "object"
properties:
file:
type: "string"
description: "File path or class/namespace name to analyze"
direction:
type: "string"
enum: ["imports", "imported_by", "both"]
description: "Direction: imports, imported_by, both (default: both)"
depth:
type: "integer"
description: "Max transitive depth (default: 3, max: 10)"
minimum: 1
maximum: 10
project:
type: "string"
description: "Project identifier"
required:
- "file"
mcp.annotations:
readOnlyHint: true
# --- code_usages: find all references ---
- name: code_usages
kind: function.lua
source: file://code_usages.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_usages"
mcp.description: >
Find all references to a symbol (class, method, function) across the project.
Like "Find All References" in an IDE. Groups results by file.
mcp.inputSchema:
type: "object"
properties:
symbol:
type: "string"
description: "Symbol name — short ('OrderService') or FQN ('App\\Services\\OrderService') or method ('OrderService::process')"
kind:
type: "string"
enum: ["all", "instantiation", "static_call", "method_call", "type_hint", "extends", "implements", "import"]
description: "Filter by reference kind (default: all)"
project:
type: "string"
required:
- "symbol"
mcp.annotations:
readOnlyHint: true
# --- code_callers: call chain upward ---
- name: code_callers
kind: function.lua
source: file://code_callers.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_callers"
mcp.description: >
Find the call chain leading TO a function or method. Shows who calls it,
who calls those callers, etc. Useful for understanding entry points.
mcp.inputSchema:
type: "object"
properties:
symbol:
type: "string"
description: "Function/method — 'processPayment', 'OrderService::process', or FQN"
depth:
type: "integer"
description: "Levels of callers to trace (default: 3, max: 10)"
minimum: 1
maximum: 10
project:
type: "string"
required:
- "symbol"
mcp.annotations:
readOnlyHint: true
# --- code_callees: call chain downward ---
- name: code_callees
kind: function.lua
source: file://code_callees.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_callees"
mcp.description: >
Find what a function or method calls internally. Shows outgoing call tree.
mcp.inputSchema:
type: "object"
properties:
symbol:
type: "string"
description: "Function/method to analyze"
depth:
type: "integer"
description: "Depth to follow callees (default: 2, max: 10)"
minimum: 1
maximum: 10
project:
type: "string"
required:
- "symbol"
mcp.annotations:
readOnlyHint: true
# --- code_hierarchy: inheritance tree ---
- name: code_hierarchy
kind: function.lua
source: file://code_hierarchy.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_hierarchy"
mcp.description: >
Show inheritance and implementation tree for a class or interface.
Upward shows parent chain, downward shows all subclasses/implementations.
mcp.inputSchema:
type: "object"
properties:
symbol:
type: "string"
description: "Class or interface name"
direction:
type: "string"
enum: ["up", "down", "both"]
description: "up=ancestors, down=descendants, both (default)"
project:
type: "string"
required:
- "symbol"
mcp.annotations:
readOnlyHint: true
# --- code_impacted: impact analysis ---
- name: code_impacted
kind: function.lua
source: file://code_impacted.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_impacted"
mcp.description: >
Impact analysis: what files would be affected by changing a given file or symbol.
Follows reference chains transitively.
mcp.inputSchema:
type: "object"
properties:
file:
type: "string"
description: "File path or symbol name to analyze"
depth:
type: "integer"
description: "Transitive depth (default: 2, max: 5)"
minimum: 1
maximum: 5
project:
type: "string"
required:
- "file"
mcp.annotations:
readOnlyHint: true
# --- code_graph: visual graph export ---
- name: code_graph_viz
kind: function.lua
source: file://code_graph_viz.lua
method: call
modules:
- time
imports:
tools: code_graph:tool_lib
fmt: code_graph:format_lib
meta:
mcp.tool: true
mcp.name: "code_graph"
mcp.description: >
Generate a visual dependency or call graph in Mermaid format.
mcp.inputSchema:
type: "object"
properties:
symbol:
type: "string"
description: "Center of graph — file path or symbol name"
type:
type: "string"
enum: ["dependencies", "callers", "callees", "hierarchy"]
description: "Graph type (default: dependencies)"
depth:
type: "integer"
description: "Graph depth (default: 2, max: 5)"
minimum: 1
maximum: 5
project:
type: "string"
required:
- "symbol"
mcp.annotations:
readOnlyHint: true