Automate n8n with Claude: Build Workflows Using AI
The Problem with Building n8n Workflows Manually
n8n is one of the most powerful automation platforms available. But anyone who has spent serious time in it knows the friction: you're dragging nodes, hunting for the right property, debugging expression syntax, and wiring together logic that should take minutes but somehow takes hours. The canvas is visual, but complex workflows are anything but simple to build.
That changes completely when you connect Claude to your n8n instance. Instead of building node by node, you describe what you want in plain English and Claude architects the entire workflow, configures the nodes, handles the logic, and deploys it directly to your instance via the n8n API. No JSON exports. No copy-pasting. No manual wiring.
This guide covers two distinct approaches: Claude Desktop with MCP for most users, and Claude Code on a VPS for power users who want full programmatic control. Both are production-ready. Pick the one that fits your setup.
Understanding the Architecture: How Claude Talks to n8n
The bridge between Claude and n8n is the Model Context Protocol (MCP), an open standard that lets AI assistants interact with external tools and services through a structured interface. When you configure n8n-MCP, Claude gains the ability to search your existing workflows, read node configurations, create new workflows, update existing ones, and trigger executions, all through natural conversation.
The key package that makes this work is n8n-mcp, an open-source MCP server purpose-built for n8n. It exposes your n8n instance as a set of tools that Claude can call, and it ships with deep knowledge of n8n's node library, validation logic, and workflow structure. It is not just a thin API wrapper; it understands n8n.
Claude Desktop + MCP
Best for most users. Install the n8n-mcp package, configure Claude Desktop with your API key, and start building workflows from the chat interface. Setup takes under 10 minutes.
Claude Code on VPS
Best for power users and teams. Claude Code runs directly on your server alongside n8n, giving you terminal-level control, SSH access, and the ability to trigger Claude from inside n8n workflows.
What You Need
- Claude Pro: MCP tools require a Claude Pro plan. The free tier does not support MCP connections.
- Claude Desktop: The desktop app (macOS or Windows) is required for MCP configuration. Download from claude.ai/download.
- Node.js: Required to run the n8n-mcp package. Version 18 or higher recommended.
- A running n8n instance: Cloud or self-hosted. If you haven't set one up yet, this setup guide covers Cloud, NPM, and Docker in one place.
- n8n API key: Generated from your n8n instance settings. We'll cover this in Step 1 below.
Approach 1: Claude Desktop + n8n-MCP (Recommended)
This is the fastest path to having Claude build n8n workflows for you. The entire setup is a config file edit and a restart.
Generate Your n8n API Key
In your n8n instance, click your user icon in the bottom-left corner. Go to Settings → API. Click Create API Key, give it a name (e.g., "Claude MCP"), and copy the key immediately. You will not be able to see it again after closing the dialog.
If you don't see an API section in your settings, your instance may need the API feature enabled. For self-hosted instances, add N8N_PUBLIC_API_DISABLED=false to your environment variables and restart.
Locate Your Claude Desktop Config File
Claude Desktop reads MCP server configurations from a JSON file on your machine. Find it at:
If the file doesn't exist yet, create it. You can also access it from inside Claude Desktop via Settings → Developer → Edit Config.
Add the n8n-MCP Configuration
Open the config file and add the following. Replace the placeholder values with your actual n8n instance URL and API key:
The npx n8n-mcp command will automatically download and run the latest version of the package. No separate install step is needed.
Restart Claude Desktop and Enable Tools
Completely quit Claude Desktop (do not just close the window; quit from the menu bar or system tray) and reopen it. Once loaded, you should see an n8n MCP icon in the bottom-right corner of the chat input area.
Click it and select Enable all tools. This grants Claude access to your n8n instance without asking for permission on every single action. You can always revoke this later from the same menu.
Verify the Connection
In a new Claude chat, type: "What n8n-mcp tools are available?" Claude should respond with a list of tools like n8n_create_workflow, n8n_list_workflows, search_nodes, and more. If you see that list, you're connected.
node --version in your terminal to check.
Using Claude with n8n Cloud
If you're on n8n Cloud rather than self-hosting, the setup is simpler. Your instance is already publicly accessible, so there is no server config to worry about. The MCP connection works identically; you just use your cloud instance URL instead of a localhost or VPS address.
To get your API key on n8n Cloud: log into your instance, click your user icon bottom-left, go to Settings → API, and create a key. Your instance URL is the one you use to access n8n in the browser, something like https://yourname.app.n8n.cloud.
Paste both into the Claude Desktop config exactly as shown in the steps above. n8n Cloud users skip all the server setup and go straight to building.
Setting Up a Claude Project for n8n (The Game-Changer)
The real power unlock is creating a dedicated Claude Project with custom instructions that turn Claude into a specialized n8n workflow engineer. Projects persist context across conversations, so Claude always knows your stack, your credentials, and your preferences.
In Claude, create a new Project and add the following to the Project Instructions. This is the system prompt that shapes how Claude approaches every workflow request:
With this in place, every conversation in the Project starts with Claude already knowing how to behave. You don't need to re-explain the rules each time.
Building Your First Workflow with Claude
Once connected, the workflow is simple: describe what you want, and Claude builds it. The quality of the output scales directly with the specificity of your prompt.
Here's the difference between a weak and a strong prompt:
Claude will then: scan your n8n instance for existing credentials, find the right nodes (Gmail Trigger, AI Text Classifier, Google Sheets, Slack), validate each configuration, build the complete workflow JSON, and deploy it directly to your instance. You get a link to open it immediately. If you've never built a workflow before and want to understand the fundamentals first, this guide walks through the basics.
Real-World Workflow Examples
Here are prompts you can use directly. Each one produces a complete, deployable workflow:
"When a Typeform submission comes in, enrich the lead with Clearbit, add to HubSpot CRM, and send a Slack notification to #sales with the lead score."
"Every time I publish a new blog post via RSS, generate a Twitter thread and a LinkedIn post using Claude, then schedule both for posting."
"Check my support inbox every 30 minutes. Classify each email as urgent/normal/spam using AI. Route urgent ones to Zendesk with high priority, auto-reply to spam."
"Every night at midnight, pull all new orders from Shopify, update inventory in Airtable, and send a daily summary report to my email."
Approach 2: Claude Code on a VPS (Power Users)
If you're self-hosting n8n on a VPS, there's a more powerful setup: install Claude Code directly on the same server. This eliminates network latency, gives Claude direct filesystem access, and enables a two-way relationship where n8n can also trigger Claude Code tasks via SSH. If you haven't set up a VPS yet, our VPS self-hosting guide covers the full deployment from scratch.
Once Claude Code is installed on your server, add the n8n-mcp server with a single command:
Claude Code will prompt you for your n8n instance URL and API key during the mcp add step. Once configured, it scans your existing n8n instance to understand your environment, credentials, and workflow patterns before building anything new.
Using the n8n API Directly (No JSON Files)
When working with Claude Code, always instruct it to use the n8n API rather than outputting JSON files. This is the key distinction that makes the workflow appear directly in your n8n canvas:
Claude Code will scan your instance, understand your existing credentials, build the workflow logic, and publish it automatically. Complex multi-step automations that would take hours to wire manually get built in minutes.
Using JSON Reference Files as Blueprints
For complex workflows, you can provide an existing n8n JSON export as a reference. Claude Code uses it as a structural blueprint to build new or modified versions, which is particularly useful for intricate AI pipelines where the node structure is non-trivial:
Running Claude Code from Inside n8n (Advanced)
The most powerful setup reverses the relationship entirely: n8n becomes the orchestrator that triggers Claude Code tasks. This is done via n8n's SSH node.
In your n8n workflow, add an SSH node configured with your VPS IP, root credentials, and port 22. The command field takes your prompt as input and passes it to the Claude Code CLI. The output is piped back into n8n and routed to whatever channel you want: Telegram, Slack, email, or a database.
The practical result: you send a Telegram message describing an automation you want built, and Claude Code builds and deploys it to your n8n instance automatically. No terminal access required.
The n8n-MCP Skills System
One of the most underrated features of the n8n-mcp package is its skills system, a set of specialized instruction sets that guide Claude on how to build production-ready workflows rather than generic snippets. Skills are installed via the /plugin command inside Claude Code.
Skills teach Claude things like how to correctly configure the Perplexity node for research tasks, how to structure Telegram bot workflows, how to handle pagination in HTTP Request nodes, and how to build resilient error-handling patterns. Without skills, Claude builds functional workflows. With skills, it builds workflows that are ready for production.
The n8n-mcp.com platform also offers a Chat Agent interface that has learned from over 100,000 workflow patterns. If you want to build workflows without any local setup at all, it is worth exploring. Describe your automation and it deploys directly to your connected n8n instance.
Prompting Best Practices
The quality of what Claude builds is directly proportional to how well you describe what you want. A few principles that consistently produce better results:
- Name your trigger explicitly. "When a webhook fires" is vague. "When a POST request hits /new-lead with fields name, email, and company" is precise.
- Specify your credentials. If you have multiple Google accounts connected to n8n, tell Claude which one to use. It can see your credential names.
- Describe the data shape. Tell Claude what the input data looks like and what the output should look like. This prevents mismatched field mappings.
- Ask for error handling. Add "include error handling that sends a Slack alert if any node fails" to any complex workflow request.
- Break complex workflows into phases. Build the trigger and first transformation first, verify it works, then ask Claude to extend it.
What Claude Can and Can't Do
Being clear about the boundaries saves frustration. Claude with n8n-mcp can:
- Create, update, activate, and delete workflows via the API
- Search and configure any of n8n's 400+ native nodes
- Validate workflow structure and expression syntax before deployment
- List and reference your existing credentials (it sees the names, not the secrets)
- Trigger webhook-based workflows for testing
- Monitor execution history and debug failures
What it can't do: it can't create new credentials for you (you still need to authenticate services manually in n8n), it can't access data inside your workflows at runtime, and it can't guarantee a workflow will work perfectly on the first try for highly complex integrations. Always test before going live.
Where to Go From Here
The combination of Claude and n8n is genuinely one of the most productive setups available right now for anyone building automations. The learning curve for n8n drops dramatically when you can describe what you want and have it built for you. And as you build more workflows, Claude gets better at understanding your specific stack and patterns.
Start with one workflow. Something you do manually every week. Describe it to Claude, let it build, test it, and watch it run. That first working automation is usually enough to change how you think about what's possible.