@addai/flows-mcp 1.1.0 → 1.3.0

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.
Files changed (46) hide show
  1. package/README.md +191 -190
  2. package/dist/client.d.ts +20 -3
  3. package/dist/client.js +52 -8
  4. package/dist/client.js.map +1 -1
  5. package/dist/index.js +13 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/instructions.js +151 -150
  8. package/dist/instructions.js.map +1 -1
  9. package/dist/layout.js +17 -1
  10. package/dist/layout.js.map +1 -1
  11. package/dist/node-defaults.js +42 -1
  12. package/dist/node-defaults.js.map +1 -1
  13. package/dist/oauth.js +3 -3
  14. package/dist/plugin-eligibility.d.ts +1 -1
  15. package/dist/plugin-eligibility.js +2 -2
  16. package/dist/plugin-eligibility.js.map +1 -1
  17. package/dist/prompts.js +734 -728
  18. package/dist/prompts.js.map +1 -1
  19. package/dist/tools/discover.js +54 -1
  20. package/dist/tools/discover.js.map +1 -1
  21. package/dist/tools/flows.js +14 -5
  22. package/dist/tools/flows.js.map +1 -1
  23. package/dist/tools/nodes.d.ts +32 -0
  24. package/dist/tools/nodes.js +19 -3
  25. package/dist/tools/nodes.js.map +1 -1
  26. package/dist/tools/runs.js +61 -42
  27. package/dist/tools/runs.js.map +1 -1
  28. package/dist/tools/workspaces.d.ts +10 -1
  29. package/dist/tools/workspaces.js +131 -4
  30. package/dist/tools/workspaces.js.map +1 -1
  31. package/dist/v2-client.d.ts +5 -0
  32. package/dist/v2-client.js +11 -0
  33. package/dist/v2-client.js.map +1 -1
  34. package/dist/validation/enums.d.ts +1 -1
  35. package/dist/validation/enums.js +3 -2
  36. package/dist/validation/enums.js.map +1 -1
  37. package/dist/validation/shape-rules.js +38 -0
  38. package/dist/validation/shape-rules.js.map +1 -1
  39. package/dist/workspace-state.d.ts +50 -0
  40. package/dist/workspace-state.js +121 -0
  41. package/dist/workspace-state.js.map +1 -0
  42. package/package.json +42 -42
  43. package/skill/SKILL.md +90 -89
  44. package/skill/anti-patterns.md +285 -285
  45. package/skill/flow-semantics.md +142 -142
  46. package/skill/recipes.md +294 -294
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "name": "@addai/flows-mcp",
3
- "version": "1.1.0",
4
- "description": "MCP server for +AI Flows - manage flows, nodes, runs, and more via AI assistants",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "flows-mcp": "dist/index.js",
10
- "flows-mcp-install": "dist/bin/install.js"
11
- },
12
- "scripts": {
13
- "build": "tsc",
14
- "dev": "tsc --watch",
15
- "start": "node dist/index.js",
16
- "test": "tsc -p tsconfig.test.json && node --test 'dist-test/test/**/*.test.js'",
17
- "gen:cheatsheet": "tsc -p tsconfig.test.json --outDir dist-test && node dist-test/scripts/gen-cheatsheet.js"
18
- },
19
- "dependencies": {
20
- "@modelcontextprotocol/sdk": "^1.12.1",
21
- "zod": "^3.23.0"
22
- },
23
- "devDependencies": {
24
- "typescript": "^5.7.0",
25
- "@types/node": "^22.0.0"
26
- },
27
- "engines": {
28
- "node": ">=18"
29
- },
30
- "keywords": [
31
- "mcp",
32
- "ai-flows",
33
- "addai",
34
- "claude",
35
- "model-context-protocol"
36
- ],
37
- "license": "MIT",
38
- "files": [
39
- "dist",
40
- "skill"
41
- ]
42
- }
1
+ {
2
+ "name": "@addai/flows-mcp",
3
+ "version": "1.3.0",
4
+ "description": "MCP server for +AI Flows - manage flows, nodes, runs, and more via AI assistants",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "flows-mcp": "dist/index.js",
10
+ "flows-mcp-install": "dist/bin/install.js"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc --watch",
15
+ "start": "node dist/index.js",
16
+ "test": "tsc -p tsconfig.test.json && node --test 'dist-test/test/**/*.test.js'",
17
+ "gen:cheatsheet": "tsc -p tsconfig.test.json --outDir dist-test && node dist-test/scripts/gen-cheatsheet.js"
18
+ },
19
+ "dependencies": {
20
+ "@modelcontextprotocol/sdk": "^1.12.1",
21
+ "zod": "^3.23.0"
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^5.7.0",
25
+ "@types/node": "^22.0.0"
26
+ },
27
+ "engines": {
28
+ "node": ">=18"
29
+ },
30
+ "keywords": [
31
+ "mcp",
32
+ "ai-flows",
33
+ "addai",
34
+ "claude",
35
+ "model-context-protocol"
36
+ ],
37
+ "license": "MIT",
38
+ "files": [
39
+ "dist",
40
+ "skill"
41
+ ]
42
+ }
package/skill/SKILL.md CHANGED
@@ -1,89 +1,90 @@
1
- ---
2
- name: building-aiflows
3
- description: Build, test, and publish +Ai Flows automations. Use whenever the user wants to create or modify a flow. Loaded automatically when the @addai/flows-mcp MCP server is connected.
4
- version: 2.1.0
5
- ---
6
-
7
- # Building +Ai Flows
8
-
9
- You have access to the +Ai Flows MCP server. This skill teaches you how to use it to build production-quality flows.
10
-
11
- ## Mental model
12
-
13
- A flow is a **directed graph**: nodes connected by edges. Execution starts at a trigger node and follows edges until it reaches a terminator (goal or exit) or fails.
14
-
15
- - **Nodes** do work — trigger an event, make an HTTP call, branch on a condition, send an email.
16
- - **Edges** define order. Most nodes have one outgoing edge. **Branching nodes** (`if`, `switch`, `loop`, `review`, `splitTest`, `aiSwitch`) have multiple, distinguished by `sourceHandle`.
17
- - **Variables** carry values between nodes via three distinct templating systems (see `flow-semantics.md`).
18
-
19
- ## The rigid workflow
20
-
21
- You MUST follow this loop. Each step has a named tool.
22
-
23
- ```
24
- 1. DISCOVER → list_node_types, describe_node_type, list_custom_nodes, describe_custom_node
25
- 2. DESIGN → propose_flow (NL → draft) [optional]
26
- 3. BUILD → create_flow, add_nodes, connect_nodes, set_variable
27
- 4. VALIDATE → validate_flow ← MUST PASS BEFORE TESTING
28
- 5. TEST → test_node (per uncertain node), test_flow / dry_run (end-to-end)
29
- 6. DEBUG → diagnose_run, replay_run, tail_logs [if test fails]
30
- 7. PUBLISH → pre_publish_check, then publish_flow / canary_publish
31
- ```
32
-
33
- **You have not finished if you did not validate and test before publishing.**
34
-
35
- ## Ten rules you must not break
36
-
37
- 1. **Never guess a node's config schema.** Call `describe_node_type(type)` first if you have not used this type in this session.
38
- 2. **NEVER pass a `position` to `add_nodes`. EVER.** It auto-places horizontally (left → right). If you pass positions you will get a vertical-stacked flow that the user has to manually fix. If positions get messy mid-build, call `autolayout` once at the end.
39
- 3. **A `page` node CAN be the terminator** — set `data.isGoal: true` (or `isExit: true`) with a `goalName`. Do NOT add a trailing `goal` node after a page. The page IS the goal. See `describe_node_type("page")` for the full field list.
40
- 4. **Never reuse `{{}}` syntax inside a code node.** Code nodes use `$("nodeId")`. Custom node code uses `inputs.x`. See `flow-semantics.md`.
41
- 5. **Never insert a `customNode` without `customVersionId`.** Custom nodes do not auto-update on publish — explicit version pinning is required.
42
- 6. **Never publish without `pre_publish_check`.** Even if validation passes.
43
- 7. **The flow MUST be horizontal on the canvas.** Trigger on the far left, terminators on the far right. If `validate_flow` returns `LAYOUT_VERTICAL_DRIFT`, fix it before you continue.
44
- 8. **Every form input MUST have a `label`. Every `page` MUST start with a `textBlock` heading.** Forms with empty labels render as unmarked grey rectangles and are unusable. See AP14. Pick the right element type per field (`email`, `shortText`, `longText`, `dropdown`, etc.) — do not use `longText` for short single-line input.
45
- 9. **Every non-terminal `page` MUST include at least one `button` element with `buttonAction: "submit"`.** No button = no way to advance the flow. The button's text field is `buttonText` (NOT `label`). Action values: `submit` / `link` / `stop` / `restart`. See AP15 and AP16.
46
- 10. **Field-name discipline.** Many node types have non-obvious canonical keys. **Always call `describe_node_type(type)` before authoring a node you have not used in this session** — the catalog spells out the real keys. Known traps:
47
- - `if`/`switch`: condition logic is `logicOperator` (UPPERCASE), not `conditionLogic`. See AP17.
48
- - `aiSwitch` routes: `context`, not `contextDescription`. See AP18.
49
- - Page terminal: `goalId` (FK) + `goalName` (display) — not `goalName` alone. See AP19.
50
- - `httpRequest.authentication.type`: `credential` is real and is the production default. See AP20.
51
- - `claudeCode`: `offlineBehavior`, `retryConfig`, `fallbackSteps` for production resiliency. See AP21.
52
- - The MCP validator now raises `UNKNOWN_DATA_KEY` warnings when you write keys not in the catalog — read them and fix.
53
-
54
- ## Tool-by-step quick reference
55
-
56
- | Step | Tool | Purpose |
57
- |---|---|---|
58
- | Discover types | `list_node_types`, `describe_node_type` | What's available, what each node needs |
59
- | Discover custom | `list_custom_nodes`, `describe_custom_node` | Workspace-specific reusable nodes |
60
- | Discover layout | `get_layout_config` | Canonical h_spacing / v_spacing constants |
61
- | Create flow | `create_flow` | New empty flow with trigger node |
62
- | Add nodes | `add_nodes` | Insert nodes + edges; auto-positions horizontally |
63
- | Connect | `connect_nodes`, `disconnect_nodes` | Atomic edge ops |
64
- | Variables | `set_variable`, `list_variables`, `delete_variable` | Atomic per-name; no full flow rewrite |
65
- | Lay out | `autolayout` | One-call horizontal cleanup |
66
- | Validate | `validate_flow` | Server-authoritative; errors[] and warnings[] |
67
- | Test node | `test_node` | Run one node in isolation |
68
- | Test code | `test_custom_node_code` | Verify custom node code before save |
69
- | Test flow | `test_flow`, `dry_run` | End-to-end; dry_run suppresses side effects |
70
- | Debug | `diagnose_run`, `replay_run` (Phase 2), `tail_logs` (Phase 2) | One-call diagnostics; re-execute |
71
- | Pre-publish | `pre_publish_check` (Phase 2) | Gate: validation + snapshot tests + secret scan |
72
- | Publish | `publish_flow`, `canary_publish` (Phase 2) | Production rollout |
73
- | Undo | `undo_last_operation` | Session-scoped stack |
74
- | Safety | `confirm_intent` | Two-step destructive ops |
75
-
76
- ## How to handle uncertainty
77
-
78
- If you don't know:
79
- - **What a node does** → `describe_node_type(type)`. Don't guess.
80
- - **What fields a custom node needs** → `describe_custom_node(custom_node_id)`. The schema is authoritative.
81
- - **What a template reference will resolve to** → test the upstream node with `test_node` first.
82
- - **Whether your config is valid** → `validate_flow`.
83
- - **Why a run failed** → `diagnose_run(run_id)` (Phase 2). For now: `get_run` + `list_node_logs` + `get_node_output`.
84
-
85
- Asking the human costs you a turn. The tools above usually answer the question faster than the human would.
86
-
87
- ## Now go
88
-
89
- Start with `list_node_types`. Then read `flow-semantics.md` for variable systems and edge handles. Then read `recipes.md` for patterns. Then read `anti-patterns.md` to know what NOT to do.
1
+ ---
2
+ name: building-aiflows
3
+ description: Build, test, and publish +Ai Flows automations. Use whenever the user wants to create or modify a flow. Loaded automatically when the @addai/flows-mcp MCP server is connected.
4
+ version: 2.1.0
5
+ ---
6
+
7
+ # Building +Ai Flows
8
+
9
+ You have access to the +Ai Flows MCP server. This skill teaches you how to use it to build production-quality flows.
10
+
11
+ ## Mental model
12
+
13
+ A flow is a **directed graph**: nodes connected by edges. Execution starts at a trigger node and follows edges until it reaches a terminator (goal or exit) or fails.
14
+
15
+ - **Nodes** do work — trigger an event, make an HTTP call, branch on a condition, send an email.
16
+ - **Edges** define order. Most nodes have one outgoing edge. **Branching nodes** (`if`, `switch`, `loop`, `review`, `splitTest`, `aiSwitch`) have multiple, distinguished by `sourceHandle`.
17
+ - **Variables** carry values between nodes via three distinct templating systems (see `flow-semantics.md`).
18
+
19
+ ## The rigid workflow
20
+
21
+ You MUST follow this loop. Each step has a named tool.
22
+
23
+ ```
24
+ 1. DISCOVER → list_node_types, describe_node_type, list_custom_nodes, describe_custom_node, list_credentials
25
+ 2. DESIGN → propose_flow (NL → draft) [optional]
26
+ 3. BUILD → create_flow, add_nodes, connect_nodes, set_variable
27
+ 4. VALIDATE → validate_flow ← MUST PASS BEFORE TESTING
28
+ 5. TEST → test_node (per uncertain node), test_flow / dry_run (end-to-end)
29
+ 6. DEBUG → diagnose_run, replay_run, tail_logs [if test fails]
30
+ 7. PUBLISH → pre_publish_check, then publish_flow / canary_publish
31
+ ```
32
+
33
+ **You have not finished if you did not validate and test before publishing.**
34
+
35
+ ## Ten rules you must not break
36
+
37
+ 1. **Never guess a node's config schema.** Call `describe_node_type(type)` first if you have not used this type in this session.
38
+ 2. **NEVER pass a `position` to `add_nodes`. EVER.** It auto-places horizontally (left → right). If you pass positions you will get a vertical-stacked flow that the user has to manually fix. If positions get messy mid-build, call `autolayout` once at the end.
39
+ 3. **A `page` node CAN be the terminator** — set `data.isGoal: true` (or `isExit: true`) with a `goalName`. Do NOT add a trailing `goal` node after a page. The page IS the goal. See `describe_node_type("page")` for the full field list.
40
+ 4. **Never reuse `{{}}` syntax inside a code node.** Code nodes use `$("nodeId")`. Custom node code uses `inputs.x`. See `flow-semantics.md`.
41
+ 5. **Never insert a `customNode` without `customVersionId`.** Custom nodes do not auto-update on publish — explicit version pinning is required.
42
+ 6. **Never publish without `pre_publish_check`.** Even if validation passes.
43
+ 7. **The flow MUST be horizontal on the canvas.** Trigger on the far left, terminators on the far right. If `validate_flow` returns `LAYOUT_VERTICAL_DRIFT`, fix it before you continue.
44
+ 8. **Every form input MUST have a `label`. Every `page` MUST start with a `textBlock` heading.** Forms with empty labels render as unmarked grey rectangles and are unusable. See AP14. Pick the right element type per field (`email`, `shortText`, `longText`, `dropdown`, etc.) — do not use `longText` for short single-line input.
45
+ 9. **Every non-terminal `page` MUST include at least one `button` element with `buttonAction: "submit"`.** No button = no way to advance the flow. The button's text field is `buttonText` (NOT `label`). Action values: `submit` / `link` / `stop` / `restart`. See AP15 and AP16.
46
+ 10. **Field-name discipline.** Many node types have non-obvious canonical keys. **Always call `describe_node_type(type)` before authoring a node you have not used in this session** — the catalog spells out the real keys. Known traps:
47
+ - `if`/`switch`: condition logic is `logicOperator` (UPPERCASE), not `conditionLogic`. See AP17.
48
+ - `aiSwitch` routes: `context`, not `contextDescription`. See AP18.
49
+ - Page terminal: `goalId` (FK) + `goalName` (display) — not `goalName` alone. See AP19.
50
+ - `httpRequest.authentication.type`: `credential` is real — it signs in with a key saved in the Vault (`{type:"credential", credentialId:"<vault id>"}`; find the id with `list_credentials`). See AP20.
51
+ - `claudeCode`: `offlineBehavior`, `retryConfig`, `fallbackSteps` for production resiliency. See AP21.
52
+ - The MCP validator now raises `UNKNOWN_DATA_KEY` warnings when you write keys not in the catalog — read them and fix.
53
+
54
+ ## Tool-by-step quick reference
55
+
56
+ | Step | Tool | Purpose |
57
+ |---|---|---|
58
+ | Discover types | `list_node_types`, `describe_node_type` | What's available, what each node needs |
59
+ | Discover custom | `list_custom_nodes`, `describe_custom_node` | Workspace-specific reusable nodes |
60
+ | Discover credentials | `list_credentials` | Saved Vault keys (ids and names, never secrets) to put on an HTTP Request step |
61
+ | Discover layout | `get_layout_config` | Canonical h_spacing / v_spacing constants |
62
+ | Create flow | `create_flow` | New empty flow with trigger node |
63
+ | Add nodes | `add_nodes` | Insert nodes + edges; auto-positions horizontally |
64
+ | Connect | `connect_nodes`, `disconnect_nodes` | Atomic edge ops |
65
+ | Variables | `set_variable`, `list_variables`, `delete_variable` | Atomic per-name; no full flow rewrite |
66
+ | Lay out | `autolayout` | One-call horizontal cleanup |
67
+ | Validate | `validate_flow` | Server-authoritative; errors[] and warnings[] |
68
+ | Test node | `test_node` | Run one node in isolation |
69
+ | Test code | `test_custom_node_code` | Verify custom node code before save |
70
+ | Test flow | `test_flow`, `dry_run` | End-to-end; dry_run suppresses side effects |
71
+ | Debug | `diagnose_run`, `replay_run` (Phase 2), `tail_logs` (Phase 2) | One-call diagnostics; re-execute |
72
+ | Pre-publish | `pre_publish_check` (Phase 2) | Gate: validation + snapshot tests + secret scan |
73
+ | Publish | `publish_flow`, `canary_publish` (Phase 2) | Production rollout |
74
+ | Undo | `undo_last_operation` | Session-scoped stack |
75
+ | Safety | `confirm_intent` | Two-step destructive ops |
76
+
77
+ ## How to handle uncertainty
78
+
79
+ If you don't know:
80
+ - **What a node does** → `describe_node_type(type)`. Don't guess.
81
+ - **What fields a custom node needs** → `describe_custom_node(custom_node_id)`. The schema is authoritative.
82
+ - **What a template reference will resolve to** → test the upstream node with `test_node` first.
83
+ - **Whether your config is valid** → `validate_flow`.
84
+ - **Why a run failed** → `diagnose_run(run_id)` (Phase 2). For now: `get_run` + `list_node_logs` + `get_node_output`.
85
+
86
+ Asking the human costs you a turn. The tools above usually answer the question faster than the human would.
87
+
88
+ ## Now go
89
+
90
+ Start with `list_node_types`. Then read `flow-semantics.md` for variable systems and edge handles. Then read `recipes.md` for patterns. Then read `anti-patterns.md` to know what NOT to do.