N8n Mcp

io.github.ratamaha-git由 GitHub 帳號 ratamaha-git 發布v0.3.0更新於 Oct 24, 2026

MCP server for n8n: generate, lint, explain failed executions, drive live n8n via REST.

已驗證STDIO僅桌面效率與工作流開發者工具

概覽

AI 產生的概覽

針對 n8n 的 MCP 伺服器,讓助理產生、檢查、比對與診斷 n8n 工作流程,並可透過 REST 介面操作線上的 n8n 執行個體。

可以做什麼
  • 依自然語言描述產生工作流程 JSON,包含 AI Agent 子節點連線結構,並產生自訂節點的 TypeScript 檔案
  • 以 20 多條規則檢查工作流程 JSON,並對兩份工作流程做語意差異比對
  • 診斷失敗的執行:逐節點說明並提供提示、為單一節點產生重播工作流程、輸出逐節點時間軸
  • 管理線上工作流程:列出、取得、建立與啟用或停用
  • 瀏覽線上執行個體的執行紀錄,可選擇包含完整執行資料
適用情境
適合在建置或維護 n8n 自動化時使用,讓助理產出可直接匯入的工作流程 JSON、在匯入前找出無聲失敗,或解釋某次執行為何遺失資料。若希望助理讀取或修改執行中 n8n 伺服器上的工作流程,可再啟用線上執行個體工具。
執行需求
以 npm 套件形式在本機透過 stdio 執行,需要 Node 20 或更新版本,通常以 npx 啟動。無狀態工具不需其他設定。REST 工具需要環境變數 N8N_API_URL 與 N8N_API_KEY,金鑰在 n8n 的 Settings、API 中建立。選用策略變數 N8N_MCP_READ_ONLY、N8N_MCP_DISABLED_TOOLS、N8N_MCP_ALLOWED_WORKFLOW_IDS 與 N8N_MCP_ALLOWED_TAGS 可限制其權限。
安裝前請注意
N8N_API_KEY 中的 API 金鑰可存取你的 n8n 執行個體,應放在主機設定中而非提示詞裡。啟用線上工具後,助理可建立工作流程並將其啟用,可能觸發真實自動化與副作用。可用 N8N_MCP_READ_ONLY 或 N8N_MCP_DISABLED_TOOLS 阻止寫入。自 v0.4.0 起工具名稱有變更,舊提示詞與腳本可能失效。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 N8n Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

n8n-mcp

An MCP server for n8n that gives Claude, Cursor, and other AI agents tools for generating workflows, linting, diagnosing failed executions, and driving live n8n instances.

[npm] [License] [CI]

Why we built this

We use n8n daily inside AutomateLab and kept hitting the same LLM failures: workflow JSON that imports but fails at runtime, AI Agent clusters wired with the wrong connection types, executions that silently drop items with no clue where to look. Dumping the whole n8n catalog into context doesn't fix it - the failure modes are too subtle (typeVersion mismatches, IF v1 schema, credentials that don't survive import).

So we built a small, focused server: encode the failure modes the lint can catch, the cluster topology the generator must respect, and the diagnosis the agent can't do alone. For the historical launch walkthrough, covering the original nine tools with example output, see the launch post on automatelab.tech.

Why it's different

Other n8n MCP servers (notably czlonkowski/n8n-mcp) compete on breadth - 20+ tools and an indexed corpus of every n8n node. They own that niche.

This server is the debugging-and-first-run-correctness MCP for n8n:

  • execution_explain is the wedge. Paste the execution JSON; get back per-node findings: which nodes returned 0 items, which had unresolved ={{ ... }} expressions, error messages with concrete hints. No other MCP server does this well, and it hits the n8n community's #1 debugging pain point (silent data loss between nodes).
  • workflow_generate is opinionated about AI Agent topology - emits proper LangChain clusters with ai_languageModel / ai_memory / ai_tool connections (sub-nodes connect upward to the agent, not via main). Imports cleanly on n8n 1.x.
  • workflow_lint catches the silent failures: deprecated node types (Function → Code, spreadsheetFile → convertToFile), AI Agent missing language model, IF v1 schema, Webhook missing webhookId, broken connections across all connection types (not just main).
  • 5 REST tools (gated on N8N_API_URL + N8N_API_KEY) let you list, fetch, create, activate workflows and pull executions - so the lint and explain tools can run against your live workflows, not just JSON pasted in chat.

