DEV Community

Artyom Rabzonov
Artyom Rabzonov

Posted on • Originally published at automatelab.tech

n8n MCP Server: Build, Lint, and Debug Workflows From Your AI Agent

Overview

"Install @automatelab/n8n-mcp, point your AI agent at it, and get nine tools that generate, lint, and diagnose n8n workflow JSON correctly the first time."

The package addresses a specific problem: generic language models produce n8n JSON that imports successfully but fails during runtime due to incorrect connection topology, deprecated node types, and silent data loss between nodes.

Nine Tools: Four Stateless, Five Live-Instance

Stateless tools (no n8n instance required):

  • n8n_generate_workflow - Converts plain English descriptions to workflow JSON with AI-Agent-aware topology
  • n8n_scaffold_node - Generates TypeScript files for custom node packages
  • n8n_lint_workflow - Identifies errors and warnings in workflow JSON
  • n8n_explain_execution - Diagnoses failed executions with per-node analysis

Live-instance tools (require API credentials):

  • n8n_list_workflows
  • n8n_get_workflow
  • n8n_create_workflow
  • n8n_activate_workflow
  • n8n_list_executions

Installation

npm install -g @automatelab/n8n-mcp
Enter fullscreen mode Exit fullscreen mode

Requires Node 20 or later. API keys are optional for stateless tools.

Configuration Across Hosts

The standard MCP configuration block works for Cursor, Claude Desktop, Claude Code, Cline, and Windsurf:

{
  "mcpServers": {
    "n8n": {
      "command": "npx",
      "args": ["-y", "@automatelab/n8n-mcp"],
      "env": {
        "N8N_API_URL": "https://your-n8n.example.com",
        "N8N_API_KEY": "n8n_..."
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Key Features

AI Agent Topology

The generator correctly wires AI Agent sub-nodes using typed connections (ai_languageModel, ai_memory, ai_tool) rather than defaulting to main connections that cause silent failures.

Linting Capabilities

The lint catches a small but high-value set: deprecated node types (function -> code, spreadsheetFile -> convertToFile), AI Agents missing a language model, IF-v1 schema, missing webhookId, broken connections.

Silent Data Loss Diagnosis

The explain tool identifies when nodes return zero items, causing downstream nodes to skip execution without errors - the top-cited n8n debugging pain point.

Comparison to Alternatives

This server focuses on first-run correctness and execution diagnosis. The alternative czlonkowski/n8n-mcp provides broader coverage with 20+ tools indexing all n8n nodes. Both can run simultaneously.

FAQ

Live instance required? No - four stateless tools work offline.

AI Agent import failures? Usually incorrect connection types; use the linter before importing.

Silent data loss? The explain tool flags zero-item handoffs with common cause hints.

API key location? Settings -> API -> Create API key in your n8n instance.


Originally published at automatelab.tech

Top comments (0)