@atom8n/n8n 2.5.1 → 2.5.2

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.
@@ -98,7 +98,7 @@ let Mcp = class Mcp extends base_command_1.BaseCommand {
98
98
  this.sanitizeToolName(path_1.default.basename(workflows[0].filePath, '.n8n'))
99
99
  : 'n8n MCP Server';
100
100
  const server = new McpServer({
101
- name: serverName,
101
+ name: 'n8n MCP Server',
102
102
  version: '1.0.0',
103
103
  });
104
104
  const usedToolNames = new Set();
@@ -116,20 +116,65 @@ let Mcp = class Mcp extends base_command_1.BaseCommand {
116
116
  node.type === 'n8n-nodes-base.start');
117
117
  const triggerType = triggerNode?.type ?? 'unknown';
118
118
  const isChatTrigger = triggerType === '@n8n/n8n-nodes-langchain.chatTrigger';
119
+ const isSubFlowTrigger = triggerType === 'n8n-nodes-base.executeWorkflowTrigger';
119
120
  this.logStderr(`[mcp] Registering tool "${toolName}" (trigger: ${triggerType})`);
120
- const inputSchemaShape = isChatTrigger
121
- ? { input: zod_1.z.string().describe('Input text for the chat workflow') }
122
- : { input: zod_1.z.string().optional().describe('Input text or data for the workflow') };
121
+ let inputSchemaShape;
122
+ let description;
123
+ if (isSubFlowTrigger) {
124
+ const params = triggerNode?.parameters;
125
+ const workflowInputs = (params?.workflowInputs?.values ??
126
+ []);
127
+ inputSchemaShape = {};
128
+ for (const field of workflowInputs) {
129
+ const name = field.name;
130
+ if (!name)
131
+ continue;
132
+ let zodType;
133
+ switch (field.type) {
134
+ case 'number':
135
+ zodType = zod_1.z.number();
136
+ break;
137
+ case 'boolean':
138
+ zodType = zod_1.z.boolean();
139
+ break;
140
+ default:
141
+ zodType = zod_1.z.string();
142
+ }
143
+ if (field.defaultValue !== undefined && field.defaultValue !== '') {
144
+ zodType = zodType.optional().describe(`${name} (default: ${field.defaultValue})`);
145
+ }
146
+ else {
147
+ zodType = zodType.describe(name);
148
+ }
149
+ inputSchemaShape[name] = zodType;
150
+ }
151
+ if (Object.keys(inputSchemaShape).length === 0) {
152
+ inputSchemaShape = {
153
+ input: zod_1.z.string().optional().describe('Input data for the workflow'),
154
+ };
155
+ }
156
+ description = `Execute the n8n workflow "${workflowData.name}". Provide the required input parameters.`;
157
+ this.logStderr(`[mcp] Sub-flow inputs: ${workflowInputs.map((f) => f.name).join(', ') || '(none)'}`);
158
+ }
159
+ else if (isChatTrigger) {
160
+ inputSchemaShape = { input: zod_1.z.string().describe('Input text for the chat workflow') };
161
+ description = `Execute the n8n workflow "${workflowData.name}". This is a chat-based workflow — provide input text.`;
162
+ }
163
+ else {
164
+ inputSchemaShape = {
165
+ input: zod_1.z.string().optional().describe('Input text or data for the workflow trigger'),
166
+ };
167
+ description = `Execute the n8n workflow "${workflowData.name}". Provide optional input text for the workflow trigger.`;
168
+ }
123
169
  const wfData = workflowData;
124
170
  const wfIsChatTrigger = isChatTrigger;
171
+ const wfIsSubFlowTrigger = isSubFlowTrigger;
125
172
  const wfToolName = toolName;
126
173
  server.registerTool(toolName, {
127
- description: `Execute the n8n workflow "${workflowData.name}". ${isChatTrigger
128
- ? 'This is a chat-based workflow — provide input text.'
129
- : 'Provide optional input text for the workflow trigger.'}`,
174
+ description,
130
175
  inputSchema: inputSchemaShape,
131
176
  }, async (args) => {
132
- return await this.executeWorkflowTool(wfToolName, wfData, wfIsChatTrigger, serverUrl, args);
177
+ return await this.executeWorkflowTool(wfToolName, wfData, wfIsChatTrigger, wfIsSubFlowTrigger, serverUrl, args);
133
178
  });
134
179
  }
135
180
  this.logStderr(`[mcp] Registered ${usedToolNames.size} tool(s): ${[...usedToolNames].join(', ')}`);
@@ -149,7 +194,7 @@ let Mcp = class Mcp extends base_command_1.BaseCommand {
149
194
  });
150
195
  this.logStderr(`[mcp] Server stopped.`);
151
196
  }
