n8n-mcp
Provides integration with an n8n instance via its REST API v1, enabling AI agents to manage workflows, nodes, executions, templates, credentials, snapshots, validation, diagnostics, and self-healing operations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@n8n-mcppatch the HTTP Request node in workflow 12 to use POST and save a snapshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
n8n MCP Server (n8n-mcp)
A production-grade, standalone Model Context Protocol (MCP) Server for n8n workflow automation. Built with clean architecture, strict Pydantic v2 domain schemas, Windows Proactor compatibility, and anti-hallucination engines for Claude Desktop, Cursor, Antigravity, and autonomous agent swarms.
๐ Looking for Prompting & Operational Recipes?
Check out the comprehensive PROMPTING_GUIDE.md (Bangla & English user manual) and PLAYBOOK.md for 10+ copy-paste prompts and self-healing recipes!
โก Why n8n MCP Server?
LLMs interacting with the raw n8n REST API struggle with several major bottlenecks:
Massive Token Bloat: Sending full 50-node workflow JSONs on every modification consumes 15,000โ30,000+ tokens per turn.
HTTP 400 Bad Request on Updates: n8n rejects PUT requests containing read-only fields (
id,versionId,createdAt,updatedAt,triggerCount,tags).Hallucinated Node Parameters: AI models regularly hallucinate non-existent properties, invalid credentials, or outdated enum values.
Fragile LangChain / AI Agent Sub-graphs: Missing required
ai_languageModelor tool connections crashes AI nodes at runtime.No Built-in Safety Net: Modifying live workflows without automated snapshotting and 1-click rollback risks production downtime.
n8n-mcp solves all of these problems natively.
Related MCP server: n8n MCP Agent
๐๏ธ Architecture
graph TD
Client[AI Client / Claude Desktop / Cursor / Antigravity]
subgraph MCP Server Layer ["n8n MCP Server (FastMCP / Stdio)"]
Transport[Stdio Transport / Windows Proactor Loop]
Registry[Central Tool Registry - 26 Production Tools]
end
subgraph Domain Engines ["Domain Engines & Core Logic"]
Patcher[Diff-Based Node Patcher & Deep-Merge]
Snapshots[Timestamped Snapshot & 1-Click Rollback]
PinData[Pin-Data Sandbox Testing Engine]
Catalog[Anti-Hallucination Node Catalog]
Validator[DAG Cycle & LangChain Multi-Port Linter]
Diagnostics[Execution Diagnostics & RCA Engine]
Healer[Autonomous Self-Healing Loop max 2 attempts]
Stealth[behavioral-playwright Anti-Bot Bridge]
ClientCore[Resilient REST Client Full-Jitter Backoff]
end
subgraph External Infrastructure ["External Infrastructure"]
N8nAPI[n8n Instance REST API v1]
PlaywrightEngine[behavioral-playwright Stealth Engine]
TemplateLib[n8n Official & Community Templates]
end
Client <-->|JSON-RPC 2.0 / Stdio| Transport
Transport --> Registry
Registry --> Patcher
Registry --> Snapshots
Registry --> PinData
Registry --> Catalog
Registry --> Validator
Registry --> Diagnostics
Registry --> Healer
Registry --> Stealth
Registry --> ClientCore
Patcher --> Snapshots
Patcher --> ClientCore
Healer --> Diagnostics
Healer --> Patcher
Healer --> ClientCore
PinData --> ClientCore
Stealth --> PlaywrightEngine
ClientCore <--> N8nAPI
ClientCore <--> TemplateLib๐งฐ The 26 Production MCP Tools Catalog
# | Tool Name | Category | Description | Token Advantage |
1 |
| Workflows | List all workflows with active status, tags, and cursor pagination | Filtered minimal DTO |
2 |
| Workflows | Retrieve full workflow JSON (nodes, connections, settings, pinData) | Read-only inspection |
3 |
| Workflows | Create new workflow with auto-sanitized payload | Strips read-only fields |
4 |
| Workflows | Replace workflow definition with guaranteed HTTP 400 prevention | Zero read-only rejection |
5 |
| Diff Patcher | Partial node patcher: In-memory deep-merge of parameters with pre-patch snapshot | 85โ90% token reduction |
6 |
| Snapshots | 1-click rollback: Restores previous workflow state from local snapshots | Instant recovery |
7 |
| Workflows | Activate or deactivate a workflow in n8n | Atomic boolean toggle |
8 |
| Workflows | Permanently deletes a workflow by ID | Direct cleanup |
9 |
| Discovery | Zero-latency keyword search across core & AI nodes | Eliminates hallucination |
10 |
| Discovery | Inspect parameter contract, enums, and required credentials for any node | Exact specification |
11 |
| Validation | Multi-port DAG cycle detection, dangling nodes check, expression syntax linter, and Python AST | Pre-deployment sanity gate |
12 |
| AI Validation | Validates LangChain agent sub-nodes ( | Guarantees AI graph correctness |
13 |
| Testing | Injects mock test data into trigger nodes without running external webhooks | Safe sandbox testing |
14 |
| Testing | Clears pinned data from specific or all nodes prior to live deployment | Clean production release |
15 |
| Executions | Query execution history by workflow, status ( | Minimal execution DTO |
16 |
| Executions | Detailed execution inspection with full step-by-step I/O and runtime data | Deep debugging |
17 |
| Diagnostics | Pinpoints crashed node and produces structured Root Cause Analysis (RCA) | Instant error diagnosis |
18 |
| Executions | Retries failed execution with optional latest workflow definition reloading | Resilient recovery |
19 |
| Executions | Purges execution records from n8n history | History pruning |
20 |
| Self-Healing | Autonomous loop: Diagnoses RCA -> patches node -> retries execution (max 2 attempts) | Zero human intervention |
21 |
| Templates | Searches 2,000+ official and community workflow templates by use case | Rapid scaffolding |
22 |
| Templates | Downloads verified workflow template JSON ready for deployment | Instant template cloning |
23 |
| Stealth Bridge | Generates | Cloudflare/Turnstile bypass |
24 |
| Operations | Dispatches test ( | Dynamic manual trigger |
25 |
| Operations | Pings n8n public API to verify connectivity, latency, and instance status | Liveness probe |
26 |
| Security | Lists credential IDs and types with secret values safely masked | Leak-proof discovery |
๐ Token Efficiency & Economics
Traditional n8n MCP servers force the LLM to read and rewrite the entire workflow JSON on every edit:
Metric | Traditional MCP Server |
| Improvement |
Single Parameter Change | ~22,000 tokens (Full JSON roundtrip) | ~180 tokens ( | 99.2% Savings |
Multi-node Update | ~35,000 tokens | ~850 tokens | 97.5% Savings |
Context Window Saturation | Reaches limit in 3โ4 edits | Stays under 5% over 50+ edits | 10x Longer Sessions |
Safety & Rollback | Manual undo or lost state | Automated snapshot before patch | Zero Data Loss |
๐ Quick Start
1. Installation
git clone https://github.com/sadik004/n8n.mcp.git
cd n8n.mcp
pip install -e .2. Environment Configuration
Copy .env.example to .env:
N8N_HOST=http://localhost:5678
N8N_API_KEY=your_n8n_public_api_key_here
TIMEOUT_SECONDS=30.0
MAX_RETRIES=3
BEHAVIORAL_PLAYWRIGHT_URL=http://host.docker.internal:8000
SNAPSHOTS_DIR=.snapshots3. Verify Server
python -m n8n_mcp --check๐ฅ๏ธ Client Configuration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"n8n": {
"command": "python",
"args": ["-m", "n8n_mcp", "--transport", "stdio"],
"env": {
"N8N_HOST": "http://localhost:5678",
"N8N_API_KEY": "YOUR_N8N_API_KEY",
"BEHAVIORAL_PLAYWRIGHT_URL": "http://host.docker.internal:8000"
}
}
}
}Cursor / Antigravity IDE (mcp.json)
{
"mcpServers": {
"n8n": {
"command": "n8n-mcp",
"args": ["--transport", "stdio"],
"env": {
"N8N_HOST": "http://localhost:5678",
"N8N_API_KEY": "YOUR_N8N_API_KEY"
}
}
}
}๐งช Automated Test Suite
Every layer is rigorously covered with unit and end-to-end integration tests:
pytest -v============================= test session starts =============================
platform win32 -- Python 3.13.9, pytest-8.4.2, pluggy-1.5.0
collected 54 items
tests/integration/test_mcp_e2e.py::test_fastmcp_initialization_and_tool_count PASSED [ 1%]
tests/integration/test_mcp_e2e.py::test_jsonrpc_initialize_handshake PASSED [ 3%]
...
tests/unit/test_validator.py::test_validate_ai_agent_graph_missing_language_model PASSED [ 98%]
tests/unit/test_validator.py::test_validate_ai_agent_graph_valid PASSED [100%]
============================= 54 passed in 3.01s ==============================๐ License
This project is licensed under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Create, browse, remix, collaborate on, and run durable AI workflow nodes from MCP hosts.
Open-source Zapier/n8n alternative as an MCP server: agents build, run and debug your workflows.
Automate 1,000+ services from any MCP-compatible AI agent: build Applets, run actions and queries.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Related MCP Servers
- AlicenseBqualityDmaintenanceA comprehensive MCP server that provides full control over n8n automation workflows through natural language. It offers 43 tools for managing workflows, executions, credentials, and data tables, with safety features like write-mode protection and double-validated workflow creation.431MIT
- AlicenseBqualityCmaintenanceAutonomous AI agent for n8n workflow automation with credential factories, execution helpers, and 4343+ workflow templates. Provides 38 MCP tools for full n8n API coverage.46MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI models to manage workflows, credentials, nodes, templates, and monitor executions on the n8n automation platform through a standardized MCP interface.89,310 npmMIT
- FlicenseBqualityCmaintenanceA full-power MCP server for n8n that enables AI agents to create, read, update, delete, and test workflows and credentials, including webhook testing, validation, and backup/versioning.319-