mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-04-01 07:03:08 +00:00
feat: add n8n_generate_workflow tool for hosted workflow generation
Add new MCP tool that enables AI-powered workflow generation from natural language descriptions. Uses handler delegation pattern — hosting environments inject a GenerateWorkflowHandler via EngineOptions, self-hosted instances receive a hosted-only informational response. Handler flows through N8NMCPEngine → SingleSessionHTTPServer → N8NDocumentationMCPServer with helpers for createWorkflow, validateWorkflow, autofixWorkflow, and getWorkflow. Includes full tool documentation, tests, and corrected tools overview count. Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
dist/services/workflow-validator.js
vendored
12
dist/services/workflow-validator.js
vendored
@@ -14,6 +14,7 @@ const ai_node_validator_1 = require("./ai-node-validator");
|
||||
const ai_tool_validators_1 = require("./ai-tool-validators");
|
||||
const node_type_utils_1 = require("../utils/node-type-utils");
|
||||
const node_classification_1 = require("../utils/node-classification");
|
||||
const n8n_validation_1 = require("./n8n-validation");
|
||||
const tool_variant_generator_1 = require("./tool-variant-generator");
|
||||
const logger = new logger_1.Logger({ prefix: '[WorkflowValidator]' });
|
||||
exports.VALID_CONNECTION_TYPES = new Set([
|
||||
@@ -367,6 +368,17 @@ class WorkflowValidator {
|
||||
message: typeof warning === 'string' ? warning : warning.message || String(warning)
|
||||
});
|
||||
});
|
||||
if (node.type === 'n8n-nodes-base.if' || node.type === 'n8n-nodes-base.switch') {
|
||||
const conditionErrors = (0, n8n_validation_1.validateConditionNodeStructure)(node);
|
||||
for (const err of conditionErrors) {
|
||||
result.errors.push({
|
||||
type: 'error',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: err
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
result.errors.push({
|
||||
|
||||
Reference in New Issue
Block a user