DEV Community

Cover image for How to Connect Claude to n8n and Let an AI Agent Run Your Automations (2026 Guide)
Shaam
Shaam

Posted on Originally published at aitecharchive.com

How to Connect Claude to n8n and Let an AI Agent Run Your Automations (2026 Guide)

Verdict: If your n8n workflows keep growing into sprawling twenty-node monsters that you are afraid to touch, stop editing them by hand. n8n ships an official MCP (Model Context Protocol) integration, and Claude connects to MCP servers natively. Wire the two together once, and you can tell an AI agent, in plain language, to build, simplify, test, and fix your workflows for you. The setup takes about 30 minutes, works with a free self-hosted n8n instance, and is the single biggest quality-of-life upgrade available to an n8n user in 2026.

TL;DR - Last verified: 2026-08-23

  • n8n has an official MCP Server Trigger node that exposes your workflows as tools any MCP client, including Claude, can call (n8n docs).
  • n8n also ships an official MCP connector setup plus ready-made agent skills for Claude Code and Codex (docs.n8n.io).
  • Claude connects to remote MCP servers through its Connectors feature and the MCP connector API (claude.com docs).
  • Result: you describe the automation; the agent builds the workflow, runs a test, and reports back. You review before anything goes live.
  • Cost: self-hosted n8n is free (fair-code license); n8n Cloud starts at roughly $20/month. Pricing changes often - last checked 2026-08-23 on n8n.io/pricing.

Why does hand-building workflows stop scaling?

Hand-built workflows collapse under their own weight because every new business rule adds nodes, branches, and expressions that only the original builder understands. Three months later, nobody remembers why the HTTP Request node has a 500ms retry loop, and changing anything feels like surgery on a running patient.

The fix is not a better node library. It is a different division of labor: you own the intent, an AI agent owns the wiring. That is exactly the split MCP makes possible, and it is the same pattern behind the self-hosted agent stacks we have covered before, like the sovereign agent OS on a VPS.

What exactly is MCP, in one paragraph?

MCP, the Model Context Protocol, is an open standard that lets AI agents call outside software as if it were built-in. A piece of software becomes an "MCP server" and exposes tools; the agent (the "MCP client") discovers those tools and calls them. The protocol is maintained openly at modelcontextprotocol.io. We covered its shift to a fully stateless spec in our MCP migration guide, and nothing in this article requires deeper protocol knowledge than that one sentence.

How do the three pieces fit together?

Three verified, documented pieces make the connection work. They can be combined in two directions.

Piece 1: n8n's MCP Server Trigger (n8n as the server). The MCP Server Trigger node exposes a URL that MCP clients call, and you attach "Custom n8n Workflow Tool" nodes to it, so each of your workflows becomes a named, callable tool for the agent. (n8n docs: MCP Server Trigger)

Piece 2: Claude as the MCP client. Claude supports remote MCP servers directly. In the Claude apps you add a custom connector with the server's URL (with OAuth or a request-header token), and the Claude API has a dedicated MCP connector so developer agents can do the same thing programmatically. (Claude docs: third-party connectors · Claude platform docs: MCP connector)

Piece 3: n8n's official agent skills and connector docs. n8n maintains a connect to n8n MCP server guide plus an official skills repository for coding agents like Claude Code and Codex, so the agent learns n8n's conventions, valid node names, and expression syntax instead of guessing. (docs.n8n.io: Connect to n8n MCP server)

Which direction should you wire it - agent calls n8n, or n8n calls the agent?

Both directions are real, and they solve different problems. Most people reading this want the first.

Direction What it does Best for Source
Claude as client, n8n as server (MCP Server Trigger) You chat with the agent; it triggers and calls your workflows as tools "Run my lead-capture workflow", "give me the numbers from the nightly sync" n8n MCP Server Trigger docs
Agent edits n8n itself (connector + official skills) Claude builds, simplifies, tests, and fixes workflows inside your instance Taming monster workflows, generating new automations from a prompt n8n connector + skills docs

The rest of this guide sets up both, because the second is where the "automate anything" promise actually comes from.

A quick reality check before you start

If you are on n8n Cloud, the platform already has a built-in AI Assistant (currently in Preview) that can plan, build, test, and debug workflows from chat, with one important safety property: your credential secrets are never sent to the model. It is the fastest path if you are not self-hosting. (n8n docs: Use AI Assistant) The MCP route below is for self-hosters and for anyone who wants their own agent, their own model, and their own rules.

How do you connect Claude to n8n, step by step?

The full setup has four stages and takes about 30 minutes on a fresh self-hosted instance.

  1. Expose a workflow as a tool. In n8n, create a workflow starting with an MCP Server Trigger node. Give it a path (it becomes your MCP endpoint URL) and set a bearer token. Attach the workflows you want to expose via Custom n8n Workflow Tool nodes. (n8n docs)
  2. Connect Claude as the client. In the Claude app: Customize > Connectors > Add custom connector, paste the MCP endpoint URL, and provide the bearer token. In Claude Desktop, the official docs show a small mcp-remote gateway config that proxies the connection. (claude.com docs · n8n docs)
  3. Test the loop in one sentence. Ask Claude: "List the tools you have from my n8n server, then run the smallest one with test data." If the agent lists your workflow tool and returns its output, the client direction works.
  4. Add the build-and-fix direction. Follow n8n's official Connect to n8n MCP server guide and install the official skills from the n8n-io/skills repository into your coding agent (Claude Code and Codex are the documented targets). This is what lets the agent create real, valid workflows instead of plausible-looking JSON.

