N8N MCP Server

N8N MCP Server

Model Context Protocol (MCP) server for managing n8n workflows, allowing Claude and other MCP-compatible tools to create, read, update, delete, and execute workflows in your n8n instance.

Category
访问服务器

README

N8N MCP Server

Model Context Protocol (MCP) server for managing n8n workflows. This allows Claude and other MCP-compatible tools to create, read, update, and delete workflows in your n8n instance.

Features

  • 📋 List all workflows
  • 📖 Get workflow details
  • ✏️ Create new workflows
  • 🔄 Update existing workflows
  • 🗑️ Delete workflows
  • ▶️ Execute workflows
  • 📊 View execution history
  • 🔄 Activate/deactivate workflows

Setup

  1. Clone this repository:

    git clone https://github.com/chinmaybhatk/n8n-mcp-server.git
    cd n8n-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Create environment file:

    cp .env.example .env
    
  4. Edit .env with your n8n credentials:

    N8N_URL=https://your-n8n-instance.com
    N8N_API_KEY=your_api_key_here
    
  5. Build the project:

    npm run build
    

Getting n8n API Key

  1. In your n8n instance, go to Settings > API
  2. Create a new API key with the following permissions:
    • workflow:create
    • workflow:read
    • workflow:update
    • workflow:delete
    • workflow:execute
    • execution:read

Usage

With Claude Desktop

Add to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "n8n": {
      "command": "node",
      "args": ["/path/to/n8n-mcp-server/build/index.js"],
      "env": {
        "N8N_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your_api_key_here"
      }
    }
  }
}

Development

Run in development mode:

npm run dev

Available Tools

  • list_workflows - List all workflows with optional active filter
  • get_workflow - Get detailed workflow information by ID
  • create_workflow - Create a new workflow with nodes and connections
  • update_workflow - Update an existing workflow
  • delete_workflow - Delete a workflow by ID
  • activate_workflow - Activate or deactivate a workflow
  • execute_workflow - Manually execute a workflow
  • get_executions - Get workflow execution history

Troubleshooting

Common Issues

400 Bad Request when creating workflows:

  • The server now automatically generates node IDs if not provided
  • Default positions are set for nodes without positions
  • Default typeVersion is set to 1 if not specified
  • Ensure node names and types are provided

Authentication Errors:

  • Verify your N8N_API_KEY is correct and has proper permissions
  • Ensure your N8N_URL is accessible and includes the protocol (https://)
  • Check that the API key hasn't expired

Network Timeouts:

  • The server includes a 30-second timeout for API requests
  • For large workflows, consider breaking them into smaller parts

405 Method Not Allowed:

  • The server includes fallback methods for activation and execution
  • For activation, it will try updating the entire workflow if PATCH fails

Debug Mode

Enable debug mode by setting DEBUG=true in your .env file:

DEBUG=true

This will log request/response data for troubleshooting.

Testing API Connection

You can test your n8n API connection manually:

curl -H "X-N8N-API-KEY: your_api_key" https://your-n8n-instance.com/api/v1/workflows

Recent Updates (v1.0.2)

  • ✅ Auto-generate node IDs when not provided
  • ✅ Set intelligent default positions for nodes
  • ✅ Auto-set typeVersion to 1 if not specified
  • ✅ Enhanced workflow settings with proper defaults
  • ✅ Improved activation endpoint with fallback method
  • ✅ Added debug mode for request/response logging
  • ✅ Better error messages with full response data

Recent Updates (v1.0.1)

  • ✅ Fixed workflow creation payload structure
  • ✅ Added comprehensive error handling and logging
  • ✅ Improved node validation before creation
  • ✅ Added fallback endpoints for different n8n versions
  • ✅ Better error messages for troubleshooting
  • ✅ Preserved existing workflow data during updates
  • ✅ Increased API timeout to 30 seconds

Example Usage

Once configured, you can interact with Claude like this:

You: "Create a workflow that monitors a webhook, processes the data with a Code node to extract email addresses, and sends notifications via Slack."

Claude will:

  1. Design the workflow structure
  2. Create the appropriate nodes (Webhook, Code, Slack)
  3. Configure the connections
  4. Use the MCP server to create it in your n8n instance

Note: You don't need to specify node IDs or positions - the server handles these automatically!

Security

  • Never commit your .env file
  • Store API keys securely
  • Use environment variables for sensitive configuration
  • Ensure your n8n instance is properly secured

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

ISC

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选