mcpgraph 0.1.19 → 0.1.21
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 +69 -48
- package/dist/api.d.ts +8 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +13 -4
- package/dist/api.js.map +1 -1
- package/dist/config/expression-validator.d.ts.map +1 -1
- package/dist/config/expression-validator.js +12 -10
- package/dist/config/expression-validator.js.map +1 -1
- package/dist/config/loader.d.ts +8 -2
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +16 -2
- package/dist/config/loader.js.map +1 -1
- package/dist/config/mcp-loader.d.ts +13 -0
- package/dist/config/mcp-loader.d.ts.map +1 -0
- package/dist/config/mcp-loader.js +47 -0
- package/dist/config/mcp-loader.js.map +1 -0
- package/dist/config/schema.d.ts +292 -186
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +5 -6
- package/dist/config/schema.js.map +1 -1
- package/dist/errors/mcp-tool-error.d.ts +46 -0
- package/dist/errors/mcp-tool-error.d.ts.map +1 -0
- package/dist/errors/mcp-tool-error.js +63 -0
- package/dist/errors/mcp-tool-error.js.map +1 -0
- package/dist/execution/executor.d.ts +2 -2
- package/dist/execution/executor.d.ts.map +1 -1
- package/dist/execution/executor.js +11 -9
- package/dist/execution/executor.js.map +1 -1
- package/dist/execution/nodes/mcp-tool-executor.d.ts.map +1 -1
- package/dist/execution/nodes/mcp-tool-executor.js +49 -15
- package/dist/execution/nodes/mcp-tool-executor.js.map +1 -1
- package/dist/graph/validator.d.ts.map +1 -1
- package/dist/graph/validator.js +52 -69
- package/dist/graph/validator.js.map +1 -1
- package/dist/main.js +23 -5
- package/dist/main.js.map +1 -1
- package/dist/mcp/client-manager.d.ts +12 -0
- package/dist/mcp/client-manager.d.ts.map +1 -1
- package/dist/mcp/client-manager.js +38 -4
- package/dist/mcp/client-manager.js.map +1 -1
- package/dist/types/config.d.ts +4 -5
- package/dist/types/config.d.ts.map +1 -1
- package/docs/building.md +76 -0
- package/docs/design.md +55 -43
- package/docs/github-pages-setup.md +492 -0
- package/docs/introspection-debugging.md +1 -1
- package/examples/api-usage.ts +3 -3
- package/examples/count_files.yaml +47 -52
- package/examples/loop_example.yaml +55 -58
- package/examples/switch_example.yaml +48 -55
- package/examples/test_minimal.yaml +23 -0
- package/package.json +2 -2
package/dist/config/schema.d.ts
CHANGED
|
@@ -2,22 +2,74 @@
|
|
|
2
2
|
* Zod schemas for validating mcpGraph configuration
|
|
3
3
|
*/
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
export declare const serverConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
6
|
+
type: z.ZodOptional<z.ZodLiteral<"stdio">>;
|
|
7
|
+
command: z.ZodString;
|
|
8
|
+
args: z.ZodArray<z.ZodString, "many">;
|
|
9
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
command: string;
|
|
12
|
+
args: string[];
|
|
13
|
+
type?: "stdio" | undefined;
|
|
14
|
+
cwd?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
command: string;
|
|
17
|
+
args: string[];
|
|
18
|
+
type?: "stdio" | undefined;
|
|
19
|
+
cwd?: string | undefined;
|
|
20
|
+
}>, z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"sse">;
|
|
22
|
+
url: z.ZodString;
|
|
23
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
eventSourceInit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
+
requestInit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
type: "sse";
|
|
28
|
+
url: string;
|
|
29
|
+
headers?: Record<string, string> | undefined;
|
|
30
|
+
eventSourceInit?: Record<string, unknown> | undefined;
|
|
31
|
+
requestInit?: Record<string, unknown> | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
type: "sse";
|
|
34
|
+
url: string;
|
|
35
|
+
headers?: Record<string, string> | undefined;
|
|
36
|
+
eventSourceInit?: Record<string, unknown> | undefined;
|
|
37
|
+
requestInit?: Record<string, unknown> | undefined;
|
|
38
|
+
}>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"streamableHttp">;
|
|
40
|
+
url: z.ZodString;
|
|
41
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
42
|
+
requestInit: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "streamableHttp";
|
|
45
|
+
url: string;
|
|
46
|
+
headers?: Record<string, string> | undefined;
|
|
47
|
+
requestInit?: Record<string, unknown> | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
type: "streamableHttp";
|
|
50
|
+
url: string;
|
|
51
|
+
headers?: Record<string, string> | undefined;
|
|
52
|
+
requestInit?: Record<string, unknown> | undefined;
|
|
53
|
+
}>]>;
|
|
5
54
|
export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
6
55
|
version: z.ZodString;
|
|
7
56
|
server: z.ZodObject<{
|
|
8
57
|
name: z.ZodString;
|
|
9
58
|
version: z.ZodString;
|
|
10
|
-
|
|
59
|
+
title: z.ZodOptional<z.ZodString>;
|
|
60
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
11
61
|
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
description: string;
|
|
13
62
|
name: string;
|
|
14
63
|
version: string;
|
|
64
|
+
title?: string | undefined;
|
|
65
|
+
instructions?: string | undefined;
|
|
15
66
|
}, {
|
|
16
|
-
description: string;
|
|
17
67
|
name: string;
|
|
18
68
|
version: string;
|
|
69
|
+
title?: string | undefined;
|
|
70
|
+
instructions?: string | undefined;
|
|
19
71
|
}>;
|
|
20
|
-
|
|
72
|
+
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
21
73
|
type: z.ZodOptional<z.ZodLiteral<"stdio">>;
|
|
22
74
|
command: z.ZodString;
|
|
23
75
|
args: z.ZodArray<z.ZodString, "many">;
|
|
@@ -141,6 +193,112 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
|
141
193
|
}> | undefined;
|
|
142
194
|
required?: string[] | undefined;
|
|
143
195
|
}>;
|
|
196
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
} & {
|
|
199
|
+
type: z.ZodLiteral<"entry">;
|
|
200
|
+
next: z.ZodString;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
type: "entry";
|
|
203
|
+
id: string;
|
|
204
|
+
next: string;
|
|
205
|
+
}, {
|
|
206
|
+
type: "entry";
|
|
207
|
+
id: string;
|
|
208
|
+
next: string;
|
|
209
|
+
}>, z.ZodObject<{
|
|
210
|
+
id: z.ZodString;
|
|
211
|
+
next: z.ZodOptional<z.ZodString>;
|
|
212
|
+
} & {
|
|
213
|
+
type: z.ZodLiteral<"exit">;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
type: "exit";
|
|
216
|
+
id: string;
|
|
217
|
+
next?: string | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
type: "exit";
|
|
220
|
+
id: string;
|
|
221
|
+
next?: string | undefined;
|
|
222
|
+
}>, z.ZodObject<{
|
|
223
|
+
id: z.ZodString;
|
|
224
|
+
} & {
|
|
225
|
+
type: z.ZodLiteral<"mcp">;
|
|
226
|
+
server: z.ZodString;
|
|
227
|
+
tool: z.ZodString;
|
|
228
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
229
|
+
next: z.ZodString;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
type: "mcp";
|
|
232
|
+
args: Record<string, unknown>;
|
|
233
|
+
id: string;
|
|
234
|
+
next: string;
|
|
235
|
+
server: string;
|
|
236
|
+
tool: string;
|
|
237
|
+
}, {
|
|
238
|
+
type: "mcp";
|
|
239
|
+
args: Record<string, unknown>;
|
|
240
|
+
id: string;
|
|
241
|
+
next: string;
|
|
242
|
+
server: string;
|
|
243
|
+
tool: string;
|
|
244
|
+
}>, z.ZodObject<{
|
|
245
|
+
id: z.ZodString;
|
|
246
|
+
} & {
|
|
247
|
+
type: z.ZodLiteral<"transform">;
|
|
248
|
+
transform: z.ZodObject<{
|
|
249
|
+
expr: z.ZodString;
|
|
250
|
+
}, "strip", z.ZodTypeAny, {
|
|
251
|
+
expr: string;
|
|
252
|
+
}, {
|
|
253
|
+
expr: string;
|
|
254
|
+
}>;
|
|
255
|
+
next: z.ZodString;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
type: "transform";
|
|
258
|
+
id: string;
|
|
259
|
+
next: string;
|
|
260
|
+
transform: {
|
|
261
|
+
expr: string;
|
|
262
|
+
};
|
|
263
|
+
}, {
|
|
264
|
+
type: "transform";
|
|
265
|
+
id: string;
|
|
266
|
+
next: string;
|
|
267
|
+
transform: {
|
|
268
|
+
expr: string;
|
|
269
|
+
};
|
|
270
|
+
}>, z.ZodObject<{
|
|
271
|
+
id: z.ZodString;
|
|
272
|
+
next: z.ZodOptional<z.ZodString>;
|
|
273
|
+
} & {
|
|
274
|
+
type: z.ZodLiteral<"switch">;
|
|
275
|
+
conditions: z.ZodArray<z.ZodObject<{
|
|
276
|
+
rule: z.ZodOptional<z.ZodUnknown>;
|
|
277
|
+
target: z.ZodString;
|
|
278
|
+
}, "strip", z.ZodTypeAny, {
|
|
279
|
+
target: string;
|
|
280
|
+
rule?: unknown;
|
|
281
|
+
}, {
|
|
282
|
+
target: string;
|
|
283
|
+
rule?: unknown;
|
|
284
|
+
}>, "many">;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
type: "switch";
|
|
287
|
+
id: string;
|
|
288
|
+
conditions: {
|
|
289
|
+
target: string;
|
|
290
|
+
rule?: unknown;
|
|
291
|
+
}[];
|
|
292
|
+
next?: string | undefined;
|
|
293
|
+
}, {
|
|
294
|
+
type: "switch";
|
|
295
|
+
id: string;
|
|
296
|
+
conditions: {
|
|
297
|
+
target: string;
|
|
298
|
+
rule?: unknown;
|
|
299
|
+
}[];
|
|
300
|
+
next?: string | undefined;
|
|
301
|
+
}>]>, "many">;
|
|
144
302
|
}, "strip", z.ZodTypeAny, {
|
|
145
303
|
description: string;
|
|
146
304
|
name: string;
|
|
@@ -162,6 +320,37 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
|
162
320
|
}> | undefined;
|
|
163
321
|
required?: string[] | undefined;
|
|
164
322
|
};
|
|
323
|
+
nodes: ({
|
|
324
|
+
type: "entry";
|
|
325
|
+
id: string;
|
|
326
|
+
next: string;
|
|
327
|
+
} | {
|
|
328
|
+
type: "exit";
|
|
329
|
+
id: string;
|
|
330
|
+
next?: string | undefined;
|
|
331
|
+
} | {
|
|
332
|
+
type: "mcp";
|
|
333
|
+
args: Record<string, unknown>;
|
|
334
|
+
id: string;
|
|
335
|
+
next: string;
|
|
336
|
+
server: string;
|
|
337
|
+
tool: string;
|
|
338
|
+
} | {
|
|
339
|
+
type: "transform";
|
|
340
|
+
id: string;
|
|
341
|
+
next: string;
|
|
342
|
+
transform: {
|
|
343
|
+
expr: string;
|
|
344
|
+
};
|
|
345
|
+
} | {
|
|
346
|
+
type: "switch";
|
|
347
|
+
id: string;
|
|
348
|
+
conditions: {
|
|
349
|
+
target: string;
|
|
350
|
+
rule?: unknown;
|
|
351
|
+
}[];
|
|
352
|
+
next?: string | undefined;
|
|
353
|
+
})[];
|
|
165
354
|
}, {
|
|
166
355
|
description: string;
|
|
167
356
|
name: string;
|
|
@@ -183,125 +372,45 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
|
183
372
|
}> | undefined;
|
|
184
373
|
required?: string[] | undefined;
|
|
185
374
|
};
|
|
375
|
+
nodes: ({
|
|
376
|
+
type: "entry";
|
|
377
|
+
id: string;
|
|
378
|
+
next: string;
|
|
379
|
+
} | {
|
|
380
|
+
type: "exit";
|
|
381
|
+
id: string;
|
|
382
|
+
next?: string | undefined;
|
|
383
|
+
} | {
|
|
384
|
+
type: "mcp";
|
|
385
|
+
args: Record<string, unknown>;
|
|
386
|
+
id: string;
|
|
387
|
+
next: string;
|
|
388
|
+
server: string;
|
|
389
|
+
tool: string;
|
|
390
|
+
} | {
|
|
391
|
+
type: "transform";
|
|
392
|
+
id: string;
|
|
393
|
+
next: string;
|
|
394
|
+
transform: {
|
|
395
|
+
expr: string;
|
|
396
|
+
};
|
|
397
|
+
} | {
|
|
398
|
+
type: "switch";
|
|
399
|
+
id: string;
|
|
400
|
+
conditions: {
|
|
401
|
+
target: string;
|
|
402
|
+
rule?: unknown;
|
|
403
|
+
}[];
|
|
404
|
+
next?: string | undefined;
|
|
405
|
+
})[];
|
|
186
406
|
}>, "many">;
|
|
187
|
-
nodes: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
188
|
-
id: z.ZodString;
|
|
189
|
-
} & {
|
|
190
|
-
type: z.ZodLiteral<"entry">;
|
|
191
|
-
tool: z.ZodString;
|
|
192
|
-
next: z.ZodString;
|
|
193
|
-
}, "strip", z.ZodTypeAny, {
|
|
194
|
-
type: "entry";
|
|
195
|
-
id: string;
|
|
196
|
-
next: string;
|
|
197
|
-
tool: string;
|
|
198
|
-
}, {
|
|
199
|
-
type: "entry";
|
|
200
|
-
id: string;
|
|
201
|
-
next: string;
|
|
202
|
-
tool: string;
|
|
203
|
-
}>, z.ZodObject<{
|
|
204
|
-
id: z.ZodString;
|
|
205
|
-
next: z.ZodOptional<z.ZodString>;
|
|
206
|
-
} & {
|
|
207
|
-
type: z.ZodLiteral<"exit">;
|
|
208
|
-
tool: z.ZodString;
|
|
209
|
-
}, "strip", z.ZodTypeAny, {
|
|
210
|
-
type: "exit";
|
|
211
|
-
id: string;
|
|
212
|
-
tool: string;
|
|
213
|
-
next?: string | undefined;
|
|
214
|
-
}, {
|
|
215
|
-
type: "exit";
|
|
216
|
-
id: string;
|
|
217
|
-
tool: string;
|
|
218
|
-
next?: string | undefined;
|
|
219
|
-
}>, z.ZodObject<{
|
|
220
|
-
id: z.ZodString;
|
|
221
|
-
} & {
|
|
222
|
-
type: z.ZodLiteral<"mcp">;
|
|
223
|
-
server: z.ZodString;
|
|
224
|
-
tool: z.ZodString;
|
|
225
|
-
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
226
|
-
next: z.ZodString;
|
|
227
|
-
}, "strip", z.ZodTypeAny, {
|
|
228
|
-
type: "mcp";
|
|
229
|
-
args: Record<string, unknown>;
|
|
230
|
-
id: string;
|
|
231
|
-
next: string;
|
|
232
|
-
tool: string;
|
|
233
|
-
server: string;
|
|
234
|
-
}, {
|
|
235
|
-
type: "mcp";
|
|
236
|
-
args: Record<string, unknown>;
|
|
237
|
-
id: string;
|
|
238
|
-
next: string;
|
|
239
|
-
tool: string;
|
|
240
|
-
server: string;
|
|
241
|
-
}>, z.ZodObject<{
|
|
242
|
-
id: z.ZodString;
|
|
243
|
-
} & {
|
|
244
|
-
type: z.ZodLiteral<"transform">;
|
|
245
|
-
transform: z.ZodObject<{
|
|
246
|
-
expr: z.ZodString;
|
|
247
|
-
}, "strip", z.ZodTypeAny, {
|
|
248
|
-
expr: string;
|
|
249
|
-
}, {
|
|
250
|
-
expr: string;
|
|
251
|
-
}>;
|
|
252
|
-
next: z.ZodString;
|
|
253
|
-
}, "strip", z.ZodTypeAny, {
|
|
254
|
-
type: "transform";
|
|
255
|
-
id: string;
|
|
256
|
-
next: string;
|
|
257
|
-
transform: {
|
|
258
|
-
expr: string;
|
|
259
|
-
};
|
|
260
|
-
}, {
|
|
261
|
-
type: "transform";
|
|
262
|
-
id: string;
|
|
263
|
-
next: string;
|
|
264
|
-
transform: {
|
|
265
|
-
expr: string;
|
|
266
|
-
};
|
|
267
|
-
}>, z.ZodObject<{
|
|
268
|
-
id: z.ZodString;
|
|
269
|
-
next: z.ZodOptional<z.ZodString>;
|
|
270
|
-
} & {
|
|
271
|
-
type: z.ZodLiteral<"switch">;
|
|
272
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
273
|
-
rule: z.ZodOptional<z.ZodUnknown>;
|
|
274
|
-
target: z.ZodString;
|
|
275
|
-
}, "strip", z.ZodTypeAny, {
|
|
276
|
-
target: string;
|
|
277
|
-
rule?: unknown;
|
|
278
|
-
}, {
|
|
279
|
-
target: string;
|
|
280
|
-
rule?: unknown;
|
|
281
|
-
}>, "many">;
|
|
282
|
-
}, "strip", z.ZodTypeAny, {
|
|
283
|
-
type: "switch";
|
|
284
|
-
id: string;
|
|
285
|
-
conditions: {
|
|
286
|
-
target: string;
|
|
287
|
-
rule?: unknown;
|
|
288
|
-
}[];
|
|
289
|
-
next?: string | undefined;
|
|
290
|
-
}, {
|
|
291
|
-
type: "switch";
|
|
292
|
-
id: string;
|
|
293
|
-
conditions: {
|
|
294
|
-
target: string;
|
|
295
|
-
rule?: unknown;
|
|
296
|
-
}[];
|
|
297
|
-
next?: string | undefined;
|
|
298
|
-
}>]>, "many">;
|
|
299
407
|
}, "strip", z.ZodTypeAny, {
|
|
300
408
|
version: string;
|
|
301
409
|
server: {
|
|
302
|
-
description: string;
|
|
303
410
|
name: string;
|
|
304
411
|
version: string;
|
|
412
|
+
title?: string | undefined;
|
|
413
|
+
instructions?: string | undefined;
|
|
305
414
|
};
|
|
306
415
|
tools: {
|
|
307
416
|
description: string;
|
|
@@ -324,41 +433,39 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
|
324
433
|
}> | undefined;
|
|
325
434
|
required?: string[] | undefined;
|
|
326
435
|
};
|
|
436
|
+
nodes: ({
|
|
437
|
+
type: "entry";
|
|
438
|
+
id: string;
|
|
439
|
+
next: string;
|
|
440
|
+
} | {
|
|
441
|
+
type: "exit";
|
|
442
|
+
id: string;
|
|
443
|
+
next?: string | undefined;
|
|
444
|
+
} | {
|
|
445
|
+
type: "mcp";
|
|
446
|
+
args: Record<string, unknown>;
|
|
447
|
+
id: string;
|
|
448
|
+
next: string;
|
|
449
|
+
server: string;
|
|
450
|
+
tool: string;
|
|
451
|
+
} | {
|
|
452
|
+
type: "transform";
|
|
453
|
+
id: string;
|
|
454
|
+
next: string;
|
|
455
|
+
transform: {
|
|
456
|
+
expr: string;
|
|
457
|
+
};
|
|
458
|
+
} | {
|
|
459
|
+
type: "switch";
|
|
460
|
+
id: string;
|
|
461
|
+
conditions: {
|
|
462
|
+
target: string;
|
|
463
|
+
rule?: unknown;
|
|
464
|
+
}[];
|
|
465
|
+
next?: string | undefined;
|
|
466
|
+
})[];
|
|
327
467
|
}[];
|
|
328
|
-
|
|
329
|
-
type: "entry";
|
|
330
|
-
id: string;
|
|
331
|
-
next: string;
|
|
332
|
-
tool: string;
|
|
333
|
-
} | {
|
|
334
|
-
type: "exit";
|
|
335
|
-
id: string;
|
|
336
|
-
tool: string;
|
|
337
|
-
next?: string | undefined;
|
|
338
|
-
} | {
|
|
339
|
-
type: "mcp";
|
|
340
|
-
args: Record<string, unknown>;
|
|
341
|
-
id: string;
|
|
342
|
-
next: string;
|
|
343
|
-
tool: string;
|
|
344
|
-
server: string;
|
|
345
|
-
} | {
|
|
346
|
-
type: "transform";
|
|
347
|
-
id: string;
|
|
348
|
-
next: string;
|
|
349
|
-
transform: {
|
|
350
|
-
expr: string;
|
|
351
|
-
};
|
|
352
|
-
} | {
|
|
353
|
-
type: "switch";
|
|
354
|
-
id: string;
|
|
355
|
-
conditions: {
|
|
356
|
-
target: string;
|
|
357
|
-
rule?: unknown;
|
|
358
|
-
}[];
|
|
359
|
-
next?: string | undefined;
|
|
360
|
-
})[];
|
|
361
|
-
servers?: Record<string, {
|
|
468
|
+
mcpServers?: Record<string, {
|
|
362
469
|
command: string;
|
|
363
470
|
args: string[];
|
|
364
471
|
type?: "stdio" | undefined;
|
|
@@ -382,9 +489,10 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
|
382
489
|
}, {
|
|
383
490
|
version: string;
|
|
384
491
|
server: {
|
|
385
|
-
description: string;
|
|
386
492
|
name: string;
|
|
387
493
|
version: string;
|
|
494
|
+
title?: string | undefined;
|
|
495
|
+
instructions?: string | undefined;
|
|
388
496
|
};
|
|
389
497
|
tools: {
|
|
390
498
|
description: string;
|
|
@@ -407,41 +515,39 @@ export declare const mcpGraphConfigSchema: z.ZodObject<{
|
|
|
407
515
|
}> | undefined;
|
|
408
516
|
required?: string[] | undefined;
|
|
409
517
|
};
|
|
518
|
+
nodes: ({
|
|
519
|
+
type: "entry";
|
|
520
|
+
id: string;
|
|
521
|
+
next: string;
|
|
522
|
+
} | {
|
|
523
|
+
type: "exit";
|
|
524
|
+
id: string;
|
|
525
|
+
next?: string | undefined;
|
|
526
|
+
} | {
|
|
527
|
+
type: "mcp";
|
|
528
|
+
args: Record<string, unknown>;
|
|
529
|
+
id: string;
|
|
530
|
+
next: string;
|
|
531
|
+
server: string;
|
|
532
|
+
tool: string;
|
|
533
|
+
} | {
|
|
534
|
+
type: "transform";
|
|
535
|
+
id: string;
|
|
536
|
+
next: string;
|
|
537
|
+
transform: {
|
|
538
|
+
expr: string;
|
|
539
|
+
};
|
|
540
|
+
} | {
|
|
541
|
+
type: "switch";
|
|
542
|
+
id: string;
|
|
543
|
+
conditions: {
|
|
544
|
+
target: string;
|
|
545
|
+
rule?: unknown;
|
|
546
|
+
}[];
|
|
547
|
+
next?: string | undefined;
|
|
548
|
+
})[];
|
|
410
549
|
}[];
|
|
411
|
-
|
|
412
|
-
type: "entry";
|
|
413
|
-
id: string;
|
|
414
|
-
next: string;
|
|
415
|
-
tool: string;
|
|
416
|
-
} | {
|
|
417
|
-
type: "exit";
|
|
418
|
-
id: string;
|
|
419
|
-
tool: string;
|
|
420
|
-
next?: string | undefined;
|
|
421
|
-
} | {
|
|
422
|
-
type: "mcp";
|
|
423
|
-
args: Record<string, unknown>;
|
|
424
|
-
id: string;
|
|
425
|
-
next: string;
|
|
426
|
-
tool: string;
|
|
427
|
-
server: string;
|
|
428
|
-
} | {
|
|
429
|
-
type: "transform";
|
|
430
|
-
id: string;
|
|
431
|
-
next: string;
|
|
432
|
-
transform: {
|
|
433
|
-
expr: string;
|
|
434
|
-
};
|
|
435
|
-
} | {
|
|
436
|
-
type: "switch";
|
|
437
|
-
id: string;
|
|
438
|
-
conditions: {
|
|
439
|
-
target: string;
|
|
440
|
-
rule?: unknown;
|
|
441
|
-
}[];
|
|
442
|
-
next?: string | undefined;
|
|
443
|
-
})[];
|
|
444
|
-
servers?: Record<string, {
|
|
550
|
+
mcpServers?: Record<string, {
|
|
445
551
|
command: string;
|
|
446
552
|
args: string[];
|
|
447
553
|
type?: "stdio" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4CxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAO7B,CAAC;AAgEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM/B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/config/schema.js
CHANGED
|
@@ -15,7 +15,8 @@ const jsonSchemaSchema = z.object({
|
|
|
15
15
|
const serverMetadataSchema = z.object({
|
|
16
16
|
name: z.string(),
|
|
17
17
|
version: z.string(),
|
|
18
|
-
|
|
18
|
+
title: z.string().optional(), // Optional, defaults to name if not provided
|
|
19
|
+
instructions: z.string().optional(),
|
|
19
20
|
});
|
|
20
21
|
const stdioServerConfigSchema = z.object({
|
|
21
22
|
type: z.literal("stdio").optional(),
|
|
@@ -37,7 +38,7 @@ const streamableHttpServerConfigSchema = z.object({
|
|
|
37
38
|
requestInit: z.record(z.unknown()).optional(),
|
|
38
39
|
});
|
|
39
40
|
// Server config can be stdio (with or without type), sse, or streamableHttp
|
|
40
|
-
const serverConfigSchema = z.union([
|
|
41
|
+
export const serverConfigSchema = z.union([
|
|
41
42
|
// Stdio config (type optional, defaults to stdio)
|
|
42
43
|
stdioServerConfigSchema,
|
|
43
44
|
// SSE config (type required)
|
|
@@ -52,12 +53,10 @@ const baseNodeSchema = z.object({
|
|
|
52
53
|
});
|
|
53
54
|
const entryNodeSchema = baseNodeSchema.extend({
|
|
54
55
|
type: z.literal("entry"),
|
|
55
|
-
tool: z.string(),
|
|
56
56
|
next: z.string(),
|
|
57
57
|
});
|
|
58
58
|
const exitNodeSchema = baseNodeSchema.extend({
|
|
59
59
|
type: z.literal("exit"),
|
|
60
|
-
tool: z.string(),
|
|
61
60
|
});
|
|
62
61
|
const mcpNodeSchema = baseNodeSchema.extend({
|
|
63
62
|
type: z.literal("mcp"),
|
|
@@ -93,6 +92,7 @@ const toolDefinitionSchema = z.object({
|
|
|
93
92
|
description: z.string(),
|
|
94
93
|
inputSchema: jsonSchemaSchema,
|
|
95
94
|
outputSchema: jsonSchemaSchema,
|
|
95
|
+
nodes: z.array(nodeSchema),
|
|
96
96
|
});
|
|
97
97
|
const executionLimitsSchema = z.object({
|
|
98
98
|
maxNodeExecutions: z.number().int().positive().optional(),
|
|
@@ -101,9 +101,8 @@ const executionLimitsSchema = z.object({
|
|
|
101
101
|
export const mcpGraphConfigSchema = z.object({
|
|
102
102
|
version: z.string(),
|
|
103
103
|
server: serverMetadataSchema,
|
|
104
|
-
|
|
104
|
+
mcpServers: z.record(serverConfigSchema).optional(),
|
|
105
105
|
executionLimits: executionLimitsSchema.optional(),
|
|
106
106
|
tools: z.array(toolDefinitionSchema),
|
|
107
|
-
nodes: z.array(nodeSchema),
|
|
108
107
|
});
|
|
109
108
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,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,EAAE;IACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;CACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for MCP tool execution errors
|
|
3
|
+
*/
|
|
4
|
+
import { McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when an MCP protocol-level error occurs during tool execution
|
|
7
|
+
* (e.g., connection failures, transport errors, server crashes)
|
|
8
|
+
*
|
|
9
|
+
* Extends McpError to preserve MCP error structure (code, message, data)
|
|
10
|
+
* and adds stderr output from the MCP server process
|
|
11
|
+
*/
|
|
12
|
+
export declare class ToolCallMcpError extends McpError {
|
|
13
|
+
/**
|
|
14
|
+
* Array of stderr lines captured from the MCP server process
|
|
15
|
+
* This is particularly useful for stdio-based MCP servers that write
|
|
16
|
+
* detailed error information to stderr
|
|
17
|
+
*/
|
|
18
|
+
readonly stderr: string[];
|
|
19
|
+
constructor(mcpError: McpError, stderr: string[]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Error thrown when an MCP tool call completes successfully at the protocol level,
|
|
23
|
+
* but the tool itself returns an error response (result.isError = true)
|
|
24
|
+
*
|
|
25
|
+
* This represents a logical failure in the tool execution, not a protocol failure.
|
|
26
|
+
* The full result object is preserved for inspection.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ToolCallError extends Error {
|
|
29
|
+
/**
|
|
30
|
+
* The complete result object from the MCP tool call
|
|
31
|
+
* This includes the error response, content, and any other result properties
|
|
32
|
+
*/
|
|
33
|
+
readonly result: {
|
|
34
|
+
isError?: boolean;
|
|
35
|
+
content: unknown[];
|
|
36
|
+
error?: unknown;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
constructor(result: {
|
|
40
|
+
isError?: boolean;
|
|
41
|
+
content: unknown[];
|
|
42
|
+
error?: unknown;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=mcp-tool-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tool-error.d.ts","sourceRoot":"","sources":["../../src/errors/mcp-tool-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C;;;;OAIG;IACH,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAC;gBAG/B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EAAE;CAYnB;AAED;;;;;;GAMG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC;;;OAGG;IACH,SAAgB,MAAM,EAAE;QACtB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;gBAEU,MAAM,EAAE;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB;CAqBF"}
|