How to Set Up an MCP Server for n8n Workflow Automation
The Model Context Protocol turns n8n into an AI-accessible automation platform. This guide walks through setting up n8n as an MCP server so AI agents can create and trigger workflows through natural language, then covers the reverse: configuring n8n to consume external MCP servers as tools within its own automation flows.
What the n8n MCP Server Actually Does
n8n's MCP server exposes your automation instance as a set of tools that any MCP-compatible AI client can discover and call. Since April 2026, the server goes beyond just triggering existing workflows. It generates new workflows from natural language descriptions, validates them before execution, runs test passes with sample data, and self-corrects errors it finds along the way.
The n8n MCP server lets AI agents create, modify, and trigger n8n workflows through natural language, while n8n can also consume external MCP servers as tools within its automation flows.
The server operates in two complementary modes. As an MCP provider, n8n exposes its workflows as callable tools. External AI agents like Claude, GPT-4, Cursor, and Windsurf connect to the server, browse available operations, and execute them with structured inputs. As an MCP consumer, n8n's AI Agent node uses MCP Client Tool sub-nodes to call external MCP servers during workflow execution. This means n8n can both serve tools to AI agents and use tools from other MCP servers within the same instance.
The practical difference from a standard API integration: MCP clients discover available tools at runtime. You don't hardcode endpoints or write API wrappers. When you add a new workflow to n8n and enable it for MCP access, every connected AI client can immediately find and use it.
Three main paths exist for MCP access to n8n:
- n8n's built-in MCP server ships with n8n 2.18.4 and later. It handles workflow creation, execution, and management directly from the instance settings.
- The community n8n-mcp package (by czlonkowski on GitHub) gives AI assistants documentation for over 1,650 n8n nodes, 2,352 workflow templates, and 20 MCP management tools.
- Custom MCP Server Trigger workflows let you build your own MCP-accessible tool sets using n8n's visual workflow editor, optionally backed by Redis for workflow registry management.
Each approach serves a different need. The built-in server is the fast to enable. The community package adds deep node knowledge that helps AI assistants build better workflows. Custom triggers give you full control over what gets exposed and how.
Prerequisites and Initial Setup
Before connecting any AI client, you need a running n8n instance with MCP enabled.
n8n instance requirements:
- n8n version 2.18.4 or higher (workflow generation requires this version)
- Instance owner or admin permissions (MCP is an instance-level setting)
- An n8n API key for full workflow management access
For self-hosted n8n, update your instance to the latest version:
docker pull n8nio/n8n:latest
docker compose up -d
Or if you installed via npm:
npm update -g n8n
For n8n Cloud, the MCP server is available in your instance settings without manual updates.
Enable MCP at the instance level:
- Open your n8n instance and navigate to Settings > MCP
- Toggle the MCP server on
- Copy the server URL (you'll need this for client configuration)
- Enable individual workflows for MCP access as needed
The MCP server is currently in public preview. It's available across all n8n editions: Cloud, Enterprise, and the free self-hosted Community edition.
Generate an API key:
- Go to Settings > API in your n8n instance
- Create a new API key
- Store the key somewhere safe (it won't be shown again)
Without an API key, connected clients can still access documentation and validation tools through the community package. With the key, you get full workflow creation, modification, and execution capabilities through both the built-in server and the community package's management tools.
How to Connect Claude Desktop and Claude Code to n8n
The community n8n-mcp package offers the fast path to connecting Claude to your n8n instance. It runs via npx, so there's no permanent installation.
For Claude Code, add the server with one command:
claude mcp add n8n-mcp \
-e N8N_API_URL=https://your-n8n-instance.com \
-e N8N_API_KEY=your-api-key \
-- npx n8n-mcp
This saves the configuration to your local user settings by default. For team-wide access, add --scope project to write it to .mcp.json in the project directory instead.
For Claude Desktop, edit the configuration file directly. On macOS, it lives at ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"n8n-mcp": {
"command": "npx",
"args": ["n8n-mcp"],
"env": {
"N8N_API_URL": "https://your-n8n-instance.com",
"N8N_API_KEY": "your-api-key"
}
}
}
}
Restart Claude Desktop after saving. You should see n8n MCP tools appear in the tools panel.
Connecting n8n's built-in MCP server works differently. Instead of running an npx process, you point your client at n8n's own MCP endpoint:
- Copy the MCP server URL from Settings > MCP in your n8n instance
- Add it as a remote MCP server in your client using SSE or Streamable HTTP transport
- Authorize the connection when prompted
Verifying the connection:
Ask Claude to search for available n8n nodes or list your workflows. If the connection is working, you'll get results from your instance. Authentication errors usually mean the API key was entered incorrectly or lacks the right permissions.
You can run both the community package and the built-in server at the same time. The community package provides node documentation and template search, while the built-in server handles direct workflow execution on your instance.
Give your n8n workflows a persistent workspace
Fastio's Business Trial includes 50 GB of storage, included credits, and an MCP server your n8n workflows can read and write. No credit card required.
How to Build n8n Workflows from Natural Language Prompts
With the MCP connection established, you can describe a workflow in plain language and have Claude build it for you. The n8n MCP server generates workflows as TypeScript representations that get validated and compiled before they touch your instance.
Example: Creating a daily notification workflow
Ask Claude something like: "Create an n8n workflow that checks a Google Sheet every morning at 9 AM, filters for rows where the status column says 'overdue', and sends a Slack message listing the overdue items."
The MCP server will:
- Search available n8n nodes for Google Sheets, Schedule Trigger, IF, and Slack integrations
- Generate the workflow structure in TypeScript
- Validate the node configurations and connections
- Deploy the workflow to your instance in a deactivated state
You can then review the workflow in n8n's visual editor, adjust any settings, and activate it when you're satisfied.
Iterating on workflows:
The real value shows up in conversation. After the initial build, you can say "Add error handling that sends me an email if the Google Sheets connection fails" or "Change the schedule to every weekday at 8:30 AM." The MCP server updates the existing workflow rather than creating a new one each time.
Testing before deployment:
The server includes test execution tools. Ask Claude to run a test pass with sample data. It generates appropriate test inputs, executes the workflow in manual mode, and reports back on any errors. If something breaks, the server can identify the failing node and attempt a fix automatically.
A few practical notes to keep in mind. Most MCP tools operate on unpublished workflow versions. The exception is execute_workflow, which defaults to production mode and runs the published version. You can override this by specifying manual execution mode. Complex workflows with extensive branching sometimes need manual refinement in n8n's editor after the initial AI-generated draft. The AI tends to over-engineer on first attempts, so start with simple descriptions and add complexity through iteration.
Using n8n as an MCP Consumer
The other direction is equally practical: n8n's AI Agent node can consume external MCP servers as tools during workflow execution. This turns n8n into an orchestration layer that reasons across multiple systems.
The MCP Client Tool node connects to any MCP server via SSE or Streamable HTTP. You configure it as a sub-node within an AI Agent workflow:
- Create a new workflow with an AI Agent node
- Add an MCP Client Tool sub-node to the agent
- Enter the external MCP server's endpoint URL
- Configure authentication (Bearer token, custom headers, or OAuth2)
- Choose which tools to expose: all available tools, only specific ones, or everything except certain tools
The agent discovers available tools from the connected MCP server at runtime and can invoke them as part of its reasoning process. No hardcoded API calls required.
Example: Connecting Fastio's MCP server to n8n
If your workflows need to read, write, or organize files in a shared workspace, you can connect Fastio's MCP server as a tool source for your n8n agents. Fastio exposes 19 consolidated MCP tools for workspace management, file operations, AI-powered search, and sharing via Streamable HTTP at /mcp and legacy SSE at /sse. The free tier includes 50 GB of storage and included credits with no credit card required.
Configure the MCP Client Tool with Fastio's endpoint. Your n8n agent can then search workspace contents using Intelligence Mode, upload generated files, create branded shares, and query documents with citations, all as steps in an automated workflow.
Other MCP servers work the same way. Connect a database MCP server for structured queries, a monitoring server for system health checks, or any other tool source your workflows need. Each MCP Client Tool node adds one server, and you can attach multiple tool nodes to a single agent.
Tool curation matters. An agent with access to fifty tools spends more tokens figuring out which one to use. Limit each MCP Client Tool connection to a focused set of capabilities. If you need broad access across many systems, split the tools across multiple specialized agent workflows rather than loading everything into one.
Combining Both Directions in Practice
The real power of n8n's MCP support emerges when you use it as both provider and consumer in the same architecture. Your n8n instance consumes MCP servers internally, builds complex reasoning chains, and then exposes the result as a single tool for external agents.
Pattern: Multi-system agent with a clean external interface
Build an internal n8n agent workflow that connects to three MCP servers: a CRM system, a ticketing platform, and a file workspace like Fastio. This agent can look up customer context, check open tickets, and retrieve relevant documents. Then expose this entire workflow as one MCP tool called "resolve customer inquiry" using n8n's MCP Server Trigger node. External agents see one tool instead of three separate systems, and n8n handles all the orchestration logic.
Pattern: File processing pipeline
An external AI agent triggers an n8n workflow via MCP to process uploaded documents. Inside n8n, the workflow uses MCP Client Tools to read files from a workspace, extract key information, run validation checks, and write structured results back. The external agent gets a clean response without knowing the internal pipeline details.
Keeping files accessible to both agents and humans
The output of automated workflows often needs human review. Local file storage on the n8n server works for temporary processing, but it's invisible to anyone not logged into that machine. Cloud storage options like S3 or Google Drive make outputs accessible through a browser. Fastio adds another dimension: its workspace model supports granular permissions, audit trails, and ownership transfer. An agent can build a workspace, populate it with workflow outputs, and then transfer ownership to a human reviewer. The human sees the files in a web UI without needing access to n8n or any technical setup.
Latency and observability tips:
Each MCP tool call adds a network round trip. Design your MCP servers for fast responses and batch operations where possible. Log every tool invocation with inputs, outputs, and timing so you can debug failures and spot bottlenecks. n8n's built-in execution logs help with this, but consider adding explicit logging nodes for MCP-specific operations.
Starting small:
If this bidirectional architecture sounds like a lot, start with one direction. Expose a single existing n8n workflow as an MCP tool and connect it to Claude. See if the interaction model works for your team. Then add the consumer side by connecting one external MCP server to an n8n agent workflow. Scale from there based on what actually helps, not on architectural ambition.
Frequently Asked Questions
Can Claude build n8n workflows?
With n8n's MCP server enabled (version 2.18.4 or higher), Claude can create, modify, and test n8n workflows through natural language. The server generates TypeScript workflow representations, validates them, and deploys to your instance. You can iterate on the workflow through conversation, and Claude will update the existing workflow rather than building from scratch each time.
How do I connect n8n to Claude via MCP?
The fast method is the community n8n-mcp package. Run `claude mcp add n8n-mcp -e N8N_API_URL=https://your-instance.com -e N8N_API_KEY=your-key -- npx n8n-mcp` in Claude Code, or add the equivalent JSON configuration to Claude Desktop's config file. You can also connect n8n's built-in MCP server by adding its endpoint URL as a remote MCP server in your client settings.
Can n8n act as an MCP server?
Yes. n8n 2.18.4 and later includes a built-in MCP server that you enable in Settings > MCP. Each workflow you expose becomes a discoverable tool that MCP clients can call. You can also build custom MCP endpoints using n8n's MCP Server Trigger node, which gives you full control over the tool name, description, and input schema.
What is the n8n MCP server used for?
The n8n MCP server lets AI agents interact with your automation platform programmatically. Common uses include building new workflows from natural language descriptions, triggering existing workflows on demand, querying workflow execution history, and managing workflow state. It replaces manual workflow building with conversational automation, especially for teams that already use AI coding assistants.
Does n8n's MCP server work with the free Community edition?
Yes. The MCP server is available in all n8n editions: Cloud, Enterprise, and the free self-hosted Community edition. The community n8n-mcp package also works with any n8n instance that has API access enabled, regardless of the edition.
Can n8n consume external MCP servers as tools?
n8n's MCP Client Tool node connects to any external MCP server via SSE or Streamable HTTP. You add it as a sub-node within an AI Agent workflow, configure the endpoint and authentication, and the agent can discover and call tools from that server during execution. This lets n8n pull in capabilities from file storage services, databases, monitoring tools, or any other system that exposes an MCP interface.
Related Resources
Give your n8n workflows a persistent workspace
Fastio's Business Trial includes 50 GB of storage, included credits, and an MCP server your n8n workflows can read and write. No credit card required.