After step 4, the sentence "Simplify my invoicing workflow, keep the same behavior, and test it" does exactly what it says: the agent reads the workflow via the n8n API, refactors it, and runs a test execution, all within your instance's permissions.

What can you actually ask the agent to do?

The five highest-value requests, all things the built-in tooling and MCP path support:

  1. Simplify an overloaded workflow. Point it at the thirty-node monster; ask for the same behavior with fewer nodes and named, documented steps.
  2. Build a new automation from a sentence. "Every morning, scan this inbox for invoices, save the PDFs to Drive, and log a row to a table. Show me the plan before you build."
  3. Debug the last failed run. "Look at the most recent failed execution, tell me what failed, suggest a fix, and don't change anything until I approve." (n8n's AI Assistant docs use this exact debugging pattern.)
  4. Add error handling everywhere. Add failure branches, retries, and a notification path to every workflow that currently fails silently.
  5. Examine credentials safely. Ask which nodes reference missing or expired credentials. Secrets stay in the credential store; the agent sees names and types, not values.

The discipline that makes this safe: plan first, confirm, then apply. Both sides support this. Claude asks for approval before tools fire, and n8n's AI tooling is designed to ask before high-impact actions like publishing.

What about security?

Connecting an agent to your automation platform is powerful, so treat it like giving a new hire production access.

  • Use bearer tokens or OAuth, never chat-pasted keys. Both Claude's connector config and n8n's credential screens are built for this. (claude.com docs)
  • Keep the "human approves high-impact actions" step. Publishing, deleting, and credential changes should always pause for you.
  • Notes for scaled setups: if you run n8n in queue mode with multiple webhook replicas, route all /mcp* traffic to a single dedicated replica or SSE connections will break - a documented gotcha, not a rumor. (n8n docs: MCP Server Trigger limitations)
  • Audit what the agent did. n8n keeps execution history; review the first week of agent-made changes before relaxing approvals.

If this kind of agent-driven operations interests you beyond n8n, our Hermes agent setup guide walks the same "agent as an employee" idea for a general-purpose stack.

What does it cost?

Self-hosted n8n is free under a fair-code license, with unlimited workflows and executions; you pay only for the server (a basic VPS is typically $5-10/month). n8n Cloud starts around $20/month (Starter tier, execution-capped) if you want managed hosting instead. Your AI usage is separate and depends on your Claude plan. Pricing and execution caps change often, so confirm current figures on the official n8n pricing page before budgeting (checked 2026-08-23).

What this means for you

If you run a small business or a one-person operation, the bottleneck in automation was never the tools - it was the hours of drag-and-drop wiring between them. The Claude-plus-n8n MCP connection moves that work to an agent that already knows the node library, and it gets dramatically better the moment you stop writing prompts from zero and start pointing it at your existing workflows. Pick your most annoying, most overgrown workflow this week, give the agent the "simplify and test" instruction, and judge the result against your own execution history. If you have not picked your automation platform yet, our Zapier vs Make vs n8n comparison covers the tradeoffs.

FAQ

Q: Can Claude really connect directly to n8n?
A: Yes, through the Model Context Protocol. You enable n8n's MCP Server Trigger node, then add that endpoint as a custom connector in Claude. Both pieces are officially documented - by Anthropic (claude.com docs) and by n8n (MCP Server Trigger docs).

Q: Does Claude need to write code to automate n8n?
A: No. The agent works through n8n's API and MCP tools using n8n's official docs and skills repository, producing normal, inspectable workflows you can open and edit in the visual editor.

Q: Is self-hosted n8n actually free?
A: Yes - the community edition is free under a fair-code license with unlimited workflows and executions; you pay for the server. n8n Cloud (managed hosting) is paid, starting around $20/month on the Starter tier. Verify current pricing at n8n.io/pricing before budgeting.

Q: Is the n8n AI Assistant the same thing?
A: No, but it overlaps. The AI Assistant is n8n Cloud's built-in chat agent (currently in Preview) for building and debugging workflows inside the n8n editor. The MCP route connects your own external agent, like Claude, which means you choose the model, the skills, and the rules. Verified in the n8n AI Assistant docs.

Q: Can the agent see my API keys and credentials?
A: No. Secrets stay in n8n's credential store. The agent and assistant can reference credentials by name and type, but values are never sent to the model. This is stated explicitly in the n8n docs.

Q: What breaks at scale with MCP on n8n?
A: The one documented scaling trap is queue mode with multiple webhook replicas: SSE-based MCP connections need to be routed to a single dedicated replica, or events drop. This is covered in the MCP Server Trigger limitations section of the n8n docs.

Sources

Updates & Corrections

  • 2026-08-23 - Article published; all facts verified against the primary sources above on this date. Pricing is volatile and re-checked monthly.

Researched and drafted with AI agents; reviewed and fact-checked under human editorial oversight. How we work.

Top comments (0)