n8n-mcp 2.75.0 → 2.76.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.
- package/README.md +7 -5
- package/dist/http-server-single-session.d.ts.map +1 -1
- package/dist/http-server-single-session.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/agents-action-map.d.ts +1 -0
- package/dist/mcp/agents-action-map.d.ts.map +1 -1
- package/dist/mcp/agents-action-map.js +2 -1
- package/dist/mcp/agents-action-map.js.map +1 -1
- package/dist/mcp/handlers-n8n-manager.d.ts +3 -0
- package/dist/mcp/handlers-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/handlers-n8n-manager.js +564 -103
- package/dist/mcp/handlers-n8n-manager.js.map +1 -1
- package/dist/mcp/handlers-official-tools.d.ts +17 -0
- package/dist/mcp/handlers-official-tools.d.ts.map +1 -1
- package/dist/mcp/handlers-official-tools.js +78 -34
- package/dist/mcp/handlers-official-tools.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +10 -76
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-manage-datatable.d.ts.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-manage-datatable.js +31 -9
- package/dist/mcp/tool-docs/workflow_management/n8n-manage-datatable.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-test-workflow.d.ts.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-test-workflow.js +92 -19
- package/dist/mcp/tool-docs/workflow_management/n8n-test-workflow.js.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-workflow-versions.d.ts.map +1 -1
- package/dist/mcp/tool-docs/workflow_management/n8n-workflow-versions.js +129 -28
- package/dist/mcp/tool-docs/workflow_management/n8n-workflow-versions.js.map +1 -1
- package/dist/mcp/tool-policy.d.ts +9 -0
- package/dist/mcp/tool-policy.d.ts.map +1 -0
- package/dist/mcp/tool-policy.js +138 -0
- package/dist/mcp/tool-policy.js.map +1 -0
- package/dist/mcp/tools-documentation.js +3 -3
- package/dist/mcp/tools-n8n-manager.d.ts +1 -0
- package/dist/mcp/tools-n8n-manager.d.ts.map +1 -1
- package/dist/mcp/tools-n8n-manager.js +103 -21
- package/dist/mcp/tools-n8n-manager.js.map +1 -1
- package/dist/services/mcp-exposure.d.ts +21 -0
- package/dist/services/mcp-exposure.d.ts.map +1 -0
- package/dist/services/mcp-exposure.js +131 -0
- package/dist/services/mcp-exposure.js.map +1 -0
- package/dist/services/n8n-official-mcp-client.d.ts.map +1 -1
- package/dist/services/n8n-official-mcp-client.js +25 -3
- package/dist/services/n8n-official-mcp-client.js.map +1 -1
- package/dist/services/workflow-versioning-service.d.ts +2 -1
- package/dist/services/workflow-versioning-service.d.ts.map +1 -1
- package/dist/services/workflow-versioning-service.js +8 -2
- package/dist/services/workflow-versioning-service.js.map +1 -1
- package/dist/triggers/index.d.ts +1 -1
- package/dist/triggers/index.d.ts.map +1 -1
- package/dist/triggers/index.js +2 -1
- package/dist/triggers/index.js.map +1 -1
- package/dist/triggers/trigger-detector.d.ts +3 -2
- package/dist/triggers/trigger-detector.d.ts.map +1 -1
- package/dist/triggers/trigger-detector.js +12 -0
- package/dist/triggers/trigger-detector.js.map +1 -1
- package/dist/types/n8n-api.d.ts +6 -0
- package/dist/types/n8n-api.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,17 +5,18 @@ exports.n8nManageDatatableDoc = {
|
|
|
5
5
|
name: 'n8n_manage_datatable',
|
|
6
6
|
category: 'workflow_management',
|
|
7
7
|
essentials: {
|
|
8
|
-
description: 'Manage n8n data tables and
|
|
9
|
-
keyParameters: ['action', 'tableId', 'name', 'columns', 'data', 'filter'],
|
|
8
|
+
description: 'Manage n8n data tables, rows and columns. Unified tool for table CRUD, row operations with filtering, pagination and dry-run support, plus column changes on an existing table.',
|
|
9
|
+
keyParameters: ['action', 'tableId', 'name', 'columns', 'data', 'filter', 'column', 'columnId'],
|
|
10
10
|
example: 'n8n_manage_datatable({action: "createTable", name: "Contacts", columns: [{name: "email", type: "string"}]})',
|
|
11
11
|
performance: 'Fast (100-500ms)',
|
|
12
12
|
tips: [
|
|
13
13
|
'Table actions: createTable, listTables, getTable, updateTable (rename only), deleteTable',
|
|
14
14
|
'Row actions: getRows, insertRows, updateRows, upsertRows, deleteRows',
|
|
15
|
+
'Column actions: addColumn, deleteColumn, renameColumn - these need N8N_MCP_ACCESS_TOKEN (n8n 2.34+)',
|
|
15
16
|
'Use dryRun: true to preview update/upsert/delete before applying',
|
|
16
17
|
'Filter supports: eq, neq, like, ilike, gt, gte, lt, lte conditions',
|
|
17
18
|
'Use returnData: true to get affected rows back from update/upsert/delete',
|
|
18
|
-
'Requires N8N_API_URL and N8N_API_KEY configured'
|
|
19
|
+
'Requires N8N_API_URL and N8N_API_KEY configured; the column actions additionally need N8N_MCP_ACCESS_TOKEN'
|
|
19
20
|
]
|
|
20
21
|
},
|
|
21
22
|
full: {
|
|
@@ -23,7 +24,7 @@ exports.n8nManageDatatableDoc = {
|
|
|
23
24
|
- **createTable**: Create a new data table with one or more typed columns (columns are required)
|
|
24
25
|
- **listTables**: List all data tables (paginated)
|
|
25
26
|
- **getTable**: Get table details and column definitions by ID
|
|
26
|
-
- **updateTable**: Rename an existing table (name only — column
|
|
27
|
+
- **updateTable**: Rename an existing table (name only — see the column actions below to change columns)
|
|
27
28
|
- **deleteTable**: Permanently delete a table and all its rows
|
|
28
29
|
|
|
29
30
|
**Row Actions:**
|
|
@@ -33,6 +34,15 @@ exports.n8nManageDatatableDoc = {
|
|
|
33
34
|
- **upsertRows**: Update matching row or insert if none match
|
|
34
35
|
- **deleteRows**: Delete rows matching a filter condition (filter required)
|
|
35
36
|
|
|
37
|
+
**Column Actions** (routed to n8n's own MCP server - need N8N_MCP_ACCESS_TOKEN and n8n 2.34+):
|
|
38
|
+
- **addColumn**: Add a typed column to an existing table
|
|
39
|
+
- **deleteColumn**: Remove a column and its values (columnId from getTable)
|
|
40
|
+
- **renameColumn**: Rename an existing column
|
|
41
|
+
|
|
42
|
+
Column names must start with a letter, contain only letters, digits and underscores, and be at most 63 characters; the type is one of string, number, boolean, date. Renaming a TABLE is not a column action - use updateTable, which goes through the public API.
|
|
43
|
+
|
|
44
|
+
**projectId for column actions:** the official server addresses a table by project. When the instance has exactly one accessible project, it is used automatically; when several are accessible the call returns PROJECT_REQUIRED and lists the candidates, and when none can be resolved it returns PROJECT_REQUIRED asking for an explicit projectId. Pass projectId to skip resolution entirely (list them with n8n_list_catalog({kind: "projects"})).
|
|
45
|
+
|
|
36
46
|
**Filter System:** Used in getRows, updateRows, upsertRows, deleteRows
|
|
37
47
|
- Combine conditions with "and" (default) or "or"
|
|
38
48
|
- Conditions: eq, neq, like, ilike, gt, gte, lt, lte
|
|
@@ -53,6 +63,10 @@ exports.n8nManageDatatableDoc = {
|
|
|
53
63
|
returnType: { type: 'string', required: false, description: 'For insertRows: "count" (default), "id", or "all"' },
|
|
54
64
|
returnData: { type: 'boolean', required: false, description: 'For updateRows/upsertRows/deleteRows: return affected rows (default: false)' },
|
|
55
65
|
dryRun: { type: 'boolean', required: false, description: 'For updateRows/upsertRows/deleteRows: preview without applying (default: false)' },
|
|
66
|
+
projectId: { type: 'string', required: false, description: 'For createTable: project to create the table in. For the column actions: project owning the table - auto-resolved when exactly one project is accessible' },
|
|
67
|
+
column: { type: 'object', required: false, description: 'For addColumn: {name, type} - name must match ^[a-zA-Z][a-zA-Z0-9_]*$ and be at most 63 characters; type is string, number, boolean or date' },
|
|
68
|
+
columnId: { type: 'string', required: false, description: 'For deleteColumn/renameColumn: ID of the column (read it from getTable)' },
|
|
69
|
+
timeoutMs: { type: 'integer', required: false, description: 'For the column actions: client timeout in ms (5000-600000, default 30000)' },
|
|
56
70
|
},
|
|
57
71
|
returns: `Depends on action:
|
|
58
72
|
- createTable: {id, name}
|
|
@@ -64,7 +78,8 @@ exports.n8nManageDatatableDoc = {
|
|
|
64
78
|
- insertRows: Depends on returnType (count/ids/rows)
|
|
65
79
|
- updateRows: Update result with optional rows
|
|
66
80
|
- upsertRows: Upsert result with action type
|
|
67
|
-
- deleteRows: Delete result with optional rows
|
|
81
|
+
- deleteRows: Delete result with optional rows
|
|
82
|
+
- addColumn/deleteColumn/renameColumn: {success, action, backend: "official-mcp", data} - data is n8n's own answer ({success, message, column?})`,
|
|
68
83
|
examples: [
|
|
69
84
|
'// Create a table\nn8n_manage_datatable({action: "createTable", name: "Contacts", columns: [{name: "email", type: "string"}, {name: "score", type: "number"}]})',
|
|
70
85
|
'// List all tables\nn8n_manage_datatable({action: "listTables"})',
|
|
@@ -77,6 +92,9 @@ exports.n8nManageDatatableDoc = {
|
|
|
77
92
|
'// Update rows (dry run)\nn8n_manage_datatable({action: "updateRows", tableId: "dt-123", filter: {filters: [{columnName: "score", condition: "lt", value: 5}]}, data: {status: "inactive"}, dryRun: true})',
|
|
78
93
|
'// Upsert a row\nn8n_manage_datatable({action: "upsertRows", tableId: "dt-123", filter: {filters: [{columnName: "email", condition: "eq", value: "a@b.com"}]}, data: {score: 15}, returnData: true})',
|
|
79
94
|
'// Delete rows\nn8n_manage_datatable({action: "deleteRows", tableId: "dt-123", filter: {filters: [{columnName: "status", condition: "eq", value: "deleted"}]}})',
|
|
95
|
+
'// Add a column to an existing table\nn8n_manage_datatable({action: "addColumn", tableId: "dt-123", column: {name: "score", type: "number"}})',
|
|
96
|
+
'// Rename a column (columnId from getTable)\nn8n_manage_datatable({action: "renameColumn", tableId: "dt-123", columnId: "col-7", name: "total_score"})',
|
|
97
|
+
'// Delete a column on a multi-project instance\nn8n_manage_datatable({action: "deleteColumn", tableId: "dt-123", columnId: "col-7", projectId: "proj-1"})',
|
|
80
98
|
],
|
|
81
99
|
useCases: [
|
|
82
100
|
'Persist structured workflow data across executions',
|
|
@@ -86,6 +104,7 @@ exports.n8nManageDatatableDoc = {
|
|
|
86
104
|
'Upsert to maintain unique records by key column',
|
|
87
105
|
'Clean up old or invalid rows with filtered delete',
|
|
88
106
|
'Preview changes with dryRun before modifying data',
|
|
107
|
+
'Adjust a table schema after creation (add, rename or drop a column)',
|
|
89
108
|
],
|
|
90
109
|
performance: 'Table operations: 50-300ms. Row operations: 100-500ms depending on data size and filters.',
|
|
91
110
|
bestPractices: [
|
|
@@ -95,15 +114,18 @@ exports.n8nManageDatatableDoc = {
|
|
|
95
114
|
'Use filter with specific conditions to avoid unintended bulk operations',
|
|
96
115
|
'Use cursor-based pagination for large result sets',
|
|
97
116
|
'Use sortBy for deterministic row ordering',
|
|
117
|
+
'Read columnId from getTable before deleteColumn or renameColumn',
|
|
118
|
+
'Pass projectId for the column actions on instances with several projects',
|
|
98
119
|
],
|
|
99
120
|
pitfalls: [
|
|
100
121
|
'deleteTable permanently deletes all rows — cannot be undone',
|
|
101
122
|
'deleteRows requires a filter — cannot delete all rows without one',
|
|
102
|
-
'
|
|
103
|
-
'updateTable
|
|
104
|
-
'
|
|
123
|
+
'A column type cannot be changed after the column is created — drop and re-add the column instead',
|
|
124
|
+
'updateTable only renames the table; use addColumn/deleteColumn/renameColumn to change columns',
|
|
125
|
+
'The column actions are unavailable without N8N_MCP_ACCESS_TOKEN (NOT_CONFIGURED) or on n8n below 2.34 (OFFICIAL_MCP_TOOL_UNAVAILABLE)',
|
|
126
|
+
'deleteColumn drops the column values along with the column',
|
|
105
127
|
],
|
|
106
|
-
relatedTools: ['n8n_create_workflow', 'n8n_list_workflows', 'n8n_health_check'],
|
|
128
|
+
relatedTools: ['n8n_create_workflow', 'n8n_list_workflows', 'n8n_list_catalog', 'n8n_health_check'],
|
|
107
129
|
},
|
|
108
130
|
};
|
|
109
131
|
//# sourceMappingURL=n8n-manage-datatable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-manage-datatable.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-manage-datatable.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAsB;IACtD,IAAI,EAAE,sBAAsB;IAC5B,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"n8n-manage-datatable.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-manage-datatable.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAsB;IACtD,IAAI,EAAE,sBAAsB;IAC5B,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,iLAAiL;QAC9L,aAAa,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;QAC/F,OAAO,EAAE,6GAA6G;QACtH,WAAW,EAAE,kBAAkB;QAC/B,IAAI,EAAE;YACJ,0FAA0F;YAC1F,sEAAsE;YACtE,qGAAqG;YACrG,kEAAkE;YAClE,oEAAoE;YACpE,0EAA0E;YAC1E,4GAA4G;SAC7G;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;mHA4BkG;QAC/G,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE;YAC/E,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,oEAAoE,EAAE;YAC/H,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,yCAAyC,EAAE;YACjG,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,oHAAoH,EAAE;YAC9K,IAAI,EAAE,EAAE,IA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EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,2EAA2E,EAAE;SAC1I;QACD,OAAO,EAAE;;;;;;;;;;;iJAWoI;QAC7I,QAAQ,EAAE;YACR,iKAAiK;YACjK,kEAAkE;YAClE,qFAAqF;YACrF,uGAAuG;YACvG,qFAAqF;YACrF,iLAAiL;YACjL,kHAAkH;YAClH,2IAA2I;YAC3I,4MAA4M;YAC5M,sMAAsM;YACtM,iKAAiK;YACjK,+IAA+I;YAC/I,wJAAwJ;YACxJ,2JAA2J;SAC5J;QACD,QAAQ,EAAE;YACR,oDAAoD;YACpD,kDAAkD;YAClD,gDAAgD;YAChD,gDAAgD;YAChD,iDAAiD;YACjD,mDAAmD;YACnD,mDAAmD;YACnD,qEAAqE;SACtE;QACD,WAAW,EAAE,2FAA2F;QACxG,aAAa,EAAE;YACb,oDAAoD;YACpD,2EAA2E;YAC3E,4EAA4E;YAC5E,yEAAyE;YACzE,mDAAmD;YACnD,2CAA2C;YAC3C,iEAAiE;YACjE,0EAA0E;SAC3E;QACD,QAAQ,EAAE;YACR,6DAA6D;YAC7D,mEAAmE;YACnE,kGAAkG;YAClG,+FAA+F;YAC/F,uIAAuI;YACvI,4DAA4D;SAC7D;QACD,YAAY,EAAE,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC;KACpG;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-test-workflow.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-test-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"n8n-test-workflow.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-test-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,kBAAkB,EAAE,iBAgNhC,CAAC"}
|
|
@@ -5,34 +5,62 @@ exports.n8nTestWorkflowDoc = {
|
|
|
5
5
|
name: 'n8n_test_workflow',
|
|
6
6
|
category: 'workflow_management',
|
|
7
7
|
essentials: {
|
|
8
|
-
description: '
|
|
9
|
-
keyParameters: ['workflowId', '
|
|
8
|
+
description: 'Run a workflow. method=auto (default) triggers it over HTTP via its webhook/form/chat trigger; method=prepare/pinned/direct run it through n8n\'s own MCP server.',
|
|
9
|
+
keyParameters: ['workflowId', 'method', 'data', 'message', 'pinData'],
|
|
10
10
|
example: 'n8n_test_workflow({workflowId: "123"}) - auto-detect trigger',
|
|
11
11
|
performance: 'Immediate trigger, response time depends on workflow complexity',
|
|
12
12
|
tips: [
|
|
13
13
|
'Auto-detects trigger type from workflow if not specified',
|
|
14
|
-
'
|
|
14
|
+
'Workflows without a webhook/form/chat trigger need method=direct or method=pinned',
|
|
15
|
+
'method=prepare first, then method=pinned with the pinData you built from it',
|
|
15
16
|
'For chat triggers, message is required',
|
|
16
|
-
'
|
|
17
|
+
'HTTP trigger types require the workflow to be ACTIVE'
|
|
17
18
|
]
|
|
18
19
|
},
|
|
19
20
|
full: {
|
|
20
|
-
description: `
|
|
21
|
+
description: `Run an n8n workflow, either over HTTP through its own trigger or through n8n's instance-level MCP server.
|
|
21
22
|
|
|
22
|
-
**
|
|
23
|
+
**Methods (\`method\` parameter):**
|
|
24
|
+
|
|
25
|
+
| method | backend | What it does |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| \`auto\` (default) | Public API | Detects a webhook/form/chat trigger and triggers it over HTTP. Without such a trigger it reports that the workflow cannot be triggered externally and names the official methods. It never runs anything through n8n's MCP server. |
|
|
28
|
+
| \`trigger\` | Public API | The same HTTP path, requested explicitly. Detection, the trigger types below and the error when no trigger exists are identical to \`auto\`. |
|
|
29
|
+
| \`prepare\` | n8n MCP server | Read-only: lists the nodes that need pinned data and the schemas n8n can generate for them. Build \`pinData\` from this. |
|
|
30
|
+
| \`pinned\` | n8n MCP server | Runs the workflow with \`pinData\` standing in for trigger, credentialed and HTTP Request nodes, and waits for the run to finish. Every other node still executes for real. |
|
|
31
|
+
| \`direct\` | n8n MCP server | Starts a run with optional \`inputs\` and returns as soon as it has started. Nothing is pinned — every node runs. |
|
|
32
|
+
|
|
33
|
+
**Trigger types (HTTP path):**
|
|
23
34
|
- **webhook**: HTTP-based triggers (GET/POST/PUT/DELETE)
|
|
24
35
|
- **form**: Form submission triggers
|
|
25
36
|
- **chat**: AI chat triggers with conversation support
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
n8n's public API does not support direct workflow execution, which is why \`prepare\`/\`pinned\`/\`direct\` go through n8n's own MCP server instead. Those three need \`N8N_MCP_ACCESS_TOKEN\` (n8n 2.34+).
|
|
39
|
+
|
|
40
|
+
**Consent: "Available in MCP".** n8n refuses MCP calls for a workflow whose "Available in MCP" setting is off, and this tool returns \`WORKFLOW_NOT_EXPOSED\` rather than changing it. Re-run with \`exposeToMcp: true\` to enable it — a visible, persistent setting on the workflow, so confirm with the user first. This flow only ever turns the setting on - disabling it again is a deliberate \`updateSettings\` write (\`availableInMCP: false\`) or a change in the n8n UI. A response that enabled it carries \`exposedToMcp: true\`. In a per-request (multi-tenant or header-driven) deployment, every method except a plain \`prepare\` (the HTTP trigger path, the \`pinned\`/\`direct\` trigger lookup and the \`exposeToMcp\` write all read or write through the Public API) needs the Public API key (\`x-n8n-key\`) for the same instance as \`x-n8n-url\` — without it the call returns \`NOT_CONFIGURED\` rather than acting against a different instance.
|
|
41
|
+
|
|
42
|
+
**Both run methods can cause real side effects.** \`direct\` runs every node, so any node that calls an external service calls it for real. \`pinned\` pins only trigger nodes, nodes with credentials and HTTP Request nodes; everything else — Code, Set, If, and credential-free I/O such as Execute Command or file read/write — executes normally. Treat both as live runs and confirm with the user before running a workflow that writes anywhere.
|
|
43
|
+
|
|
44
|
+
**executionMode: production.** \`method: direct\` runs as a manual execution unless you explicitly pass \`executionMode: 'production'\`. That changes the execution context, not whether the run has side effects: a production run uses the production execution path and shows up as one in n8n's execution list. It is never chosen for you.
|
|
45
|
+
|
|
46
|
+
**Typical sequence for a workflow with no external trigger:**
|
|
47
|
+
1. \`{workflowId, method: 'prepare'}\` — see which nodes need pinned data.
|
|
48
|
+
2. Build sample items per node name (\`{"Webhook": [{"json": {...}}]}\`).
|
|
49
|
+
3. \`{workflowId, method: 'pinned', pinData}\` — run it and read the result.
|
|
28
50
|
|
|
29
|
-
|
|
51
|
+
Every response states \`method\` and \`backend\` ('public-api' or 'official-mcp').`,
|
|
30
52
|
parameters: {
|
|
31
53
|
workflowId: {
|
|
32
54
|
type: 'string',
|
|
33
55
|
required: true,
|
|
34
56
|
description: 'Workflow ID to execute'
|
|
35
57
|
},
|
|
58
|
+
method: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
required: false,
|
|
61
|
+
enum: ['auto', 'trigger', 'prepare', 'pinned', 'direct'],
|
|
62
|
+
description: 'How to run the workflow (default: auto). See the methods table above.'
|
|
63
|
+
},
|
|
36
64
|
triggerType: {
|
|
37
65
|
type: 'string',
|
|
38
66
|
required: false,
|
|
@@ -73,31 +101,66 @@ The tool auto-detects the appropriate trigger type by analyzing the workflow's t
|
|
|
73
101
|
timeout: {
|
|
74
102
|
type: 'number',
|
|
75
103
|
required: false,
|
|
76
|
-
description: 'Timeout in ms (default: 120000)'
|
|
104
|
+
description: 'Timeout in ms (default: 120000). HTTP trigger path only (method auto/trigger) — the official methods (prepare/pinned/direct) use timeoutMs instead.'
|
|
77
105
|
},
|
|
78
106
|
waitForResponse: {
|
|
79
107
|
type: 'boolean',
|
|
80
108
|
required: false,
|
|
81
109
|
description: 'Wait for workflow completion (default: true)'
|
|
110
|
+
},
|
|
111
|
+
pinData: {
|
|
112
|
+
type: 'object',
|
|
113
|
+
required: false,
|
|
114
|
+
description: 'For method=pinned (required, non-empty): pinned trigger data keyed by node name. Each value is an array of ITEMS, and every item must be wrapped as { "json": { ... } } - e.g. {"Webhook": [{"json": {"id": "123"}}]}, never a flat object. Build it from method=prepare.'
|
|
115
|
+
},
|
|
116
|
+
triggerNodeName: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
required: false,
|
|
119
|
+
description: 'For method=pinned/direct: which trigger node to start from. Defaults to the detected trigger node; n8n requires it whenever inputs are given.'
|
|
120
|
+
},
|
|
121
|
+
executionMode: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: false,
|
|
124
|
+
enum: ['manual', 'production'],
|
|
125
|
+
description: 'For method=direct: manual (default) or production. Production runs have real side effects and are never chosen implicitly.'
|
|
126
|
+
},
|
|
127
|
+
exposeToMcp: {
|
|
128
|
+
type: 'boolean',
|
|
129
|
+
required: false,
|
|
130
|
+
description: 'For the official methods: enable the workflow\'s persistent "Available in MCP" setting when n8n refuses the call. Confirm with the user first.'
|
|
131
|
+
},
|
|
132
|
+
timeoutMs: {
|
|
133
|
+
type: 'integer',
|
|
134
|
+
required: false,
|
|
135
|
+
description: 'Client-side deadline for the official call, 5000-600000 (default: 30000 for prepare, 300000 for pinned/direct)'
|
|
82
136
|
}
|
|
83
137
|
},
|
|
84
138
|
returns: `Execution response including:
|
|
85
139
|
- success: boolean
|
|
86
|
-
-
|
|
140
|
+
- method: which method ran ('trigger', 'prepare', 'pinned', 'direct')
|
|
141
|
+
- backend: 'public-api' or 'official-mcp'
|
|
142
|
+
- data: workflow output data (or the official tool's payload)
|
|
87
143
|
- executionId: for tracking/debugging
|
|
88
|
-
- triggerType: detected or specified trigger type
|
|
89
|
-
- metadata: timing and request details
|
|
144
|
+
- triggerType: detected or specified trigger type (HTTP path)
|
|
145
|
+
- metadata: timing and request details
|
|
146
|
+
- exposedToMcp: true when the call enabled "Available in MCP" on the workflow`,
|
|
90
147
|
examples: [
|
|
91
148
|
'n8n_test_workflow({workflowId: "123"}) - Auto-detect and trigger',
|
|
92
149
|
'n8n_test_workflow({workflowId: "123", triggerType: "webhook", data: {name: "John"}}) - Webhook with data',
|
|
93
150
|
'n8n_test_workflow({workflowId: "123", triggerType: "chat", message: "Hello AI"}) - Chat trigger',
|
|
94
|
-
'n8n_test_workflow({workflowId: "123", triggerType: "form", data: {email: "test@example.com"}}) - Form submission'
|
|
151
|
+
'n8n_test_workflow({workflowId: "123", triggerType: "form", data: {email: "test@example.com"}}) - Form submission',
|
|
152
|
+
'n8n_test_workflow({workflowId: "123", method: "prepare"}) - Which nodes need pinned data',
|
|
153
|
+
'n8n_test_workflow({workflowId: "123", method: "pinned", pinData: {Webhook: [{json: {name: "John"}}]}}) - Run with pinned trigger data',
|
|
154
|
+
'n8n_test_workflow({workflowId: "123", method: "direct", message: "Hello"}) - Start a manual run through n8n\'s MCP server',
|
|
155
|
+
'n8n_test_workflow({workflowId: "123", method: "prepare", exposeToMcp: true}) - Enable "Available in MCP" first (confirm with the user)'
|
|
95
156
|
],
|
|
96
157
|
useCases: [
|
|
97
158
|
'Test workflows during development',
|
|
98
159
|
'Trigger AI chat workflows with messages',
|
|
99
160
|
'Submit form data to form-triggered workflows',
|
|
100
|
-
'Integrate n8n workflows with external systems via webhooks'
|
|
161
|
+
'Integrate n8n workflows with external systems via webhooks',
|
|
162
|
+
'Run a workflow that has no webhook/form/chat trigger (schedule, manual, sub-workflow)',
|
|
163
|
+
'Exercise a workflow with pinned trigger data instead of a live request'
|
|
101
164
|
],
|
|
102
165
|
performance: `Performance varies based on workflow complexity and waitForResponse setting:
|
|
103
166
|
- Webhook: Immediate trigger, depends on workflow
|
|
@@ -115,8 +178,12 @@ When execution fails, the response includes guidance for debugging:
|
|
|
115
178
|
|
|
116
179
|
**Common Errors:**
|
|
117
180
|
- "Workflow not found" - Check workflow ID exists
|
|
118
|
-
- "Workflow not active" - Activate workflow (
|
|
119
|
-
- "Workflow cannot be triggered externally" - Workflow has no webhook/form/chat trigger
|
|
181
|
+
- "Workflow not active" - Activate workflow (HTTP trigger path only; pinned/direct run inactive workflows)
|
|
182
|
+
- "Workflow cannot be triggered externally" - Workflow has no webhook/form/chat trigger; use method=direct or method=pinned
|
|
183
|
+
- WORKFLOW_NOT_EXPOSED - The workflow's "Available in MCP" setting is off; re-run with exposeToMcp: true after confirming with the user
|
|
184
|
+
- EXECUTION_FAILED - method=pinned started the run and it ended in error/crashed/canceled; the executionId is on the response
|
|
185
|
+
- OFFICIAL_MCP_TOOL_UNAVAILABLE - This n8n version does not expose the tool (the message names the minimum version)
|
|
186
|
+
- NOT_CONFIGURED - The official methods need N8N_MCP_ACCESS_TOKEN
|
|
120
187
|
- "Chat message required" - Provide message parameter for chat triggers
|
|
121
188
|
- "SSRF protection" - URL validation failed`,
|
|
122
189
|
bestPractices: [
|
|
@@ -125,11 +192,17 @@ When execution fails, the response includes guidance for debugging:
|
|
|
125
192
|
'For chat workflows, provide sessionId for multi-turn conversations',
|
|
126
193
|
'Use mode="preview" with n8n_executions for efficient debugging',
|
|
127
194
|
'Test with small data payloads first',
|
|
128
|
-
'Activate workflows before testing (use n8n_update_partial_workflow with activateWorkflow)'
|
|
195
|
+
'Activate workflows before testing (use n8n_update_partial_workflow with activateWorkflow)',
|
|
196
|
+
'Run method=prepare before method=pinned so pinData matches the nodes n8n expects',
|
|
197
|
+
'Keep method=direct on executionMode manual unless a production run is genuinely wanted',
|
|
198
|
+
'Confirm with the user before passing exposeToMcp: true - it changes a visible workflow setting'
|
|
129
199
|
],
|
|
130
200
|
pitfalls: [
|
|
131
|
-
'
|
|
132
|
-
'
|
|
201
|
+
'method=auto never runs a workflow through n8n\'s MCP server - it reports the workflow cannot be triggered instead',
|
|
202
|
+
'method=direct returns as soon as the run starts; poll n8n_executions with the executionId for the outcome',
|
|
203
|
+
'executionMode: production runs the workflow for real',
|
|
204
|
+
'All HTTP trigger types require the workflow to be ACTIVE',
|
|
205
|
+
'Workflows without webhook/form/chat triggers cannot be triggered over HTTP - run them with method=pinned or method=direct instead',
|
|
133
206
|
'Chat trigger requires message parameter',
|
|
134
207
|
'Form data must match expected form fields',
|
|
135
208
|
'Webhook method must match node configuration'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-test-workflow.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-test-workflow.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAsB;IACnD,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"n8n-test-workflow.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-test-workflow.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAsB;IACnD,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,mKAAmK;QAChL,aAAa,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC;QACrE,OAAO,EAAE,8DAA8D;QACvE,WAAW,EAAE,iEAAiE;QAC9E,IAAI,EAAE;YACJ,0DAA0D;YAC1D,mFAAmF;YACnF,6EAA6E;YAC7E,wCAAwC;YACxC,sDAAsD;SACvD;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mFA8BkE;QAC/E,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,wBAAwB;aACtC;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC;gBACxD,WAAW,EAAE,uEAAuE;aACrF;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,CAAC,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E,CAAC,QAAQ,EAAE,YAAY,CAAC;gBAC9B,WAAW,EAAE,4HAA4H;aAC1I;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,gJAAgJ;aAC9J;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,gHAAgH;aAC9H;SACF;QACD,OAAO,EAAE;;;;;;;;8EAQiE;QAC1E,QAAQ,EAAE;YACR,kEAAkE;YAClE,0GAA0G;YAC1G,iGAAiG;YACjG,kHAAkH;YAClH,0FAA0F;YAC1F,uIAAuI;YACvI,2HAA2H;YAC3H,wIAAwI;SACzI;QACD,QAAQ,EAAE;YACR,mCAAmC;YACnC,yCAAyC;YACzC,8CAA8C;YAC9C,4DAA4D;YAC5D,uFAAuF;YACvF,wEAAwE;SACzE;QACD,WAAW,EAAE;;;+CAG8B;QAC3C,aAAa,EAAE;;;;;;;;;;;;;;;;;;;4CAmByB;QACxC,aAAa,EAAE;YACb,0DAA0D;YAC1D,qEAAqE;YACrE,oEAAoE;YACpE,gEAAgE;YAChE,qCAAqC;YACrC,2FAA2F;YAC3F,kFAAkF;YAClF,wFAAwF;YACxF,gGAAgG;SACjG;QACD,QAAQ,EAAE;YACR,mHAAmH;YACnH,2GAA2G;YAC3G,sDAAsD;YACtD,0DAA0D;YAC1D,mIAAmI;YACnI,yCAAyC;YACzC,2CAA2C;YAC3C,8CAA8C;SAC/C;QACD,YAAY,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,uBAAuB,CAAC;KACrG;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-workflow-versions.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-workflow-versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"n8n-workflow-versions.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-workflow-versions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,sBAAsB,EAAE,iBA8PpC,CAAC"}
|
|
@@ -5,20 +5,65 @@ exports.n8nWorkflowVersionsDoc = {
|
|
|
5
5
|
name: 'n8n_workflow_versions',
|
|
6
6
|
category: 'workflow_management',
|
|
7
7
|
essentials: {
|
|
8
|
-
description: 'Manage workflow version history,
|
|
9
|
-
keyParameters: ['mode', 'workflowId', 'versionId'],
|
|
8
|
+
description: 'Manage workflow version history: list, get, diff, roll back and clean up, from n8n-mcp snapshots (local) or n8n\'s own history (native)',
|
|
9
|
+
keyParameters: ['mode', 'source', 'workflowId', 'versionId'],
|
|
10
10
|
example: 'n8n_workflow_versions({mode: "list", workflowId: "abc123"})',
|
|
11
|
-
performance: 'Fast for list/get (~100ms), moderate for rollback (~200-500ms)',
|
|
11
|
+
performance: 'Fast for list/get (~100ms), moderate for rollback (~200-500ms); native modes add one round-trip to n8n\'s MCP server',
|
|
12
12
|
tips: [
|
|
13
13
|
'Use mode="list" to see all saved versions before rollback',
|
|
14
|
-
'
|
|
15
|
-
'
|
|
14
|
+
'source="local" (default) only sees changes n8n-mcp made; source="native" also sees UI edits',
|
|
15
|
+
'Rollback creates a backup version automatically (local only)',
|
|
16
|
+
'Use prune to clean up old versions and save storage (local only)',
|
|
16
17
|
'Versions are scoped to your n8n instance; you only ever see your own',
|
|
17
18
|
'Old backups are pruned automatically (10 per workflow + an age-based retention window)'
|
|
18
19
|
]
|
|
19
20
|
},
|
|
20
21
|
full: {
|
|
21
|
-
description: `
|
|
22
|
+
description: `Workflow version management over two independent histories.
|
|
23
|
+
|
|
24
|
+
**source: "local"** (default) - the snapshots n8n-mcp writes before it changes a workflow. Numbered
|
|
25
|
+
per workflow, scoped to your n8n instance, available on any n8n version, and blind to anything that
|
|
26
|
+
did not go through n8n-mcp (a person editing the workflow in the n8n UI leaves no local snapshot).
|
|
27
|
+
This is the only source that supports delete and prune.
|
|
28
|
+
|
|
29
|
+
**source: "native"** - n8n's own workflow history, the same list the n8n UI shows, read through the
|
|
30
|
+
instance-level MCP server. It covers every change, including UI edits by people, and n8n owns its
|
|
31
|
+
retention, so delete and prune are refused with MODE_NOT_SUPPORTED_FOR_SOURCE. Requires an n8n MCP
|
|
32
|
+
access token (N8N_MCP_ACCESS_TOKEN) and the workflow's "Available in MCP" setting; the version ids
|
|
33
|
+
are opaque strings, not numbers.
|
|
34
|
+
|
|
35
|
+
Mode by source:
|
|
36
|
+
|
|
37
|
+
| mode | local | native |
|
|
38
|
+
|------|-------|--------|
|
|
39
|
+
| list | yes | yes (limit capped at 50, offset supported) |
|
|
40
|
+
| get | yes | yes |
|
|
41
|
+
| rollback | yes, optionally validated first | yes, never validated first |
|
|
42
|
+
| diff | yes (format: "n8n-mcp") | yes (format: "n8n") |
|
|
43
|
+
| delete | yes | MODE_NOT_SUPPORTED_FOR_SOURCE |
|
|
44
|
+
| prune | yes | MODE_NOT_SUPPORTED_FOR_SOURCE |
|
|
45
|
+
|
|
46
|
+
**Diff formats differ by source.** Local diff (\`data.format: "n8n-mcp"\`) reports \`addedNodes\`,
|
|
47
|
+
\`removedNodes\` and \`modifiedNodes\` as node **IDs**, \`connectionChanges\` as 0 or 1, and
|
|
48
|
+
\`settingChanges\` as a before/after settings diff. Native diff (\`data.format: "n8n"\`) is n8n's own
|
|
49
|
+
payload: field-level \`__old\`/\`__new\` values on modified nodes, plus connections added and removed.
|
|
50
|
+
|
|
51
|
+
**Native rollback is not pre-validated.** n8n's version payload carries only name, type and
|
|
52
|
+
credentials per node - no position, typeVersion or parameters - so there is nothing for the workflow
|
|
53
|
+
validator to check. \`validateBefore\` is accepted and ignored on native, and the response says
|
|
54
|
+
\`validation: "not available for native versions"\`.
|
|
55
|
+
|
|
56
|
+
**Consent flow for native modes.** If the workflow is not exposed to n8n's MCP server, the call
|
|
57
|
+
returns WORKFLOW_NOT_EXPOSED with a hint. Re-running with \`exposeToMcp: true\` turns on the
|
|
58
|
+
workflow's "Available in MCP" setting and retries once; the response then carries
|
|
59
|
+
\`exposedToMcp: true\`. That setting is visible and persistent in the n8n UI - confirm with the user
|
|
60
|
+
before enabling it. This flow only ever turns the setting on - disabling it again is a deliberate
|
|
61
|
+
\`updateSettings\` write (\`availableInMCP: false\`) or a change in the n8n UI.
|
|
62
|
+
|
|
63
|
+
Every response states \`mode\`, \`source\` and \`backend\` (\`"n8n-mcp"\` for local, \`"official-mcp"\`
|
|
64
|
+
for native).
|
|
65
|
+
|
|
66
|
+
Supports six operations:
|
|
22
67
|
|
|
23
68
|
**list** - Show version history for a workflow
|
|
24
69
|
- Returns all saved versions with timestamps, snapshot sizes, and metadata
|
|
@@ -33,45 +78,68 @@ exports.n8nWorkflowVersionsDoc = {
|
|
|
33
78
|
- Optionally validates the workflow structure before applying
|
|
34
79
|
- Returns the restored workflow and backup version ID
|
|
35
80
|
|
|
36
|
-
**
|
|
81
|
+
**diff** - Compare two versions
|
|
82
|
+
- Requires versionId and toVersionId
|
|
83
|
+
- Local: compares two stored snapshots of the same workflow (both must belong to workflowId)
|
|
84
|
+
- Native: returns n8n's own diff between two of its versions
|
|
85
|
+
|
|
86
|
+
**delete** - Delete specific version(s) (local only)
|
|
37
87
|
- Delete a single version by versionId
|
|
38
88
|
- Delete all versions for a workflow with deleteAll: true
|
|
39
89
|
|
|
40
90
|
**prune** - Clean up old versions
|
|
41
91
|
- Keeps only the N most recent versions (default: 10)
|
|
42
92
|
- Useful for managing storage and keeping history manageable
|
|
93
|
+
- Local only
|
|
43
94
|
|
|
44
|
-
|
|
45
|
-
under your own credentials. Old backups are also removed automatically (10 most recent
|
|
46
|
-
plus an age-based retention window).`,
|
|
95
|
+
Local version operations are scoped to your n8n instance — you can only see and act on backups
|
|
96
|
+
created under your own credentials. Old local backups are also removed automatically (10 most recent
|
|
97
|
+
per workflow, plus an age-based retention window). Native history retention is n8n's own.`,
|
|
47
98
|
parameters: {
|
|
48
99
|
mode: {
|
|
49
100
|
type: 'string',
|
|
50
101
|
required: true,
|
|
51
|
-
description: 'Operation mode: "list", "get", "rollback", "delete", or "prune"',
|
|
52
|
-
enum: ['list', 'get', 'rollback', 'delete', 'prune']
|
|
102
|
+
description: 'Operation mode: "list", "get", "rollback", "diff", "delete", or "prune"',
|
|
103
|
+
enum: ['list', 'get', 'rollback', 'delete', 'prune', 'diff']
|
|
104
|
+
},
|
|
105
|
+
source: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
required: false,
|
|
108
|
+
default: 'local',
|
|
109
|
+
description: 'Which history to read: "local" (n8n-mcp snapshots) or "native" (n8n\'s own version history). delete and prune are local-only.',
|
|
110
|
+
enum: ['local', 'native']
|
|
53
111
|
},
|
|
54
112
|
workflowId: {
|
|
55
113
|
type: 'string',
|
|
56
114
|
required: false,
|
|
57
|
-
description: 'Workflow ID (required for list, rollback, delete, prune modes)'
|
|
115
|
+
description: 'Workflow ID (required for list, rollback, diff, delete, prune modes; required for every native mode)'
|
|
58
116
|
},
|
|
59
117
|
versionId: {
|
|
60
|
-
type: 'number',
|
|
118
|
+
type: 'string | number',
|
|
119
|
+
required: false,
|
|
120
|
+
description: 'Version ID. local: numeric snapshot id (number or numeric string; anything else is INVALID_ARGS). native: n8n\'s version id string. Required for get and diff, for a single delete, and for native rollback; optional for local rollback.'
|
|
121
|
+
},
|
|
122
|
+
toVersionId: {
|
|
123
|
+
type: 'string | number',
|
|
61
124
|
required: false,
|
|
62
|
-
description: '
|
|
125
|
+
description: 'The second version to compare against in diff mode (same id format as versionId)'
|
|
63
126
|
},
|
|
64
127
|
limit: {
|
|
65
128
|
type: 'number',
|
|
66
129
|
required: false,
|
|
67
130
|
default: 10,
|
|
68
|
-
description: 'Maximum versions to return in list mode'
|
|
131
|
+
description: 'Maximum versions to return in list mode (native: capped at 50)'
|
|
132
|
+
},
|
|
133
|
+
offset: {
|
|
134
|
+
type: 'number',
|
|
135
|
+
required: false,
|
|
136
|
+
description: 'Skip this many versions in native list mode'
|
|
69
137
|
},
|
|
70
138
|
validateBefore: {
|
|
71
139
|
type: 'boolean',
|
|
72
140
|
required: false,
|
|
73
141
|
default: true,
|
|
74
|
-
description: 'Validate workflow structure before rollback (rollback
|
|
142
|
+
description: 'Validate workflow structure before rollback (local rollback only; accepted and ignored on native)'
|
|
75
143
|
},
|
|
76
144
|
deleteAll: {
|
|
77
145
|
type: 'boolean',
|
|
@@ -84,6 +152,17 @@ plus an age-based retention window).`,
|
|
|
84
152
|
required: false,
|
|
85
153
|
default: 10,
|
|
86
154
|
description: 'Keep N most recent versions (prune mode only)'
|
|
155
|
+
},
|
|
156
|
+
exposeToMcp: {
|
|
157
|
+
type: 'boolean',
|
|
158
|
+
required: false,
|
|
159
|
+
description: 'Native only. On a WORKFLOW_NOT_EXPOSED refusal, enable the workflow\'s "Available in MCP" setting and retry once. Visible, persistent change - confirm with the user first.'
|
|
160
|
+
},
|
|
161
|
+
timeoutMs: {
|
|
162
|
+
type: 'integer',
|
|
163
|
+
required: false,
|
|
164
|
+
default: 30000,
|
|
165
|
+
description: 'Client deadline for the native call (5000-600000)'
|
|
87
166
|
}
|
|
88
167
|
},
|
|
89
168
|
returns: `Response varies by mode:
|
|
@@ -103,9 +182,17 @@ plus an age-based retention window).`,
|
|
|
103
182
|
**delete mode:**
|
|
104
183
|
- deletedCount: Number of versions deleted
|
|
105
184
|
|
|
185
|
+
**diff mode:**
|
|
186
|
+
- data.format: "n8n-mcp" (local) or "n8n" (native) - the two payloads are shaped differently
|
|
187
|
+
- local: addedNodes / removedNodes / modifiedNodes (node IDs), connectionChanges (0 or 1), settingChanges, nodeGroupChanges
|
|
188
|
+
- native: nodesAdded / nodesRemoved / nodesModified (with field-level __old/__new), connectionsAdded, connectionsRemoved
|
|
189
|
+
|
|
106
190
|
**prune mode:**
|
|
107
191
|
- prunedCount: Number of old versions removed
|
|
108
|
-
- remainingCount: Number of versions kept
|
|
192
|
+
- remainingCount: Number of versions kept
|
|
193
|
+
|
|
194
|
+
Every response also carries mode, source and backend ("n8n-mcp" for local, "official-mcp" for native).
|
|
195
|
+
Native rollback additionally carries validation: "not available for native versions".`,
|
|
109
196
|
examples: [
|
|
110
197
|
'// List version history\nn8n_workflow_versions({mode: "list", workflowId: "abc123", limit: 5})',
|
|
111
198
|
'// Get specific version details\nn8n_workflow_versions({mode: "get", versionId: 42})',
|
|
@@ -113,7 +200,12 @@ plus an age-based retention window).`,
|
|
|
113
200
|
'// Rollback to specific version\nn8n_workflow_versions({mode: "rollback", workflowId: "abc123", versionId: 42})',
|
|
114
201
|
'// Delete specific version\nn8n_workflow_versions({mode: "delete", workflowId: "abc123", versionId: 42})',
|
|
115
202
|
'// Delete all versions for workflow\nn8n_workflow_versions({mode: "delete", workflowId: "abc123", deleteAll: true})',
|
|
116
|
-
'// Prune to keep only 5 most recent\nn8n_workflow_versions({mode: "prune", workflowId: "abc123", maxVersions: 5})'
|
|
203
|
+
'// Prune to keep only 5 most recent\nn8n_workflow_versions({mode: "prune", workflowId: "abc123", maxVersions: 5})',
|
|
204
|
+
'// Compare two local snapshots\nn8n_workflow_versions({mode: "diff", workflowId: "abc123", versionId: 41, toVersionId: 42})',
|
|
205
|
+
'// List n8n\'s own history, including UI edits\nn8n_workflow_versions({mode: "list", source: "native", workflowId: "abc123", limit: 20})',
|
|
206
|
+
'// Compare two of n8n\'s own versions\nn8n_workflow_versions({mode: "diff", source: "native", workflowId: "abc123", versionId: "v1", toVersionId: "v2"})',
|
|
207
|
+
'// Restore one of n8n\'s own versions (no pre-validation)\nn8n_workflow_versions({mode: "rollback", source: "native", workflowId: "abc123", versionId: "v1"})',
|
|
208
|
+
'// Retry after WORKFLOW_NOT_EXPOSED, enabling the setting\nn8n_workflow_versions({mode: "list", source: "native", workflowId: "abc123", exposeToMcp: true})'
|
|
117
209
|
],
|
|
118
210
|
useCases: [
|
|
119
211
|
'Recover from accidental workflow changes',
|
|
@@ -127,16 +219,21 @@ plus an age-based retention window).`,
|
|
|
127
219
|
- get: Fast (~100ms) - single row retrieval
|
|
128
220
|
- rollback: Moderate (~200-500ms) - includes backup creation and workflow update
|
|
129
221
|
- delete: Fast (~50-100ms) - database delete operation
|
|
130
|
-
- prune: Moderate (~100-300ms) - depends on number of versions to delete
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
222
|
+
- prune: Moderate (~100-300ms) - depends on number of versions to delete
|
|
223
|
+
- diff (local): Fast (~100ms) - two snapshot reads and an in-memory comparison
|
|
224
|
+
- native modes: one round-trip to n8n's MCP server per call (30s client deadline by default), so slower than any local mode`,
|
|
225
|
+
modeComparison: `| Mode | Required Params | Optional Params | Sources | Risk Level |
|
|
226
|
+
|------|-----------------|-----------------|---------|------------|
|
|
227
|
+
| list | workflowId | limit, offset | local, native | Low |
|
|
228
|
+
| get | versionId (native: + workflowId) | - | local, native | Low |
|
|
229
|
+
| diff | workflowId, versionId, toVersionId | - | local, native | Low |
|
|
230
|
+
| rollback | workflowId | versionId, validateBefore | local, native | Medium |
|
|
231
|
+
| delete | workflowId | versionId, deleteAll | local | High |
|
|
232
|
+
| prune | workflowId | maxVersions | local | Medium |`,
|
|
138
233
|
bestPractices: [
|
|
139
234
|
'Always list versions before rollback to pick the right one',
|
|
235
|
+
'Use source: "native" when the workflow is also edited in the n8n UI - local snapshots miss those edits',
|
|
236
|
+
'Read a diff before a rollback so you know what the restore will change',
|
|
140
237
|
'Enable validateBefore for rollback to catch structural issues',
|
|
141
238
|
'Use prune regularly to keep version history manageable',
|
|
142
239
|
'Document why you are rolling back for audit purposes'
|
|
@@ -146,7 +243,11 @@ plus an age-based retention window).`,
|
|
|
146
243
|
'Deleted versions cannot be recovered',
|
|
147
244
|
'Version operations are scoped to your instance - versions from other instances are not visible',
|
|
148
245
|
'Version IDs are sequential but may have gaps after deletes',
|
|
149
|
-
'Large workflows may have significant version storage overhead'
|
|
246
|
+
'Large workflows may have significant version storage overhead',
|
|
247
|
+
'Local and native version ids are different id spaces - a native id will not resolve locally',
|
|
248
|
+
'Native rollback is not validated before it is applied; n8n\'s version payload lacks the fields the validator needs',
|
|
249
|
+
'Native delete and prune are refused (MODE_NOT_SUPPORTED_FOR_SOURCE) - n8n owns that retention',
|
|
250
|
+
'Diff payloads differ by source; branch on data.format rather than assuming field names'
|
|
150
251
|
],
|
|
151
252
|
relatedTools: [
|
|
152
253
|
'n8n_get_workflow - View current workflow state',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n-workflow-versions.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-workflow-versions.ts"],"names":[],"mappings":";;;AAEa,QAAA,sBAAsB,GAAsB;IACvD,IAAI,EAAE,uBAAuB;IAC7B,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"n8n-workflow-versions.js","sourceRoot":"","sources":["../../../../src/mcp/tool-docs/workflow_management/n8n-workflow-versions.ts"],"names":[],"mappings":";;;AAEa,QAAA,sBAAsB,GAAsB;IACvD,IAAI,EAAE,uBAAuB;IAC7B,QAAQ,EAAE,qBAAqB;IAC/B,UAAU,EAAE;QACV,WAAW,EAAE,yIAAyI;QACtJ,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,CAAC;QAC5D,OAAO,EAAE,6DAA6D;QACtE,WAAW,EAAE,sHAAsH;QACnI,IAAI,EAAE;YACJ,2DAA2D;YAC3D,6FAA6F;YAC7F,8DAA8D;YAC9D,kEAAkE;YAClE,sEAAsE;YACtE,wFAAwF;SACzF;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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nE;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,+CAA+C;aAC7D;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,KAAK;gBACf,WAAW,EAAE,6KAA6K;aAC3L;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,mDAAmD;aACjE;SACF;QACD,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;sFA2ByE;QAClF,QAAQ,EAAE;YACR,gGAAgG;YAChG,sFAAsF;YACtF,sGAAsG;YACtG,iHAAiH;YACjH,0GAA0G;YAC1G,qHAAqH;YACrH,mHAAmH;YACnH,6HAA6H;YAC7H,0IAA0I;YAC1I,0JAA0J;YAC1J,+JAA+J;YAC/J,6JAA6J;SAC9J;QACD,QAAQ,EAAE;YACR,0CAA0C;YAC1C,iDAAiD;YACjD,gDAAgD;YAChD,gDAAgD;YAChD,uCAAuC;SACxC;QACD,WAAW,EAAE;;;;;;;4HAO2G;QACxH,cAAc,EAAE;;;;;;;sDAOkC;QAClD,aAAa,EAAE;YACb,4DAA4D;YAC5D,wGAAwG;YACxG,wEAAwE;YACxE,+DAA+D;YAC/D,wDAAwD;YACxD,sDAAsD;SACvD;QACD,QAAQ,EAAE;YACR,wEAAwE;YACxE,sCAAsC;YACtC,gGAAgG;YAChG,4DAA4D;YAC5D,+DAA+D;YAC/D,6FAA6F;YAC7F,oHAAoH;YACpH,+FAA+F;YAC/F,wFAAwF;SACzF;QACD,YAAY,EAAE;YACZ,gDAAgD;YAChD,wDAAwD;YACxD,oDAAoD;SACrD;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function getDisabledTools(): Set<string>;
|
|
2
|
+
export declare function isToolDisabled(toolName: string): boolean;
|
|
3
|
+
export declare function getValidOperations(toolName: string): Set<string>;
|
|
4
|
+
export declare function getDisabledToolOperations(): Map<string, Set<string>>;
|
|
5
|
+
export declare function getDisabledOperations(toolName: string): Set<string>;
|
|
6
|
+
export declare function resolveRequestedOperation(toolName: string, args: any): unknown;
|
|
7
|
+
export declare function isOperationDisabled(toolName: string, operation: string): boolean;
|
|
8
|
+
export declare function resetToolPolicyCache(): void;
|
|
9
|
+
//# sourceMappingURL=tool-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-policy.d.ts","sourceRoot":"","sources":["../../src/mcp/tool-policy.ts"],"names":[],"mappings":"AAmCA,wBAAgB,gBAAgB,IAAI,GAAG,CAAC,MAAM,CAAC,CA+B9C;AAGD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAcD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAUhE;AAWD,wBAAgB,yBAAyB,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAoEpE;AAGD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAEnE;AAeD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAQ9E;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEhF;AAGD,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
|