152
- async executeWorkflowTool(toolName, workflowData, isChatTrigger, serverUrl, args) {
197
+ async executeWorkflowTool(toolName, workflowData, isChatTrigger, isSubFlowTrigger, serverUrl, args) {
153
198
  this.logStderr(`[mcp] ── TOOL CALL: "${toolName}" ──`);
154
199
  this.logStderr(`[mcp] Input: ${JSON.stringify(args)}`);
155
200
  try {
@@ -162,7 +207,10 @@ let Mcp = class Mcp extends base_command_1.BaseCommand {
162
207
  const executeUrl = `${serverUrl}/rest/cli/run`;
163
208
  this.logStderr(`[mcp] POST ${executeUrl}`);
164
209
  const requestBody = { workflowData };
165
- if (args.input !== undefined) {
210
+ if (isSubFlowTrigger) {
211
+ requestBody.inputData = args;
212
+ }
213
+ else if (args.input !== undefined) {
166
214
  if (isChatTrigger) {
167
215
  requestBody.chatInput = String(args.input);
168
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atom8n/n8n",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "n8n Workflow Automation Tool",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index.d.ts",
@@ -56,8 +56,8 @@
56
56
  "dist"
57
57
  ],
58
58
  "devDependencies": {
59
- "@n8n/typescript-config": "npm:@atom8n/typescript-config@1.6.1",
60
- "@n8n/backend-test-utils": "npm:@atom8n/backend-test-utils@1.5.1",
59
+ "@n8n/typescript-config": "npm:@atom8n/typescript-config@1.6.2",
60
+ "@n8n/backend-test-utils": "npm:@atom8n/backend-test-utils@1.5.2",
61
61
  "@redocly/cli": "^1.28.5",
62
62
  "@types/aws4": "^1.5.1",
63
63
  "@types/bcryptjs": "^2.4.2",
@@ -96,22 +96,22 @@
96
96
  "@azure/keyvault-secrets": "4.8.0",
97
97
  "@google-cloud/secret-manager": "5.6.0",
98
98
  "@modelcontextprotocol/sdk": "1.24.0",
99
- "@n8n/ai-workflow-builder": "npm:@atom8n/ai-workflow-builder@1.5.1",
100
- "@n8n/api-types": "npm:@atom8n/api-types@1.5.1",
101
- "@n8n/backend-common": "npm:@atom8n/backend-common@1.5.1",
102
- "@n8n/client-oauth2": "npm:@atom8n/client-oauth2@1.3.1",
103
- "@n8n/config": "npm:@atom8n/config@2.4.1",
104
- "@n8n/constants": "npm:@atom8n/constants@0.18.1",
105
- "@n8n/db": "npm:@atom8n/db@1.5.1",
106
- "@n8n/decorators": "npm:@atom8n/decorators@1.5.1",
107
- "@n8n/di": "npm:@atom8n/di@0.13.1",
108
- "@n8n/errors": "npm:@atom8n/errors@0.8.1",
99
+ "@n8n/ai-workflow-builder": "npm:@atom8n/ai-workflow-builder@1.5.2",
100
+ "@n8n/api-types": "npm:@atom8n/api-types@1.5.2",
101
+ "@n8n/backend-common": "npm:@atom8n/backend-common@1.5.2",
102
+ "@n8n/client-oauth2": "npm:@atom8n/client-oauth2@1.3.2",
103
+ "@n8n/config": "npm:@atom8n/config@2.4.2",
104
+ "@n8n/constants": "npm:@atom8n/constants@0.18.2",
105
+ "@n8n/db": "npm:@atom8n/db@1.5.2",
106
+ "@n8n/decorators": "npm:@atom8n/decorators@1.5.2",
107
+ "@n8n/di": "npm:@atom8n/di@0.13.2",
108
+ "@n8n/errors": "npm:@atom8n/errors@0.8.2",
109
109
  "@n8n/localtunnel": "3.0.0",
110
- "@n8n/n8n-nodes-langchain": "npm:@atom8n/n8n-nodes-langchain@2.5.1",
111
- "@n8n/permissions": "npm:@atom8n/permissions@0.48.1",
112
- "@n8n/task-runner": "npm:@atom8n/task-runner@2.5.1",
110
+ "@n8n/n8n-nodes-langchain": "npm:@atom8n/n8n-nodes-langchain@2.5.2",
111
+ "@n8n/permissions": "npm:@atom8n/permissions@0.48.2",
112
+ "@n8n/task-runner": "npm:@atom8n/task-runner@2.5.2",
113
113
  "@n8n/typeorm": "0.3.20-15",
114
- "@n8n/utils": "npm:@atom8n/utils@1.24.1",
114
+ "@n8n/utils": "npm:@atom8n/utils@1.24.2",
115
115
  "@n8n_io/ai-assistant-sdk": "1.19.1",
116
116
  "@n8n_io/license-sdk": "2.24.1",
117
117
  "@rudderstack/rudder-sdk-node": "2.1.4",
@@ -152,10 +152,10 @@
152
152
  "lodash": "4.17.21",
153
153
  "luxon": "3.4.4",
154
154
  "mysql2": "3.15.0",
155
- "n8n-core": "npm:@atom8n/n8n-core@2.5.1",
156
- "n8n-editor-ui": "npm:@atom8n/n8n-editor-ui@2.5.1",
157
- "n8n-nodes-base": "npm:@atom8n/n8n-nodes-base@2.5.1",
158
- "n8n-workflow": "npm:@atom8n/n8n-workflow@2.5.1",
155
+ "n8n-core": "npm:@atom8n/n8n-core@2.5.2",
156
+ "n8n-editor-ui": "npm:@atom8n/n8n-editor-ui@2.5.2",
157
+ "n8n-nodes-base": "npm:@atom8n/n8n-nodes-base@2.5.2",
158
+ "n8n-workflow": "npm:@atom8n/n8n-workflow@2.5.2",
159
159
  "nanoid": "3.3.8",
160
160
  "nodemailer": "7.0.11",
161
161
  "oauth-1.0a": "2.2.6",