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
|
@@ -4,7 +4,8 @@ version: "1.0"
|
|
|
4
4
|
server:
|
|
5
5
|
name: "loopExample"
|
|
6
6
|
version: "1.0.0"
|
|
7
|
-
|
|
7
|
+
title: "Loop Example"
|
|
8
|
+
instructions: "This example demonstrates loops and execution history functions like $executionCount() and $nodeExecution()."
|
|
8
9
|
|
|
9
10
|
# Tool Definitions
|
|
10
11
|
tools:
|
|
@@ -24,61 +25,57 @@ tools:
|
|
|
24
25
|
sum:
|
|
25
26
|
type: "number"
|
|
26
27
|
description: "The sum from 1 to n"
|
|
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
|
-
|
|
28
|
+
nodes:
|
|
29
|
+
# Entry node: Receives tool arguments
|
|
30
|
+
- id: "entry_sum"
|
|
31
|
+
type: "entry"
|
|
32
|
+
next: "increment_node"
|
|
33
|
+
|
|
34
|
+
# Increment counter and add to sum
|
|
35
|
+
# Uses $nodeExecution() to get the previous iteration of this node
|
|
36
|
+
# First iteration: $executionCount("increment_node") = 0, so we initialize
|
|
37
|
+
# Subsequent iterations: $nodeExecution("increment_node", -1) gets the last execution
|
|
38
|
+
- id: "increment_node"
|
|
39
|
+
type: "transform"
|
|
40
|
+
transform:
|
|
41
|
+
expr: |
|
|
42
|
+
$executionCount("increment_node") = 0
|
|
43
|
+
? {
|
|
44
|
+
"counter": 1,
|
|
45
|
+
"sum": 1,
|
|
46
|
+
"target": $.entry_sum.n
|
|
47
|
+
}
|
|
48
|
+
: {
|
|
49
|
+
"counter": $nodeExecution("increment_node", -1).counter + 1,
|
|
50
|
+
"sum": $nodeExecution("increment_node", -1).sum + $nodeExecution("increment_node", -1).counter + 1,
|
|
51
|
+
"target": $.entry_sum.n
|
|
52
|
+
}
|
|
53
|
+
next: "check_condition"
|
|
54
|
+
|
|
55
|
+
# Check if we should continue looping
|
|
56
|
+
- id: "check_condition"
|
|
57
|
+
type: "switch"
|
|
58
|
+
conditions:
|
|
59
|
+
- rule:
|
|
60
|
+
"<": [{"var": "$.increment_node.counter"}, {"var": "$.increment_node.target"}]
|
|
61
|
+
target: "increment_node"
|
|
62
|
+
- target: "exit_sum"
|
|
63
|
+
|
|
64
|
+
# Exit node: Extracts the sum from increment_node
|
|
65
|
+
# Uses $previousNode() to verify it returns the switch node's output (target node ID)
|
|
66
|
+
# The output matches the tool's outputSchema (just the sum)
|
|
67
|
+
- id: "exit_sum"
|
|
68
|
+
type: "transform"
|
|
69
|
+
transform:
|
|
70
|
+
expr: |
|
|
71
|
+
$previousNode() = "exit_sum" ? {
|
|
72
|
+
"sum": $.increment_node.sum
|
|
73
|
+
} : {
|
|
74
|
+
"sum": 0,
|
|
75
|
+
"error": "previousNode check failed"
|
|
54
76
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
conditions:
|
|
61
|
-
- rule:
|
|
62
|
-
"<": [{"var": "$.increment_node.counter"}, {"var": "$.increment_node.target"}]
|
|
63
|
-
target: "increment_node"
|
|
64
|
-
- target: "exit_sum"
|
|
65
|
-
|
|
66
|
-
# Exit node: Extracts the sum from increment_node
|
|
67
|
-
# Uses $previousNode() to verify it returns the switch node's output (target node ID)
|
|
68
|
-
# The output matches the tool's outputSchema (just the sum)
|
|
69
|
-
- id: "exit_sum"
|
|
70
|
-
type: "transform"
|
|
71
|
-
transform:
|
|
72
|
-
expr: |
|
|
73
|
-
$previousNode() = "exit_sum" ? {
|
|
74
|
-
"sum": $.increment_node.sum
|
|
75
|
-
} : {
|
|
76
|
-
"sum": 0,
|
|
77
|
-
"error": "previousNode check failed"
|
|
78
|
-
}
|
|
79
|
-
next: "exit_sum_final"
|
|
80
|
-
|
|
81
|
-
# Final exit node
|
|
82
|
-
- id: "exit_sum_final"
|
|
83
|
-
type: "exit"
|
|
84
|
-
tool: "sum_to_n"
|
|
77
|
+
next: "exit_sum_final"
|
|
78
|
+
|
|
79
|
+
# Final exit node
|
|
80
|
+
- id: "exit_sum_final"
|
|
81
|
+
type: "exit"
|
|
@@ -4,7 +4,8 @@ version: "1.0"
|
|
|
4
4
|
server:
|
|
5
5
|
name: "switchExample"
|
|
6
6
|
version: "1.0.0"
|
|
7
|
-
|
|
7
|
+
title: "Switch Node Example"
|
|
8
|
+
instructions: "This example demonstrates conditional routing using switch nodes with JSON Logic."
|
|
8
9
|
|
|
9
10
|
# Tool Definitions
|
|
10
11
|
tools:
|
|
@@ -24,57 +25,49 @@ tools:
|
|
|
24
25
|
result:
|
|
25
26
|
type: "string"
|
|
26
27
|
description: "The routing result"
|
|
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
|
-
{ "result": "zero_or_negative" }
|
|
74
|
-
next: "exit"
|
|
75
|
-
|
|
76
|
-
# Exit node: Returns the result
|
|
77
|
-
- id: "exit"
|
|
78
|
-
type: "exit"
|
|
79
|
-
tool: "test_switch"
|
|
80
|
-
|
|
28
|
+
nodes:
|
|
29
|
+
# Entry node: Receives tool arguments
|
|
30
|
+
- id: "entry"
|
|
31
|
+
type: "entry"
|
|
32
|
+
next: "switch_node"
|
|
33
|
+
|
|
34
|
+
# Switch node: Routes based on value
|
|
35
|
+
- id: "switch_node"
|
|
36
|
+
type: "switch"
|
|
37
|
+
conditions:
|
|
38
|
+
- rule:
|
|
39
|
+
">":
|
|
40
|
+
- { var: "entry.value" }
|
|
41
|
+
- 10
|
|
42
|
+
target: "high_path"
|
|
43
|
+
- rule:
|
|
44
|
+
">":
|
|
45
|
+
- { var: "entry.value" }
|
|
46
|
+
- 0
|
|
47
|
+
target: "low_path"
|
|
48
|
+
- target: "zero_path"
|
|
49
|
+
|
|
50
|
+
# High path (> 10)
|
|
51
|
+
- id: "high_path"
|
|
52
|
+
type: "transform"
|
|
53
|
+
transform:
|
|
54
|
+
expr: '{ "result": "high" }'
|
|
55
|
+
next: "exit"
|
|
56
|
+
|
|
57
|
+
# Low path (> 0 but <= 10)
|
|
58
|
+
- id: "low_path"
|
|
59
|
+
type: "transform"
|
|
60
|
+
transform:
|
|
61
|
+
expr: '{ "result": "low" }'
|
|
62
|
+
next: "exit"
|
|
63
|
+
|
|
64
|
+
# Zero/negative path (default)
|
|
65
|
+
- id: "zero_path"
|
|
66
|
+
type: "transform"
|
|
67
|
+
transform:
|
|
68
|
+
expr: '{ "result": "zero_or_negative" }'
|
|
69
|
+
next: "exit"
|
|
70
|
+
|
|
71
|
+
# Exit node: Returns the result
|
|
72
|
+
- id: "exit"
|
|
73
|
+
type: "exit"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
|
|
3
|
+
# MCP Server Metadata - minimal config for testing defaults
|
|
4
|
+
# No title (should default to name)
|
|
5
|
+
# No instructions (should be undefined)
|
|
6
|
+
server:
|
|
7
|
+
name: "testMinimal"
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
|
|
10
|
+
# Tool Definitions
|
|
11
|
+
tools:
|
|
12
|
+
- name: "test_tool"
|
|
13
|
+
description: "Test tool"
|
|
14
|
+
inputSchema:
|
|
15
|
+
type: "object"
|
|
16
|
+
outputSchema:
|
|
17
|
+
type: "object"
|
|
18
|
+
nodes:
|
|
19
|
+
- id: "entry"
|
|
20
|
+
type: "entry"
|
|
21
|
+
next: "exit"
|
|
22
|
+
- id: "exit"
|
|
23
|
+
type: "exit"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcpgraph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "MCP server that executes directed graphs of MCP server calls",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"start": "node dist/main.js",
|
|
29
29
|
"dev": "tsx src/main.ts",
|
|
30
30
|
"watch": "tsc --watch",
|
|
31
|
-
"test": "tsx --test tests/*.test.ts",
|
|
31
|
+
"test": "tsx --test --test-timeout=30000 tests/*.test.ts",
|
|
32
32
|
"prepublishOnly": "npm run build"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|