Skip to main content
Glama
DrBalls

n8n MCP Server

by DrBalls

n8n_create_workflow

Create automated workflows in n8n by defining nodes, connections, and settings to streamline business processes and data integration.

Instructions

Create a new workflow in n8n.

Args:

  • name (string): Workflow name (required)

  • nodes (array): Array of node objects, each with:

    • name (string): Node display name

    • type (string): Node type (e.g., "n8n-nodes-base.httpRequest")

    • position ([x, y]): Canvas position

    • parameters (object): Node-specific parameters

    • credentials (object, optional): Credential mappings

  • connections (object): Node connections mapping

  • settings (object, optional): Workflow settings

  • tags (array, optional): Tag IDs to associate

Returns: The created workflow with its assigned ID.

Example node types:

  • n8n-nodes-base.manualTrigger - Manual trigger

  • n8n-nodes-base.scheduleTrigger - Scheduled trigger

  • n8n-nodes-base.webhook - Webhook trigger

  • n8n-nodes-base.httpRequest - HTTP Request

  • n8n-nodes-base.code - Custom JavaScript/Python

  • n8n-nodes-base.set - Set data

  • n8n-nodes-base.if - Conditional

  • n8n-nodes-base.merge - Merge data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesWorkflow name
nodesNoArray of workflow nodes
connectionsNoNode connections mapping
settingsNoWorkflow settings
staticDataNoStatic data for the workflow
tagsNoArray of tag IDs to associate

Implementation Reference

  • The handler function for 'n8n_create_workflow' which calls the 'post' utility to create a workflow in n8n.
    async (params: z.infer<typeof CreateWorkflowSchema>) => {
      const workflow = await post<N8nWorkflow>('/workflows', params);
      
      return {
        content: [{ type: 'text', text: `✅ Workflow created successfully!\n\n${formatWorkflow(workflow)}` }],
        structuredContent: workflow
      };
    }
  • Registration of the 'n8n_create_workflow' tool, including its schema and description.
      server.registerTool(
        'n8n_create_workflow',
        {
          title: 'Create n8n Workflow',
          description: `Create a new workflow in n8n.
    
    Args:
      - name (string): Workflow name (required)
      - nodes (array): Array of node objects, each with:
        - name (string): Node display name
        - type (string): Node type (e.g., "n8n-nodes-base.httpRequest")
        - position ([x, y]): Canvas position
        - parameters (object): Node-specific parameters
        - credentials (object, optional): Credential mappings
      - connections (object): Node connections mapping
      - settings (object, optional): Workflow settings
      - tags (array, optional): Tag IDs to associate
    
    Returns:
      The created workflow with its assigned ID.
    
    Example node types:
      - n8n-nodes-base.manualTrigger - Manual trigger
      - n8n-nodes-base.scheduleTrigger - Scheduled trigger
      - n8n-nodes-base.webhook - Webhook trigger
      - n8n-nodes-base.httpRequest - HTTP Request
      - n8n-nodes-base.code - Custom JavaScript/Python
      - n8n-nodes-base.set - Set data
      - n8n-nodes-base.if - Conditional
      - n8n-nodes-base.merge - Merge data`,
          inputSchema: CreateWorkflowSchema,
          annotations: {
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: false
          }
        },
        async (params: z.infer<typeof CreateWorkflowSchema>) => {
          const workflow = await post<N8nWorkflow>('/workflows', params);
          
          return {
            content: [{ type: 'text', text: `✅ Workflow created successfully!\n\n${formatWorkflow(workflow)}` }],
            structuredContent: workflow
          };
        }
      );
  • Zod schema definition for 'CreateWorkflowSchema' used to validate inputs for 'n8n_create_workflow'.
    export const CreateWorkflowSchema = z.object({
      name: z.string().min(1).max(128)
        .describe('Workflow name'),
      nodes: z.array(NodeSchema).default([])
        .describe('Array of workflow nodes'),
      connections: z.record(z.record(z.array(z.array(ConnectionSchema)))).default({})
        .describe('Node connections mapping'),
      settings: WorkflowSettingsSchema.optional()
        .describe('Workflow settings'),
      staticData: z.record(z.unknown()).optional()
        .describe('Static data for the workflow'),
      tags: z.array(z.string()).optional()
        .describe('Array of tag IDs to associate')
    }).strict();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DrBalls/n8n-mcp-server-v2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server