Skip to main content
Glama
n8n MCP Server

n8n MCP Server

by r-ms

n8n MCP Server

MCP server for n8n workflow automation. Built for AI agents (Claude Code, Claude Desktop, Cursor) that manage n8n workflows programmatically.

Smart validation, auto-fix for common pitfalls, embedded knowhow database, execution polling, credential management, and node discovery — in one server.

Why this exists

n8n's AI workflow features are enterprise-only. I wanted AI agents to build and manage my workflows, so I built this MCP server. It gives Claude (or any MCP-compatible agent) full programmatic control over n8n — and auto-fixes 7 common API quirks that trip up agents along the way.

Related MCP server: n8n Workflow Builder

Quick Start

git clone https://github.com/r-ms/n8n-mcp.git
cd n8n-mcp
npm install
npm run build

Configuration

All configuration is via environment variables passed through your MCP client config.

Variable

Required

Description

N8N_API_URL

Yes

n8n instance URL (e.g. http://localhost:5678)

N8N_API_KEY

Yes

n8n Public API key (Settings → API → Create API Key)

N8N_WEBHOOK_URL

No

Separate base URL for webhooks if behind a reverse proxy. Defaults to N8N_API_URL

N8N_MCP_API_KEY

No

n8n MCP Server API key for node discovery tools (Settings → MCP Server). Requires n8n 2.14+

Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "n8n": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/n8n-mcp/dist/index.js"],
      "env": {
        "N8N_API_URL": "http://localhost:5678",
        "N8N_API_KEY": "your-api-key"
      }
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "n8n": {
      "command": "node",
      "args": ["/path/to/n8n-mcp/dist/index.js"],
      "env": {
        "N8N_API_URL": "http://localhost:5678",
        "N8N_API_KEY": "your-api-key"
      }
    }
  }
}

Tools (20)

Workflow Management (8)

Tool

Description

n8n_list_workflows

List all workflows, filter by active status or name

n8n_get_workflow

Get full workflow definition with pre-flight validation warnings

n8n_create_workflow

Create workflow with auto-fix for common pitfalls

n8n_update_workflow

Partial update — auto-hydrates missing fields from current version

n8n_update_workflow_json

Deploy a complete workflow from a JSON string. Optionally activate

n8n_delete_workflow

Delete workflow (auto-deactivates first, requires confirmation)

n8n_activate_workflow

Activate workflow (enable triggers)

n8n_deactivate_workflow

Deactivate workflow (stop triggers)

Execution & Monitoring (4)

Tool

Description

n8n_list_executions

List recent executions with status filtering and success rate

n8n_get_execution

Detailed execution trace — node timing, items, errors, knowhow hints. verbose mode for full output

n8n_run_workflow

Trigger via webhook. Waits for result by default (120s timeout), returns full trace

n8n_diagnose_workflow

Run all pre-flight checks on a workflow without executing

Ad-hoc Execution (1)

Tool

Description

n8n_run_adhoc

Run a one-off node chain — creates temp workflow, executes via webhook, returns trace, auto-cleans up

Credentials (3)

Tool

Description

n8n_list_credentials

List all credentials (ID, name, type)

n8n_get_credential_schema

Get JSON schema for a credential type — shows required fields before creating

n8n_create_credential

Create a credential. On error, auto-fetches schema as a hint

Node Discovery (3) — requires N8N_MCP_API_KEY

Tool

Description

n8n_search_nodes

Search available node types by keyword. Returns IDs and discriminators

n8n_get_node_params

Get TypeScript type definitions for node parameters. Prevents guessing

n8n_get_suggested_nodes

Curated node recommendations by category (chatbot, scheduling, scraping, etc.)

Diagnostics (1)

Tool

Description

n8n_search_knowhow

Search the embedded knowhow database for solutions to n8n issues

Pre-flight Validation

Applied automatically on every create and update. Catches and fixes common n8n pitfalls before they reach the API:

Issue

Auto-fix

Code node v2 without language param

Downgrade to v1

Spaces in trigger node names (break webhooks)

Remove spaces, rewrite connections

Missing settings field

Add {executionOrder: "v1"}

ExecuteWorkflow workflowId as plain string

Wrap in {value: "ID"}

MongoDB find without alwaysOutputData

Set to true

SplitInBatches v3 wired to wrong output

Move connections from output 0 (done) to output 1 (loop)

Missing webhookId on trigger nodes

Auto-generate

Knowhow Database

11 pattern-matched entries. When an error occurs, the server matches it against known n8n issues and surfaces the solution:

Pattern

Solution

require() blocked in sandbox

Use n8n native nodes instead of Code node imports

ECONNREFUSED in Code node

Task Runner is network-isolated — use HTTP Request node

MongoDB limit type error

Must be integer, not expression string

Sub-workflow not published

Activate sub-workflows before parent

Webhook 404

Check: active? spaces in name? webhookId set?

Resilience

  • Retry with exponential backoff — 3 retries on network errors and 502/503

  • Execution polling — n8n_run_workflow polls every 2s until completion or timeout

  • Webhook 404 recovery — fuzzy-matches against active webhook paths and suggests corrections

Requirements

  • Node.js 18+

  • n8n with Public API enabled (any version)

  • n8n 2.14+ for node discovery tools (optional)

License

MIT

Available Tools

20 tools
n8n_activate_workflowB

Activate a workflow (enable triggers). Pre-validates before activating.

Inputs: workflowId (required).

n8n_create_credentialA