Plus: a paired Agent Skill that teaches the model when to use which tool and where to load deeper context (split into references/ so it doesn't bloat the prompt).

Tools

Tool names follow dot-notation and form a navigable tree: node.*, workflow.*, execution.*. Every tool declares an outputSchema (so callers can type-check responses) and MCP annotations (read-only / destructive / idempotent / open-world hints).

Stateless (work without a live n8n instance):

ToolPurpose
workflow_generatePlain-English description → workflow JSON. Detects AI-agent intent.
node_scaffoldDescription → single INodeType TypeScript file for a custom n8n package.
workflow_lintWorkflow JSON → list of errors and warnings (20+ rules).
workflow_diffTwo workflows → semantic diff (nodes added/removed/modified, connections, settings).
execution_explainFailed execution JSON → per-node diagnosis with hints.
execution_replayWorkflow + node → self-contained replay workflow that exercises just that node.
execution_timelineExecution JSON → per-node timeline table (start, duration, items in/out, errors).

Live-instance (require N8N_API_URL + N8N_API_KEY env vars):

ToolPurpose
workflow_listPaginate workflows; filter by active/tags/name.
workflow_getFetch a workflow by id.
workflow_createPOST a workflow. Strips read-only fields.
workflow_activateFlip active on/off.
execution_listBrowse executions; pass includeData: true for the full body.

v0.5.0 changes. Three new tools: workflow_diff, execution_replay, execution_timeline. Lint expanded with 10 new rules (rate-limit, credential drift, expression staleness, code sandbox, webhook test path, manualTrigger-in-active, DST schedule risk, disabled-but-wired, empty Set, HTTP method/body mismatch). New runtime policy env vars: N8N_MCP_READ_ONLY, N8N_MCP_DISABLED_TOOLS, N8N_MCP_ALLOWED_WORKFLOW_IDS, N8N_MCP_ALLOWED_TAGS. DXT bundle + Dockerfile + Render/Railway/Fly deploy configs.

v0.4.0 breaking change. Tools were renamed from n8n_* (snake_case) to dot-notation. Update any prompts, agent skills, or scripts that referenced the old names.

Runtime policy (v0.5+)

Constrain the server without forking. Set these env vars before launching:

Env varEffect
N8N_MCP_READ_ONLY=1Disables workflow_create, workflow_activate, node_scaffold.
N8N_MCP_DISABLED_TOOLS=workflow_create,workflow_activateSkip those tool registrations entirely.
N8N_MCP_ALLOWED_WORKFLOW_IDS=abc,defREST tools refuse to touch any workflow outside the list.
N8N_MCP_ALLOWED_TAGS=prod,stagingworkflow_list filters to workflows carrying at least one tag.

Useful when handing the MCP to a junior agent or wiring it behind a customer-facing assistant.

Deploy

  • Claude Desktop one-click: build the .dxt bundle from dxt/manifest.json (see dxt/README.md).
  • Docker: docker build -t n8n-mcp . && docker run --rm -i -e N8N_API_URL=... -e N8N_API_KEY=... n8n-mcp.
  • Render: drop in render.yaml and click "New from Blueprint".
  • Railway: railway.toml — railway up in the repo root.
  • Fly.io: fly.toml — fly launch --copy-config.

Install

Requires Node 20 or later.

As a CLI tool

bash
npm install -g @automatelab/n8n-mcp

As a GitHub Action

Use the n8n MCP GitHub Action to lint workflows, diagnose executions, and generate workflow JSON in your CI/CD pipeline:

yaml
- uses: ratamaha-git/n8n-mcp@v1  with:    command: 'lint'    workflow-json: ${{ env.WORKFLOW_JSON }}

See ACTION.md and GITHUB-ACTION-SETUP.md for examples and publication details.

Configure your MCP host

Cursor (~/.cursor/mcp.json) or Claude Desktop (claude_desktop_config.json):

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

The env block is optional - the 4 stateless tools work without it. Get an API key from n8n: Settings → API → Create API key.

Restart your MCP host. The 12 dot-notation tools (workflow.*, node.*, execution.*) appear in the MCP panel.

Tool examples

workflow_generate

Use workflow_generate to build: Stripe webhook → Slack message + new row in Google Sheets.

Returns workflow JSON ready for n8n's "Import from File" dialog.

execution_explain

Here's a failed execution from n8n. Why is the Slack node not firing? [paste JSON]

Returns:

WARNING [Filter] Returned 0 items. Downstream nodes will not execute.  hint: Common causes: (1) IF/Switch routed to the other branch — check `parameters.conditions`. (2) Filter/Set node dropped everything — inspect its output explicitly.
INFO [Last node executed was "Filter". If the workflow stopped here unexpectedly, check its output items below.]

workflow_lint

Lint this workflow JSON. [paste JSON]

Returns:

ERROR [AI Agent] AI Agent has no `ai_languageModel` sub-node connected. Attach a chat model (e.g. lmChatOpenAi).WARNING [Webhook] Webhook node has no `webhookId`. n8n auto-generates one on import, so the production URL will change.WARNING [LegacyFunction] Node type "n8n-nodes-base.function" is deprecated. Use "n8n-nodes-base.code".

Or no issues found.

Examples

The examples/ directory ships with two ready-to-import workflows:

  • workflow-stripe-to-slack.json - Stripe webhook fans out to Slack and Google Sheets.
  • workflow-rss-to-discord.json - RSS feed trigger posts new items to a Discord channel.

Import either via n8n's Import from File dialog.

Development

bash
git clone https://github.com/ratamaha-git/n8n-mcpcd n8n-mcpnpm installnpm run buildnpm run smoke

npm run smoke boots the server with a --smoke flag that lists registered tools and exits without binding stdio. Useful for CI or first-run sanity checks.

License

MIT. See LICENSE.


Developed by AutomateLab.

Maintenance and verification

See the maintenance guide for interpretation limits, current tool names where applicable, and reproducible verification.

來源:README.md,提交 28904f6

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分