Independent & unofficial. Not affiliated with Anthropic. Facts verified 21 August 2026. Always confirm pricing at claude.com/pricing.
Integration guide

Building Claude agents in n8n

Step-by-step setup for using Claude inside n8n — the Anthropic chat model node, MCP client and trigger nodes, and three production workflow patterns.

To build a Claude agent in n8n you need three things: an Anthropic credential holding an API key, the Anthropic Chat Model sub-node supplying the brain, and the AI Agent node running the loop. From there, n8n's first-party MCP Client Tool lets the agent call external MCP servers, and the MCP Server Trigger node does the reverse — exposing your n8n workflows to Claude as tools.

This walkthrough uses current model IDs only. Any n8n tutorial still pinned to claude-3-7-sonnet is broken: that model was retired on 19 February 2026 and the API now returns an error for it.

#What you need, August 2026

Credential
Anthropic API key from platform.claude.com
Model sub-node
Anthropic Chat Model (lmchatanthropic)
Orchestrator
AI Agent node
Calling MCP servers
MCP Client Tool sub-node
Exposing n8n to Claude
MCP Server Trigger node
Sensible default model
claude-sonnet-5 — $2 / $10 per MTok
Cheapest model
claude-haiku-4-5 — $1 / $5 per MTok

#Why use Claude inside n8n rather than calling the API directly?

Because most of an automation is not the model. It is the trigger, the credential store, the retry policy, the branching and the twenty connectors you did not want to write. n8n supplies that, and the Anthropic node supplies the judgement step. If you are already writing application code, the Claude API is more direct and gives you finer control over caching and batching; n8n wins when the workflow is mostly integration glue.

Worth knowing: n8n is itself an Anthropic customer. It built its AI Workflow Builder — which turns a conversation into a working n8n workflow — on Claude, using a tool-based architecture where the model adds nodes sequentially and configures them. In n8n's own reported figures, that removed roughly 80% of manual workflow-building effort. That is the vendor's number, published as a case study, not an independent measurement.

#Step 1: create the Anthropic credential

Generate an API key in the Anthropic Console at platform.claude.com/settings/keys. In n8n, open Credentials → New, search for Anthropic, and paste the key. n8n encrypts credentials at rest and references them by name, so the key never appears in a workflow's exported JSON.

An API key is billed per token and is entirely separate from a Pro or Max subscription: a chat subscription gives you no API credit, and an API key gives you no access to the apps. See the pricing page for how the two ledgers work. New organisations also start on the Evaluation rate-limit tier, so a workflow that fans out hundreds of parallel calls will hit 429s long before it hits your budget.

#Step 2: add the Anthropic Chat Model sub-node

The Anthropic Chat Model node (n8n-nodes-langchain.lmchatanthropic) is a sub-node, not a standalone step. You do not put it in the main flow — you attach it to the model port underneath an AI Agent, Basic LLM Chain, or similar cluster node. Because it is a sub-node, its expressions always resolve to the first input item rather than iterating, which is a common source of confusion when a workflow processes a batch.

Select the credential, then choose the model. Pick from the current lineup:

Model IDPrice in / out per MTokContextUse it in n8n for
claude-haiku-4-5$1 / $5200kClassification, routing, tagging, high-volume steps
claude-sonnet-5$2 / $101MThe default: extraction, drafting, most agent loops
claude-opus-5$5 / $251MComplex multi-tool agents, code-adjacent work
claude-fable-5$10 / $501MLong-horizon agents where a failure costs more than tokens

Full specifications for each are on the models page, and Sonnet 5 is the one to start with unless you have a reason not to.

Do not touch the sampling fields

The node exposes Sampling Temperature, Top K and Top P options. Leave them alone. On Claude Opus 4.7 and later, including Sonnet 5, Opus 5 and Fable 5, temperature, top_p and top_k are deprecated and passing a non-default value returns a 400 error. Anthropic's replacement for them is prompting — steer output style with instructions instead. See prompt engineering for Claude.

Set Maximum Tokens deliberately. Thinking tokens count toward it on current models, so a limit tuned for an older model will truncate. Also remember that models from Opus 4.7 onward use a tokenizer that emits roughly 30% more tokens for the same text — re-measure rather than reusing an old number.

#Step 3: wire up the AI Agent node

The AI Agent node is the orchestrator. It takes the model on one port and any number of tools on another, then runs the loop: read input, decide whether to call a tool, call it, read the result, repeat until it has an answer.

Three settings do most of the work. The system message is where you put the role, the constraints and the output format — treat it as the prompt that ships to production, not an afterthought. Max iterations is your loop guard; leave it low (5–10 for most workflows) and raise it only when you have watched a real trace. Memory attaches a conversation buffer, which you want for chat-style workflows and specifically do not want for stateless per-item processing, where it silently inflates every request.

Tools can be ordinary n8n nodes exposed to the agent — an HTTP Request tool, a Google Sheets tool, a Code tool — or an MCP server, which is where it gets interesting.

#Wiring MCP into n8n, in both directions

n8n is the rare automation platform with first-party Model Context Protocol nodes on both sides of the relationship: one that lets a Claude agent inside n8n call external MCP servers, and one that publishes an n8n workflow as an MCP server for Claude to call.

#Calling MCP servers: the MCP Client Tool node

n8n ships a first-party MCP Client Tool sub-node (n8n-nodes-langchain.toolmcp). It is an MCP client, so it lets your agent use the tools exposed by any external MCP server. Attach it to the AI Agent's tool port and configure three things: the SSE endpoint of the server, the authentication method (bearer token, a generic header, multiple headers, OAuth2, or none), and a tools-to-include selector.

