@pagelines/n8n-mcp 0.3.0 → 0.3.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.
package/src/tools.ts DELETED
@@ -1,489 +0,0 @@
1
- /**
2
- * MCP Tool Definitions
3
- * Minimal, focused toolset for workflow management
4
- */
5
-
6
- import type { Tool } from '@modelcontextprotocol/sdk/types.js';
7
-
8
- export const tools: Tool[] = [
9
- // ─────────────────────────────────────────────────────────────
10
- // Workflow Operations
11
- // ─────────────────────────────────────────────────────────────
12
- {
13
- name: 'workflow_list',
14
- description: 'List all workflows. Returns id, name, active status.',
15
- inputSchema: {
16
- type: 'object',
17
- properties: {
18
- active: {
19
- type: 'boolean',
20
- description: 'Filter by active status',
21
- },
22
- limit: {
23
- type: 'number',
24
- description: 'Max results (default 100)',
25
- },
26
- },
27
- },
28
- },
29
-
30
- {
31
- name: 'workflow_get',
32
- description: 'Get a workflow by ID. Use format=summary for minimal response, compact (default) for nodes without parameters, full for everything.',
33
- inputSchema: {
34
- type: 'object',
35
- properties: {
36
- id: {
37
- type: 'string',
38
- description: 'Workflow ID',
39
- },
40
- format: {
41
- type: 'string',
42
- enum: ['summary', 'compact', 'full'],
43
- description: 'Response detail level. summary=minimal, compact=nodes without params (default), full=everything',
44
- },
45
- },
46
- required: ['id'],
47
- },
48
- },
49
-
50
- {
51
- name: 'workflow_create',
52
- description: 'Create a new workflow. Returns the created workflow with validation.',
53
- inputSchema: {
54
- type: 'object',
55
- properties: {
56
- name: {
57
- type: 'string',
58
- description: 'Workflow name (use snake_case)',
59
- },
60
- nodes: {
61
- type: 'array',
62
- description: 'Array of node definitions',
63
- items: {
64
- type: 'object',
65
- properties: {
66
- name: { type: 'string' },
67
- type: { type: 'string' },
68
- typeVersion: { type: 'number' },
69
- position: {
70
- type: 'array',
71
- items: { type: 'number' },
72
- minItems: 2,
73
- maxItems: 2,
74
- },
75
- parameters: { type: 'object' },
76
- credentials: { type: 'object' },
77
- },
78
- required: ['name', 'type', 'typeVersion', 'position', 'parameters'],
79
- },
80
- },
81
- connections: {
82
- type: 'object',
83
- description: 'Connection map: { "NodeName": { "main": [[{ "node": "TargetNode", "type": "main", "index": 0 }]] } }',
84
- },
85
- settings: {
86
- type: 'object',
87
- description: 'Workflow settings',
88
- },
89
- format: {
90
- type: 'string',
91
- enum: ['summary', 'compact', 'full'],
92
- description: 'Response detail level (default: compact)',
93
- },
94
- },
95
- required: ['name', 'nodes', 'connections'],
96
- },
97
- },
98
-
99
- {
100
- name: 'workflow_update',
101
- description: `Update a workflow using patch operations. ALWAYS preserves existing data.
102
-
103
- Operations:
104
- - addNode: Add a new node
105
- - removeNode: Remove a node and its connections
106
- - updateNode: Update node properties (INCLUDE ALL existing parameters to preserve them)
107
- - addConnection: Connect two nodes
108
- - removeConnection: Disconnect two nodes
109
- - updateSettings: Update workflow settings
110
- - updateName: Rename the workflow
111
-
112
- Example: { "operations": [{ "type": "updateNode", "nodeName": "my_node", "properties": { "parameters": { ...allExistingParams, "newParam": "value" } } }] }`,
113
- inputSchema: {
114
- type: 'object',
115
- properties: {
116
- id: {
117
- type: 'string',
118
- description: 'Workflow ID',
119
- },
120
- operations: {
121
- type: 'array',
122
- description: 'Array of patch operations',
123
- items: {
124
- type: 'object',
125
- properties: {
126
- type: {
127
- type: 'string',
128
- enum: ['addNode', 'removeNode', 'updateNode', 'addConnection', 'removeConnection', 'updateSettings', 'updateName'],
129
- },
130
- // For addNode
131
- node: { type: 'object' },
132
- // For removeNode, updateNode
133
- nodeName: { type: 'string' },
134
- // For updateNode
135
- properties: { type: 'object' },
136
- // For connections
137
- from: { type: 'string' },
138
- to: { type: 'string' },
139
- fromOutput: { type: 'number' },
140
- toInput: { type: 'number' },
141
- outputType: { type: 'string' },
142
- inputType: { type: 'string' },
143
- // For updateSettings
144
- settings: { type: 'object' },
145
- // For updateName
146
- name: { type: 'string' },
147
- },
148
- required: ['type'],
149
- },
150
- },
151
- format: {
152
- type: 'string',
153
- enum: ['summary', 'compact', 'full'],
154
- description: 'Response detail level (default: compact)',
155
- },
156
- },
157
- required: ['id', 'operations'],
158
- },
159
- },
160
-
161
- {
162
- name: 'workflow_delete',
163
- description: 'Delete a workflow permanently.',
164
- inputSchema: {
165
- type: 'object',
166
- properties: {
167
- id: {
168
- type: 'string',
169
- description: 'Workflow ID',
170
- },
171
- },
172
- required: ['id'],
173
- },
174
- },
175
-
176
- {
177
- name: 'workflow_activate',
178
- description: 'Activate a workflow (enable triggers).',
179
- inputSchema: {
180
- type: 'object',
181
- properties: {
182
- id: {
183
- type: 'string',
184
- description: 'Workflow ID',
185
- },
186
- },
187
- required: ['id'],
188
- },
189
- },
190
-
191
- {
192
- name: 'workflow_deactivate',
193
- description: 'Deactivate a workflow (disable triggers).',
194
- inputSchema: {
195
- type: 'object',
196
- properties: {
197
- id: {
198
- type: 'string',
199
- description: 'Workflow ID',
200
- },
201
- },
202
- required: ['id'],
203
- },
204
- },
205
-
206
- {
207
- name: 'workflow_execute',
208
- description: 'Execute a workflow via its webhook trigger. Workflow must have a webhook node.',
209
- inputSchema: {
210
- type: 'object',
211
- properties: {
212
- id: {
213
- type: 'string',
214
- description: 'Workflow ID',
215
- },
216
- data: {
217
- type: 'object',
218
- description: 'Data to send to the webhook',
219
- },
220
- },
221
- required: ['id'],
222
- },
223
- },
224
-
225
- // ─────────────────────────────────────────────────────────────
226
- // Execution Operations
227
- // ─────────────────────────────────────────────────────────────
228
- {
229
- name: 'execution_list',
230
- description: 'List workflow executions. Filter by workflow or status.',
231
- inputSchema: {
232
- type: 'object',
233
- properties: {
234
- workflowId: {
235
- type: 'string',
236
- description: 'Filter by workflow ID',
237
- },
238
- status: {
239
- type: 'string',
240
- enum: ['success', 'error', 'waiting'],
241
- description: 'Filter by status',
242
- },
243
- limit: {
244
- type: 'number',
245
- description: 'Max results (default 20)',
246
- },
247
- format: {
248
- type: 'string',
249
- enum: ['summary', 'compact', 'full'],
250
- description: 'Response detail level (default: compact)',
251
- },
252
- },
253
- },
254
- },
255
-
256
- {
257
- name: 'execution_get',
258
- description: 'Get execution details. Use format=summary for status only, compact (default) omits runData, full for everything including runData.',
259
- inputSchema: {
260
- type: 'object',
261
- properties: {
262
- id: {
263
- type: 'string',
264
- description: 'Execution ID',
265
- },
266
- format: {
267
- type: 'string',
268
- enum: ['summary', 'compact', 'full'],
269
- description: 'Response detail level. summary=status only, compact=no runData (default), full=everything',
270
- },
271
- },
272
- required: ['id'],
273
- },
274
- },
275
-
276
- // ─────────────────────────────────────────────────────────────
277
- // Validation & Quality
278
- // ─────────────────────────────────────────────────────────────
279
- {
280
- name: 'workflow_validate',
281
- description: `Validate a workflow against best practices:
282
- - snake_case naming
283
- - Explicit node references (no $json)
284
- - No hardcoded IDs or secrets
285
- - No orphan nodes
286
- - AI node structured output
287
- - Expression syntax validation`,
288
- inputSchema: {
289
- type: 'object',
290
- properties: {
291
- id: {
292
- type: 'string',
293
- description: 'Workflow ID to validate',
294
- },
295
- },
296
- required: ['id'],
297
- },
298
- },
299
-
300
- {
301
- name: 'workflow_autofix',
302
- description: `Auto-fix common validation issues:
303
- - Convert names to snake_case
304
- - Replace $json with explicit node references
305
- - Add AI structured output settings
306
-
307
- Returns the fixed workflow and list of changes made.`,
308
- inputSchema: {
309
- type: 'object',
310
- properties: {
311
- id: {
312
- type: 'string',
313
- description: 'Workflow ID to fix',
314
- },
315
- apply: {
316
- type: 'boolean',
317
- description: 'Apply fixes to n8n (default: false, dry-run)',
318
- },
319
- },
320
- required: ['id'],
321
- },
322
- },
323
-
324
- {
325
- name: 'workflow_format',
326
- description: 'Format a workflow: sort nodes by position, clean up null values.',
327
- inputSchema: {
328
- type: 'object',
329
- properties: {
330
- id: {
331
- type: 'string',
332
- description: 'Workflow ID to format',
333
- },
334
- apply: {
335
- type: 'boolean',
336
- description: 'Apply formatting to n8n (default: false)',
337
- },
338
- },
339
- required: ['id'],
340
- },
341
- },
342
-
343
- // ─────────────────────────────────────────────────────────────
344
- // Node Discovery
345
- // ─────────────────────────────────────────────────────────────
346
- {
347
- name: 'node_types_list',
348
- description: `List available n8n node types. Use this to discover valid node types BEFORE creating workflows.
349
-
350
- Returns: type name, display name, description, category, and version for each node.
351
- Use the search parameter to filter by keyword (searches type name, display name, and description).
352
-
353
- IMPORTANT: Always check node types exist before using them in workflow_create or workflow_update.`,
354
- inputSchema: {
355
- type: 'object',
356
- properties: {
357
- search: {
358
- type: 'string',
359
- description: 'Filter nodes by keyword (searches name, type, description)',
360
- },
361
- category: {
362
- type: 'string',
363
- description: 'Filter by category (e.g., "Core Nodes", "Flow", "AI")',
364
- },
365
- limit: {
366
- type: 'number',
367
- description: 'Max results (default 50)',
368
- },
369
- },
370
- },
371
- },
372
-
373
- // ─────────────────────────────────────────────────────────────
374
- // Version Control
375
- // ─────────────────────────────────────────────────────────────
376
- {
377
- name: 'version_list',
378
- description: 'List saved versions of a workflow (local snapshots).',
379
- inputSchema: {
380
- type: 'object',
381
- properties: {
382
- workflowId: {
383
- type: 'string',
384
- description: 'Workflow ID',
385
- },
386
- },
387
- required: ['workflowId'],
388
- },
389
- },
390
-
391
- {
392
- name: 'version_get',
393
- description: 'Get a specific saved version of a workflow.',
394
- inputSchema: {
395
- type: 'object',
396
- properties: {
397
- workflowId: {
398
- type: 'string',
399
- description: 'Workflow ID',
400
- },
401
- versionId: {
402
- type: 'string',
403
- description: 'Version ID (from version_list)',
404
- },
405
- format: {
406
- type: 'string',
407
- enum: ['summary', 'compact', 'full'],
408
- description: 'Response detail level (default: compact)',
409
- },
410
- },
411
- required: ['workflowId', 'versionId'],
412
- },
413
- },
414
-
415
- {
416
- name: 'version_save',
417
- description: 'Manually save a version snapshot of a workflow.',
418
- inputSchema: {
419
- type: 'object',
420
- properties: {
421
- workflowId: {
422
- type: 'string',
423
- description: 'Workflow ID',
424
- },
425
- reason: {
426
- type: 'string',
427
- description: 'Reason for saving (default: "manual")',
428
- },
429
- },
430
- required: ['workflowId'],
431
- },
432
- },
433
-
434
- {
435
- name: 'version_rollback',
436
- description: 'Restore a workflow to a previous version.',
437
- inputSchema: {
438
- type: 'object',
439
- properties: {
440
- workflowId: {
441
- type: 'string',
442
- description: 'Workflow ID',
443
- },
444
- versionId: {
445
- type: 'string',
446
- description: 'Version ID to restore',
447
- },
448
- format: {
449
- type: 'string',
450
- enum: ['summary', 'compact', 'full'],
451
- description: 'Response detail level (default: compact)',
452
- },
453
- },
454
- required: ['workflowId', 'versionId'],
455
- },
456
- },
457
-
458
- {
459
- name: 'version_diff',
460
- description: 'Compare two versions of a workflow or current state vs a version.',
461
- inputSchema: {
462
- type: 'object',
463
- properties: {
464
- workflowId: {
465
- type: 'string',
466
- description: 'Workflow ID',
467
- },
468
- fromVersionId: {
469
- type: 'string',
470
- description: 'First version ID (omit for current workflow state)',
471
- },
472
- toVersionId: {
473
- type: 'string',
474
- description: 'Second version ID',
475
- },
476
- },
477
- required: ['workflowId', 'toVersionId'],
478
- },
479
- },
480
-
481
- {
482
- name: 'version_stats',
483
- description: 'Get version control statistics.',
484
- inputSchema: {
485
- type: 'object',
486
- properties: {},
487
- },
488
- },
489
- ];
package/src/types.ts DELETED
@@ -1,140 +0,0 @@
1
- /**
2
- * n8n API Types
3
- * Minimal types for workflow management
4
- */
5
-
6
- export interface N8nNode {
7
- id: string;
8
- name: string;
9
- type: string;
10
- typeVersion: number;
11
- position: [number, number];
12
- parameters: Record<string, unknown>;
13
- credentials?: Record<string, { id: string; name: string }>;
14
- disabled?: boolean;
15
- notes?: string;
16
- notesInFlow?: boolean;
17
- }
18
-
19
- export interface N8nConnection {
20
- node: string;
21
- type: string;
22
- index: number;
23
- }
24
-
25
- export interface N8nConnections {
26
- [nodeName: string]: {
27
- [outputType: string]: N8nConnection[][];
28
- };
29
- }
30
-
31
- export interface N8nWorkflow {
32
- id: string;
33
- name: string;
34
- active: boolean;
35
- nodes: N8nNode[];
36
- connections: N8nConnections;
37
- settings?: Record<string, unknown>;
38
- staticData?: Record<string, unknown>;
39
- tags?: { id: string; name: string }[];
40
- createdAt: string;
41
- updatedAt: string;
42
- }
43
-
44
- export interface N8nWorkflowListItem {
45
- id: string;
46
- name: string;
47
- active: boolean;
48
- createdAt: string;
49
- updatedAt: string;
50
- tags?: { id: string; name: string }[];
51
- }
52
-
53
- export interface N8nExecution {
54
- id: string;
55
- workflowId: string;
56
- finished: boolean;
57
- mode: string;
58
- startedAt: string;
59
- stoppedAt?: string;
60
- status: 'success' | 'error' | 'waiting' | 'running';
61
- data?: {
62
- resultData?: {
63
- runData?: Record<string, unknown>;
64
- error?: { message: string };
65
- };
66
- };
67
- }
68
-
69
- export interface N8nExecutionListItem {
70
- id: string;
71
- workflowId: string;
72
- status: string;
73
- startedAt: string;
74
- stoppedAt?: string;
75
- mode: string;
76
- }
77
-
78
- // Patch operations for partial updates
79
- export type PatchOperation =
80
- | { type: 'addNode'; node: Omit<N8nNode, 'id'> & { id?: string } }
81
- | { type: 'removeNode'; nodeName: string }
82
- | { type: 'updateNode'; nodeName: string; properties: Partial<N8nNode> }
83
- | { type: 'addConnection'; from: string; to: string; fromOutput?: number; toInput?: number; outputType?: string; inputType?: string }
84
- | { type: 'removeConnection'; from: string; to: string; fromOutput?: number; toInput?: number; outputType?: string }
85
- | { type: 'updateSettings'; settings: Record<string, unknown> }
86
- | { type: 'updateName'; name: string }
87
- | { type: 'activate' }
88
- | { type: 'deactivate' };
89
-
90
- // Validation
91
- export interface ValidationWarning {
92
- node?: string;
93
- rule: string;
94
- message: string;
95
- severity: 'error' | 'warning' | 'info';
96
- }
97
-
98
- export interface ValidationResult {
99
- valid: boolean;
100
- warnings: ValidationWarning[];
101
- }
102
-
103
- // API response wrappers
104
- export interface N8nListResponse<T> {
105
- data: T[];
106
- nextCursor?: string;
107
- }
108
-
109
- // Node type information from n8n API (GET /api/v1/nodes)
110
- export interface N8nNodeType {
111
- name: string; // e.g., "n8n-nodes-base.webhook"
112
- displayName: string; // e.g., "Webhook"
113
- description: string;
114
- group: string[]; // e.g., ["trigger"]
115
- version: number;
116
- defaults?: {
117
- name: string;
118
- };
119
- codex?: {
120
- categories?: string[];
121
- alias?: string[];
122
- };
123
- }
124
-
125
- // Simplified node type for tool responses (reduced tokens)
126
- export interface N8nNodeTypeSummary {
127
- type: string; // Full type name
128
- name: string; // Display name
129
- description: string;
130
- category: string;
131
- version: number;
132
- }
133
-
134
- // Node type validation error
135
- export interface NodeTypeValidationError {
136
- nodeType: string;
137
- nodeName: string;
138
- message: string;
139
- suggestions?: string[];
140
- }