n8n MCP Server
Enables AI models to manage n8n workflow automation through a standardized interface. Supports creating, reading, updating, and deleting workflows with comprehensive access to workflow nodes, connections, and configurations.
README
n8n MCP Server
Model Context Protocol (MCP) server for n8n workflow automation platform. This server provides AI models with comprehensive access to n8n workflows through a standardized MCP interface.
Quick Start
Prerequisites
- n8n instance running (local or remote)
- n8n API key (how to get API key)
- Node.js 22.10.0 or higher
Installation
Install and run directly using npx (no local clone required):
npx @r_masseater/n8n-mcp-server --n8n-url "http://localhost:5678" --api-key "your-api-key"
Using with Claude Desktop
Add this configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"n8n": {
"command": "npx",
"args": ["@r_masseater/n8n-mcp-server"],
"env": {
"N8N_URL": "http://localhost:5678",
"N8N_API_KEY": "your-api-key"
}
}
}
}
After saving, restart Claude Desktop. You can now ask Claude to manage your n8n workflows!
Example prompts:
- "List all my n8n workflows"
- "Create a new workflow called 'Email Automation'"
- "Show me the details of workflow ID abc123"
- "Update workflow xyz456 to add a new node"
Features
- Complete Workflow Management: Create, read, update, and delete n8n workflows
- Optimized Responses: Context-efficient data structures for AI model consumption
- Flexible Authentication: API key-based authentication
- Dual Transport Support: stdio and HTTP transports
- Comprehensive Error Handling: Structured error responses with meaningful messages
Configuration
CLI Options
# Basic usage (uses environment variables)
npx @r_masseater/n8n-mcp-server
# With CLI options
npx @r_masseater/n8n-mcp-server --n8n-url http://localhost:5678 --api-key your-key --log-level debug
# HTTP transport (for development/testing)
npx @r_masseater/n8n-mcp-server --transport http --port 3000
Environment Variables
Alternatively, you can use environment variables:
# Required
export N8N_URL="http://localhost:5678" # n8n instance URL
export N8N_API_KEY="your-api-key" # n8n API key
# Optional
export LOG_LEVEL="info" # Log level (error|warn|info|debug)
Development
If you want to develop or contribute to this project:
# Clone the repository
git clone https://github.com/masseater/n8n-mcp-server.git
cd n8n-mcp-server
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Run in development mode with auto-reload
pnpm run dev
# Run tests
pnpm test
Available MCP Tools
1. list_workflows
List n8n workflows with optional filtering.
Parameters:
active(boolean, optional): Filter by active statustags(array of strings, optional): Filter by tagslimit(number, optional): Maximum number of workflows to return (1-100)offset(number, optional): Number of workflows to skip
Example:
{
"name": "list_workflows",
"arguments": {
"active": true,
"tags": ["automation", "production"],
"limit": 10
}
}
2. get_workflow
Get detailed information about a specific workflow.
Parameters:
id(string, required): Workflow ID
Example:
{
"name": "get_workflow",
"arguments": {
"id": "workflow-123"
}
}
3. create_workflow
Create a new workflow.
Parameters:
name(string, required): Workflow namenodes(array, optional): Workflow nodesconnections(object, optional): Node connectionsactive(boolean, optional): Whether workflow is activetags(array of strings, optional): Workflow tags
Example:
{
"name": "create_workflow",
"arguments": {
"name": "My New Workflow",
"nodes": [
{
"id": "node1",
"type": "n8n-nodes-base.start",
"position": [100, 100]
}
],
"connections": {},
"active": false,
"tags": ["automation"]
}
}
4. update_workflow
Update an existing workflow.
Parameters:
id(string, required): Workflow IDname(string, optional): New workflow namenodes(array, optional): Updated workflow nodesconnections(object, optional): Updated node connectionsactive(boolean, optional): Updated active statustags(array of strings, optional): Updated workflow tags
Example:
{
"name": "update_workflow",
"arguments": {
"id": "workflow-123",
"name": "Updated Workflow Name",
"active": true,
"tags": ["updated", "production"]
}
}
5. delete_workflow
Delete a workflow.
Parameters:
id(string, required): Workflow ID
Example:
{
"name": "delete_workflow",
"arguments": {
"id": "workflow-123"
}
}
Usage Examples
Using with Claude Desktop
Add to your Claude Desktop configuration:
{
"mcpServers": {
"n8n": {
"command": "node",
"args": ["/path/to/n8n-mcp-server/dist/index.js"],
"env": {
"N8N_URL": "http://localhost:5678",
"N8N_API_KEY": "your-api-key",
"LOG_LEVEL": "info"
}
}
}
}
Using with other MCP clients
The server supports both stdio and HTTP transports:
# stdio transport (default)
pnpm start
# HTTP transport
pnpm start --transport http --port 3000
Development
Project Structure
src/
├── clients/ # n8n API client implementations
├── config/ # Configuration management
├── interfaces/ # TypeScript interfaces
├── optimizers/ # Response optimization
├── server/ # MCP server implementation
├── types/ # Type definitions
└── index.ts # Main entry point
Scripts
# Development
pnpm run dev # Start in development mode
pnpm run build # Build the project
pnpm run type-check # TypeScript type checking
# Production
pnpm start # Start the server
pnpm start:stdio # Start with stdio transport
pnpm start:http # Start with HTTP transport
Testing
# Run type checking
pnpm run type-check
# Build and test
pnpm run build
Error Handling
The server provides structured error responses:
{
"content": [
{
"type": "text",
"text": "Error: Failed to authenticate with n8n API"
}
],
"isError": true
}
Common error scenarios:
- Authentication failures: Invalid API key or n8n instance unreachable
- Workflow not found: Invalid workflow ID
- Validation errors: Invalid parameters or workflow structure
- Network errors: Connection timeouts or API unavailability
Response Optimization
The server optimizes responses for AI model consumption:
- Minimized context: Removes unnecessary fields and metadata
- Essential information: Preserves critical workflow data
- Pagination support: Handles large datasets efficiently
- Structured format: Consistent JSON responses
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run type checking and build
- Submit a pull request
License
MIT License - see LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。