Create a new credential in n8n. Use n8n_get_credential_schema first to see required fields. On error, auto-fetches the schema as a hint.

Inputs: data (required), name (required), type (required).

n8n_create_workflowA

Create a new n8n workflow with pre-flight validation and auto-fix. Automatically fixes: Code v2→v1, missing settings, webhookId, SplitInBatches ports, MongoDB alwaysOutputData, ExecuteWorkflow workflowId format, node name spaces. After creation use n8n_activate_workflow to enable.

Inputs: name (required), nodes (required), connections (required), settings.

n8n_deactivate_workflowC

Deactivate a workflow (stop triggers).

Inputs: workflowId (required).

n8n_delete_workflowB

Delete a workflow. Auto-deactivates first if active.

Inputs: confirm (required), workflowId (required).

n8n_diagnose_workflowB

Run comprehensive diagnostics on a workflow without executing it. Checks all known n8n pitfalls: Code node versions, webhook paths, credential refs, SplitInBatches wiring, MongoDB alwaysOutputData, etc.

Inputs: workflowId (required).

n8n_get_credential_schemaA

Get the JSON schema for a credential type — shows required fields, types, and defaults. Use this before creating credentials to know exactly what data fields to pass.

Inputs: typeName (required).

n8n_get_executionA

Get detailed execution trace — shows each node's status, item count, errors, and duration. Auto-matches errors against knowhow database for fix suggestions. On failed executions, also runs pre-flight diagnostics on the workflow.

Inputs: executionId (required), verbose.

n8n_get_node_paramsA

Get TypeScript type definitions for n8n node parameters. Returns exact parameter names, types, and structures. MUST be called before writing workflow node definitions — prevents guessing parameter names. Include discriminators from search results if available.

Inputs: nodeId (required), resource, operation.

n8n_get_suggested_nodesA

Get curated node recommendations for workflow technique categories. Returns recommended nodes with pattern hints and configuration guidance. Use when designing a new workflow to discover the best nodes for your use case.

Inputs: categories (required).

n8n_get_workflowA

Get full workflow definition (nodes, connections, settings). Use to inspect structure or prepare updates.

Inputs: workflowId (required).

n8n_list_credentialsA

List all credentials configured in n8n. Shows ID, name, and type for each.

Inputs: no named parameters.

n8n_list_executionsA

List recent workflow executions. Filter by workflow ID or status (success/error). Shows execution timeline and error summary.

Inputs: limit, status, workflowId.

n8n_list_workflowsA

List all n8n workflows. Use to find workflow IDs, check active status, or search by name.

Inputs: active, filter.

n8n_run_adhocA

Run a one-off workflow: creates a temp workflow with your nodes, executes via webhook, waits for the result, then deletes it. Perfect for quick operations (MongoDB queries, HTTP requests) without leaving debris. Do NOT include trigger nodes — a webhook trigger is auto-added.

Inputs: nodes (required), data, timeout, connections.

n8n_run_workflowA

Trigger a workflow execution via its webhook URL. Workflow must have a webhook trigger and be active. By default waits for completion (120s timeout) and returns full execution trace. Set wait_for_result=false to fire-and-forget.

Inputs: webhookPath (required), data, timeout, workflowId, +1 more.

n8n_search_knowhowA

Search the embedded n8n knowhow database for solutions. Query with error messages, node types, or keywords like 'webhook 404', 'Code node require', 'SplitInBatches output'.

Inputs: query (required).

n8n_search_nodesA

Search available n8n node types by keyword. Returns node IDs, discriminators (resource/operation), and related nodes. Use this to find the correct node type before creating workflows.

Inputs: query (required).

n8n_update_workflowC

Update an existing workflow's nodes, connections, or settings. Same validation as create.

Inputs: workflowId (required), name, nodes, settings, +1 more.

n8n_update_workflow_jsonA

Deploy a complete workflow from JSON string. Parses the JSON, runs pre-flight validation/auto-fix, PUTs the update, and optionally activates. Use this for 'edit local file → deploy' patterns instead of raw curl.

Inputs: json (required), workflowId (required), activate.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 20 tools

    Disambiguation4/5

    Most tools map to a clearly distinct resource+action (workflow CRUD, node discovery, execution inspection, credentials, knowhow). The main soft overlaps are n8n_update_workflow vs n8n_update_workflow_json (both deploy workflow changes) and n8n_run_workflow vs n8n_run_adhoc (both execute), but descriptions make the boundaries explicit enough for correct selection. n8n_search_nodes vs n8n_get_suggested_nodes are also adjacent but differentiated as keyword search vs curated recommendations.

    Naming Consistency5/5

    Every tool uses the same n8n_ prefix followed by a snake_case verb_noun pattern (list_workflows, get_workflow, create_credential, search_knowhow). No mixing of camelCase or alternate verb styles. The predictable scheme makes related tools easy to group mentally.

    Tool Count4/5

    Twenty tools is on the heavy side, but the surface spans four genuinely different areas (workflows, nodes, executions, credentials) plus a knowhow lookup, so each tool maps to a real capability. The only arguable redundancy is n8n_update_workflow_json layering on top of n8n_update_workflow, which keeps it just short of a clean 5.

    Completeness4/5

    Workflow lifecycle is fully covered (list/get/create/update/delete/activate/deactivate), and executions, node discovery, and credential creation are supported. Gaps are minor: no credential update/delete or single-credential get, no execution delete/retry, and no workflow duplication, but agents can work around these via the JSON deploy and re-run paths.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers