Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
680 changes: 677 additions & 3 deletions src/mcp/handlers-n8n-manager.ts

Large diffs are not rendered by default.

2,195 changes: 2,195 additions & 0 deletions src/mcp/handlers-n8n-manager.ts.bak

Large diffs are not rendered by default.

82 changes: 81 additions & 1 deletion src/mcp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,18 +711,37 @@ export class N8NDocumentationMCPServer {
case 'n8n_get_workflow_minimal':
case 'n8n_update_full_workflow':
case 'n8n_delete_workflow':
case 'n8n_activate_workflow':
case 'n8n_deactivate_workflow':
case 'n8n_validate_workflow':
case 'n8n_autofix_workflow':
case 'n8n_get_execution':
case 'n8n_delete_execution':
case 'n8n_retry_execution':
case 'n8n_get_credential':
case 'n8n_delete_credential':
validationResult = ToolValidation.validateWorkflowId(args);
break;
case 'n8n_get_tag':
case 'n8n_update_tag':
case 'n8n_delete_tag':
// Validate tag ID is provided
if (!(args as any)?.id || (args as any).id.trim() === '') {
throw new ValidationError('Tag ID is required');
}
break;
case 'n8n_update_workflow_tags':
// Validate workflow ID is provided
if (!(args as any)?.workflowId || (args as any).workflowId.trim() === '') {
throw new ValidationError('Workflow ID is required');
}
break;
default:
// For tools not yet migrated to schema validation, use basic validation
return this.validateToolParamsBasic(toolName, args, legacyRequiredParams || []);
}

if (!validationResult.valid) {
if (validationResult && !validationResult.valid) {
const errorMessage = Validator.formatErrors(validationResult, toolName);
logger.error(`Parameter validation failed for ${toolName}:`, errorMessage);
throw new ValidationError(errorMessage);
Expand Down Expand Up @@ -1021,6 +1040,12 @@ export class N8NDocumentationMCPServer {
case 'n8n_delete_workflow':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleDeleteWorkflow(args, this.instanceContext);
case 'n8n_activate_workflow':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleActivateWorkflow(args, this.instanceContext);
case 'n8n_deactivate_workflow':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleDeactivateWorkflow(args, this.instanceContext);
case 'n8n_list_workflows':
// No required parameters
return n8nHandlers.handleListWorkflows(args, this.instanceContext);
Expand All @@ -1046,6 +1071,61 @@ export class N8NDocumentationMCPServer {
case 'n8n_delete_execution':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleDeleteExecution(args, this.instanceContext);
case 'n8n_retry_execution':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleRetryExecution(args, this.instanceContext);

// Credential Management
case 'n8n_create_credential':
this.validateToolParams(name, args, ['name', 'type', 'data']);
return n8nHandlers.handleCreateCredential(args, this.instanceContext);
case 'n8n_get_credential':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleGetCredential(args, this.instanceContext);
case 'n8n_delete_credential':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleDeleteCredential(args, this.instanceContext);
case 'n8n_get_credential_schema':
this.validateToolParams(name, args, ['credentialTypeName']);
return n8nHandlers.handleGetCredentialSchema(args, this.instanceContext);

// Tag Management
case 'n8n_create_tag':
this.validateToolParams(name, args, ['name']);
return n8nHandlers.handleCreateTag(args, this.instanceContext);
case 'n8n_list_tags':
// No required parameters
return n8nHandlers.handleListTags(args, this.instanceContext);
case 'n8n_get_tag':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleGetTag(args, this.instanceContext);
case 'n8n_update_tag':
this.validateToolParams(name, args, ['id', 'name']);
return n8nHandlers.handleUpdateTag(args, this.instanceContext);
case 'n8n_delete_tag':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleDeleteTag(args, this.instanceContext);
case 'n8n_update_workflow_tags':
this.validateToolParams(name, args, ['workflowId', 'tagIds']);
return n8nHandlers.handleUpdateWorkflowTags(args, this.instanceContext);

// Variable Management
case 'n8n_create_variable':
this.validateToolParams(name, args, ['key', 'value']);
return n8nHandlers.handleCreateVariable(args, this.instanceContext);
case 'n8n_list_variables':
// No required parameters
return n8nHandlers.handleListVariables(args, this.instanceContext);
case 'n8n_get_variable':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleGetVariable(args, this.instanceContext);
case 'n8n_update_variable':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleUpdateVariable(args, this.instanceContext);
case 'n8n_delete_variable':
this.validateToolParams(name, args, ['id']);
return n8nHandlers.handleDeleteVariable(args, this.instanceContext);

case 'n8n_health_check':
// No required parameters
return n8nHandlers.handleHealthCheck(this.instanceContext);
Expand Down
Loading
Loading