Claude × n8n Integration | API Setup, AI Agent & MCP Usage Guide

Article Summary by AI Chatpowered by Claude

n8n is an open-source automation platform that lets you build business workflows without writing code. By integrating Claude, you can run processes like "summarize emails and send them to Slack" or "classify inquiries and route them to the appropriate department" — all without any code. Furthermore, with the MCP (Model Context Protocol) integration established from 2025 onward, you can now design and run n8n workflows using natural language from Claude Desktop or Claude Code. This article walks through both directions — "calling Claude from n8n" and "controlling n8n from Claude" — covering everything from obtaining an API key and connecting nodes to setting up MCP and common workflow examples.

結論powered by Claude

n8n is an open-source automation platform that lets you build business workflows without writing code, and by integrating Claude into it, you can run processes like "summarize emails and send them to Slack" or "classify inquiries and route them to the appropriate department" — all without a single line of code.

There are two directions to this integration: n8n → Claude calls the API via the Anthropic Chat Model or AI Agent node, while Claude → n8n uses MCP integration to let you design and run workflows using natural language from Claude Desktop or Claude Code.

For either use case, it's safest to build with the assumption that a human performs a final review — rather than sending Claude's output directly to a public-facing channel, routing it through a Slack draft channel or a Notion draft database lets you balance automation speed with operational reliability.

目次 (15)

What You Can Do by Integrating Claude with n8n

The combination of n8n and Claude is well-suited for embedding AI into multi-step business workflows, rather than one-off chat responses. The four most representative use cases are:

  • Automatically summarizing and classifying emails and inquiries, then routing them to the responsible team
  • Running periodic SEO research, competitive analysis, and sales prospect listing
  • Building the foundation for a RAG chatbot that references internal documents
  • A content generation pipeline that ingests internal data and drafts articles and reports

There are two main directions for integration. The first is the "n8n → Claude" direction, where you call the Anthropic API from within an n8n flow using the Anthropic Chat Model node or AI Agent node. The second is the "Claude → n8n" direction, where you operate n8n workflows from Claude Desktop or Claude Code via the n8n MCP server, enabling you to build and run them using natural language. Mastering both means you can cover scheduled execution and conversational workflow building on the same platform.

Prerequisites: Anthropic API Key and n8n Instance

Before starting the integration, make sure you have the following in place.

  1. Log in to the Anthropic Console (console.anthropic.com) and issue an API key. Flat-rate plans like Claude Max are exclusive to the Web/Desktop app, so a separate pay-as-you-go API key is required for API calls from n8n.
  2. Set up n8n in either the Cloud version or a self-hosted version. If you're handling internal data, self-host with Docker and configure N8N_HOST and WEBHOOK_URL to match your internal DNS.
  3. Also issue an API key for n8n. You can generate one from Settings → n8n API; it will be required for the MCP integration described later.
  4. Install Claude Desktop or Claude Code locally (required if you want to control n8n via MCP).

Since handling API keys in plain text is an accident waiting to happen, manage them through n8n's Credentials feature and in the Claude Desktop configuration file respectively — and never include them in a Git commit.

How to Call Claude from n8n

Below is a step-by-step guide to integrating Claude into an n8n flow, using the minimal configuration.

Step 1: Register Your Anthropic API Key in Credentials

Open Credentials from n8n's left sidebar menu, click New, and search for "Anthropic API". Paste in your API key and save it with a name of your choice (e.g., Anthropic Production). If you use multiple API keys, keeping separate Credentials for each purpose will help prevent misfires later.

Step 2: Place the Anthropic Chat Model Node

In a new workflow, add a Manual Trigger, then add the Anthropic Chat Model node. Select the Credentials you just registered, and specify a recent model such as claude-sonnet-4-6 in the Model field. Start Max Tokens at around 1024 and expand as needed. For Temperature, a value around 0.2 is manageable for summarization and classification, while 0.6 or so works better for text generation.

Step 3: Combine with the AI Agent Node

The Anthropic Chat Model works on its own, but if you need to handle tool calls or conversation history, add an AI Agent node. Connect the Anthropic Chat Model to the Chat Model input of the AI Agent, then connect Window Buffer Memory to Memory and tools like HTTP Request or Google Sheets to Tools. This gives you a configuration where Claude selects and uses tools as needed. In the System Prompt, clearly state constraints such as "respond in English" or "return in JSON format".

Step 4: Execution and Error Handling

After verifying operation with Execute Workflow, set up an Error Trigger node for failure notifications (Slack or ChatWork) when you move to production. Since the Anthropic API can return 429 (rate limit) or 529 (overload) errors, a stable configuration includes enabling Retry On Fail and adding a Wait node for backoff.

Controlling n8n from Claude Desktop / Claude Code (n8n MCP)

With n8n MCP, you can build workflows from Claude Desktop or Claude Code using natural language — for example, "Create a flow that writes 20 sales prospects to a spreadsheet."

Step 1: Register the n8n MCP Server in Your Configuration File