Use that last selector. An MCP server can expose dozens of tools and can add more when its maintainer ships an update; naming the specific tools you approved is the only configuration that does not quietly expand its own permissions. Every tool definition also sits in the model's input context on every turn, so a trimmed list is cheaper as well as safer. The wider picture — what MCP is, who governs it now, and which servers Anthropic documents — is on MCP and Claude agents.

#Exposing workflows to Claude: the MCP Server Trigger node

The MCP Server Trigger node turns the relationship around. It makes an n8n workflow available as an MCP server, so Claude — in the desktop app, in Claude Code, or through the API's MCP connector — can call your workflow as a tool.

This is the most underrated node in the pairing. It means any integration n8n already has becomes a Claude tool without writing an MCP server yourself: a workflow that queries an internal database, files a ticket or posts to a channel is exposed with a name and a description, and Claude picks it up. Two cautions. The endpoint must be reachable from the client, and the API MCP connector specifically requires a publicly reachable HTTPS endpoint. And an exposed workflow is a live capability — anything with a write side should require authentication and, ideally, an approval step.

#Three workflow patterns worth building

PatternShapeModelWatch out for
Inbox triageGmail/webhook trigger → Anthropic Chat Model classifies and drafts → Switch node routes → Slack or ticketingclaude-haiku-4-5No agent loop needed; a plain LLM chain is cheaper and more predictable
Document extractionWatch a folder → extract text → model returns strict JSON → append to Sheets or Postgresclaude-sonnet-5Validate the JSON before writing; add an error branch for malformed output
Research agentForm or schedule trigger → AI Agent with MCP Client Tool + HTTP tools → formatted briefclaude-sonnet-5Cap max iterations; unbounded tool loops are the main cost risk

The first pattern is the one people over-engineer. If the task is “read this and pick a category”, you do not need an agent — you need one model call with a tight output contract. Reach for the AI Agent node only when the task genuinely requires the model to choose and sequence tools. More patterns, including batch and scheduled work, are on the automation page.

#Error handling and cost control in n8n

Four habits keep an n8n Claude workflow from becoming an expensive surprise.

  • Set retries on the model node, not the whole workflow. 429 rate-limit responses are transient and worth retrying with backoff; 400 errors from a bad parameter are not, and retrying them just burns your rate limit.
  • Add an error output branch. Route failures to a Slack alert or an error-log sheet rather than letting an execution die silently overnight.
  • Cap iterations and tokens. Max iterations on the agent, Maximum Tokens on the model. Both are cheap insurance.
  • Send the cheap steps to Haiku 4.5. At $1/$5 per million tokens it costs a fifth of Opus 5 for classification and routing, which is most of the volume in a typical workflow.

One structural limitation: n8n calls the Messages API one request at a time, so you do not get the Batch API's flat 50% discount from inside a workflow. For genuinely bulk work — thousands of documents, nobody waiting — assemble the batch and submit it from your own code instead. Prompt caching does still apply, and a long, stable system message is worth caching if the workflow runs frequently.

#What about Zapier and Make?

Zapier's official Anthropic (Claude) integration is narrower than most people expect: four actions — Send Message, Upload File, Download File, Delete File — and two searches — List Files, Get File Metadata. Critically, there are no triggers, so nothing in Claude can start a Zap. Claude can only ever be a step in the middle of a Zap that something else began. It also requires a paid Anthropic account with API access.

Make also lists an Anthropic Claude app. For agent work specifically, n8n remains the more capable choice, because it is the only one with first-party MCP nodes in both directions. If none of these fit, the fallback everywhere is a plain HTTP Request node against POST /v1/messages with the x-api-key and anthropic-version headers — see Claude for developers.

#Frequently asked questions

Which Claude model should I use in n8n?

Start with claude-sonnet-5 at $2 per million input tokens and $10 per million output. Drop to claude-haiku-4-5 for classification and routing steps, and move up to claude-opus-5 only for complex multi-tool agents. Do not use claude-3-7-sonnet — it was retired on 19 February 2026.

Why does the temperature setting break my n8n workflow?

Because temperature, top_p and top_k are deprecated on Claude Opus 4.7 and later, including Sonnet 5 and Opus 5. Passing a non-default value returns a 400 error. Leave the Sampling Temperature, Top K and Top P fields at their defaults and steer output through the system message instead.

Can n8n expose its workflows to Claude as tools?

Yes. The MCP Server Trigger node publishes an n8n workflow as a Model Context Protocol server, so Claude Desktop, Claude Code or the API's MCP connector can call it as a tool. The API connector requires a publicly reachable HTTPS endpoint, and any workflow with write access should be authenticated.

Do I need a Claude subscription to use n8n with Claude?

No. You need an Anthropic API key from platform.claude.com, billed per token. A Pro or Max subscription is separate and gives you no API credit; likewise an API key gives no access to the Claude apps. New organisations start on the Evaluation rate-limit tier.

Does Zapier support Claude as well as n8n does?

Not for agent work. The official Zapier integration offers four actions and two searches, and has no triggers at all, so Claude can only run as a step inside a Zap started by something else. n8n is the only one of the two with first-party MCP client and server nodes.

Can I get the 50% Batch API discount from n8n?

Not from a standard workflow — the Anthropic node calls the Messages API one request at a time. For bulk jobs where nobody is waiting, assemble the batch and submit it from your own code to get the flat 50% discount. Prompt caching does apply to n8n calls.

Verify it yourself

Node names and behaviour checked on 21 August 2026 against docs.n8n.io; model IDs, pricing and the deprecated sampling parameters against platform.claude.com/docs. n8n's reported 80% figure comes from its own Anthropic case study. n8n's UI changes frequently — re-check field names against the current release.