For Claude Desktop, add the following to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "npx",
      "args": ["n8n-mcp"],
      "env": {
        "MCP_MODE": "stdio",
        "LOG_LEVEL": "error",
        "N8N_API_URL": "https://your-n8n.example.com",
        "N8N_API_KEY": "<API key issued by n8n>"
      }
    }
  }
}

For Claude Code, you can also register it with the command claude mcp add n8n-mcp -- npx n8n-mcp. After registering and restarting Claude Desktop, a suite of n8n tools will appear in the menu (search_nodes, get_node_documentation, validate_workflow, etc.).

Step 2: Build Workflows Conversationally

Ask Claude something like "Create a flow that summarizes new inquiries received via Gmail and sends a notification to the #sales Slack channel." Claude will internally call the tools in sequence — search_nodesget_node_documentationvalidate_node_operationn8n_create_workflow — generating a validated workflow JSON and registering it in n8n. After it's generated, review the node layout and credentials in the n8n UI, then turn on the Active toggle to go live.

Step 3: Improve with Partial Updates

When modifying a workflow later, having Claude use n8n_update_partial_workflow instead of rebuilding from scratch keeps token consumption down. A natural language modification request like "Add emoji to the Slack notification message" will rewrite only the necessary nodes.

Practical Workflow Examples

Once the integration is up and running, the following small workflows tend to deliver value quickly.

  1. Automatic Inquiry Classification: Gmail Trigger → Anthropic Chat Model (category classification) → Switch node → Route to each department's Slack channel. You can reduce costs by having it return the category in a single token.
  2. Article Summaries & Morning Email: Cron Trigger → RSS Read → AI Agent (3-line summary per article) → Merge → Gmail send. Can be operated as an internal morning briefing.
  3. Semi-automated SEO Research: Manual Trigger → HTTP Request (search API) → AI Agent (extract common themes and generate differentiation ideas) → Append to Notion. Journalists and marketing staff only need to review the first draft.
  4. Meeting Minutes Draft Generation: Webhook (receive recording file) → Transcribe node → Anthropic Chat Model (summarize + extract action items) → Feed into Notion template.

Building all of these with the assumption that "a human performs a final review" reduces incidents. It's safer to route Claude's output through a Slack draft channel or a Notion draft database rather than sending it directly to a public-facing location.

Pricing and How to Choose a Model

API calls from n8n incur pay-as-you-go charges from Anthropic, billed per input and output token. As of June 2026, the three main models worth considering are:

  • claude-opus-4-8: The highest-performing option, suited for complex business logic, legal work, and analysis. Higher cost.
  • claude-sonnet-4-6: A balanced model, ideal for everyday business automation. The primary choice for summarization, classification, and content generation.
  • claude-haiku-4-5: Fast and low-cost. Suited for high-volume email processing and real-time classification.

The safest approach is to start with Sonnet, then upgrade only the nodes where output quality is insufficient to Opus. By comparing the Anthropic Console's Usage screen with n8n's workflow execution logs weekly and swapping nodes with higher-than-expected token consumption to Haiku, you can stabilize costs. Note that flat-rate plans like Claude Max do not apply to n8n usage via the API (reference: tent space Blog).

Common Pitfalls and Troubleshooting

Here are the most frequently encountered issues in production use, listed in order of how often they occur, along with how to address them.

  1. Credentials not recognized: The cause is often leading or trailing whitespace when copying the API key. Delete the Credentials entry and paste it in again.
  2. AI Agent node not calling tools: Adding an explicit instruction in the System Prompt like "Use the following tools as needed" and keeping the function names passed to Tools concise tends to help.
  3. Flows created via MCP result in errors: Claude's inferred node settings may not match what the actual instance expects. The standard approach is to run validate_workflow before registering, or to test with a minimal configuration (2 nodes) first (reference: Zenn / tacoms).
  4. Costs are higher than expected: This is most often because large PDFs or transcripts are being passed to Claude in their entirety. Use n8n's Code node to extract only the body text beforehand, stripping unnecessary headers and footers before passing to Claude.
  5. Something broke in production: Exporting n8n workflows as JSON and managing them in Git allows you to roll back. As automated edits via MCP increase, it's reassuring to set up periodic backups in a separate workflow.

Summary: Toward "Conversational Business Automation" with Bidirectional Integration

The value of combining n8n with Claude lies not merely in "generating text with AI," but in making Claude a permanent resident of your company's business flows — enabling it to run on both a scheduled and conversational basis. The first step is to get a small classification task running with Anthropic Chat Model + AI Agent. As you get comfortable, enabling MCP integration and moving toward having Claude Desktop or Claude Code design your workflows will grow a "natural language-driven business automation platform" within your organization.

参考になったら ♡
Clauder Navi 編集部
@clauder_navi

Anthropic の Claude / Claude Code を中心に、日本のエンジニア向けに最新動向と実務 を毎日発信。 運営方針 は メディアについて をご覧ください。