n8n节点文档服务

一个为AI助手提供全面访问n8n节点文档、属性和操作的模型上下文协议(MCP)服务器,支持1,236个自动化节点。

  • by ArtemisAI
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 ArtemisAI/n8n-mcp

使用说明

n8n MCP

一种模型上下文协议(MCP)服务器,为AI助手提供对n8n节点文档、属性和操作的全面访问。在几分钟内部署,让Claude和其他人工智能助理深入了解n8n的1236个工作流自动化节点(806个核心+430个社区)。

概述

n8n MCP是n8n工作流自动化平台和AI模型之间的桥梁,使它们能够有效地理解和使用n8n节点。它提供结构化访问:

  • 📚 1084 n8n个节点 -537个核心节点+547个社区节点(301个已验证)
  • 🔧 节点属性 -99%的覆盖率包含详细的模式
  • ⚡ 节点操作 -63.6%的可用行动覆盖率
  • 📄 文档 -87%的覆盖率来自官方n8n文档(包括AI节点)
  • 🤖 AI工具 -检测到265种具有AI功能的工具变体,并附有完整文档
  • 💡 真实世界的例子 -2646个从流行模板中预提取的配置
  • 🎯 模板库 -2709个元数据覆盖率为100%的工作流模板
  • 🌐 社区节点 -搜索经过验证的社区集成 source 过滤器(新!)

⚠️ 重要安全警告

切勿直接使用人工智能编辑您的生产工作流程! 始终:

  • 🔄 复制一份 在使用人工智能工具之前,请先了解您的工作流程
  • 🧪 开发中的测试 环境优先
  • 💾 导出备份 重要工作流程
  • ⚡ 验证更改 部署到生产环境之前

人工智能的结果可能是不可预测的。保护你的工作!

🚀 快速开始

选项1:托管服务(最简单-无需设置!)☁️

尝试n8n MCP的最快方法 -无需安装,无需配置:

👉 dashboard.n8nmcp.com

  • ✅ 免费版:100次工具调用/天
  • ✅ 即刻进入:立即开始构建工作流
  • ✅ 始终保持最新状态:最新n8n节点和模板
  • ✅ 无基础设施我们处理一切

只需注册,获取API密钥,然后连接MCP客户端。


🏠 自助托管选项

更喜欢自己运行n8n MCP吗?选择部署方法:

选项A:npx(快速本地设置)🚀

让n8n MCP在几分钟内运行:

先决条件: Node.js 安装在您的系统上

# Run directly with npx (no installation needed!)
npx n8n-mcp

添加到Claude桌面配置:

⚠️ 重要:The MCP_MODE: "stdio" 环境变量为 必需的 克劳德桌面。如果没有它,您将看到JSON解析错误,如 "Unexpected token..." 在UI中。此变量确保只有JSON-RPC消息发送到stdout,防止调试日志干扰协议。

基本配置(仅限文档工具):

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "npx",
      "args": ["n8n-mcp"],
      "env": {
        "MCP_MODE": "stdio",
        "LOG_LEVEL": "error",
        "DISABLE_CONSOLE_OUTPUT": "true"
      }
    }
  }
}

完整配置(使用n8n管理工具):

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "npx",
      "args": ["n8n-mcp"],
      "env": {
        "MCP_MODE": "stdio",
        "LOG_LEVEL": "error",
        "DISABLE_CONSOLE_OUTPUT": "true",
        "N8N_API_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your-api-key"
      }
    }
  }
}

备注:npx将自动下载并运行最新版本。该包包括一个预先构建的数据库,其中包含所有n8n节点信息。

配置文件位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 视窗: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

更新配置后重新启动Claude Desktop -就是这样! 🎉

选项B:Docker(隔离和可复制)🐳

先决条件: Docker已安装在您的系统上

📦 Install Docker (click to expand)

macOS:

# Using Homebrew
brew install --cask docker

# Or download from https://www.docker.com/products/docker-desktop/

Linux(Ubuntu/Debian):

# Update package index
sudo apt-get update

# Install Docker
sudo apt-get install docker.io

# Start Docker service
sudo systemctl start docker
sudo systemctl enable docker

# Add your user to docker group (optional, to run without sudo)
sudo usermod -aG docker $USER
# Log out and back in for this to take effect

窗户:

# Option 1: Using winget (Windows Package Manager)
winget install Docker.DockerDesktop

# Option 2: Using Chocolatey
choco install docker-desktop

# Option 3: Download installer from https://www.docker.com/products/docker-desktop/

验证安装:

docker --version
# Pull the Docker image (~280MB, no n8n dependencies!)
docker pull ghcr.io/czlonkowski/n8n-mcp:latest

⚡ 超优化: 我们的Docker镜像比典型的n8n镜像小82%,因为它不包含n8n依赖关系,只包含带有预构建数据库的运行时MCP服务器!

添加到Claude桌面配置:

基本配置(仅限文档工具):

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "-e", "MCP_MODE=stdio",
        "-e", "LOG_LEVEL=error",
        "-e", "DISABLE_CONSOLE_OUTPUT=true",
        "ghcr.io/czlonkowski/n8n-mcp:latest"
      ]
    }
  }
}

完整配置(使用n8n管理工具):

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "-e", "MCP_MODE=stdio",
        "-e", "LOG_LEVEL=error",
        "-e", "DISABLE_CONSOLE_OUTPUT=true",
        "-e", "N8N_API_URL=https://your-n8n-instance.com",
        "-e", "N8N_API_KEY=your-api-key",
        "ghcr.io/czlonkowski/n8n-mcp:latest"
      ]
    }
  }
}

💡 提示:如果你在同一台机器上本地运行n8n(例如,通过Docker),请使用http://host.docker.internal:5678作为N8N_ API_ URL。

备注:n8n API凭据是可选的。没有它们,您将可以访问所有文档和验证工具。有了它们,您还将获得工作流管理功能(创建、更新、执行工作流)。

🏠 本地n8n实例配置

如果你在本地运行n8n(例如。, http://localhost:5678 或者Docker),您需要允许localhost webhooks:

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "--init",
        "-e", "MCP_MODE=stdio",
        "-e", "LOG_LEVEL=error",
        "-e", "DISABLE_CONSOLE_OUTPUT=true",
        "-e", "N8N_API_URL=http://host.docker.internal:5678",
        "-e", "N8N_API_KEY=your-api-key",
        "-e", "WEBHOOK_SECURITY_MODE=moderate",
        "ghcr.io/czlonkowski/n8n-mcp:latest"
      ]
    }
  }
}

⚠️ 重要提示: 集 WEBHOOK_SECURITY_MODE=moderate 允许webhooks访问您的本地n8n实例。这对本地开发是安全的,同时仍然阻止私有网络和云元数据。

重要提示: 这 -i MCP stdio通信需要标志。

🔧 如果您在Docker上遇到任何问题,请查看我们的 Docker故障排除指南.

配置文件位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 视窗: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

更新配置后重新启动Claude Desktop -就是这样! 🎉

🔐 隐私和遥测

n8n mcp收集匿名使用统计数据以改进该工具。 查看我们的隐私政策.

拒绝权

对于npx用户:

npx n8n-mcp telemetry disable

对于Docker用户: 将以下环境变量添加到Docker配置中:

"-e", "N8N_MCP_TELEMETRY_DISABLED=true"

Claude Desktop配置中的示例:

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "-e", "MCP_MODE=stdio",
        "-e", "LOG_LEVEL=error",
        "-e", "N8N_MCP_TELEMETRY_DISABLED=true",
        "ghcr.io/czlonkowski/n8n-mcp:latest"
      ]
    }
  }
}

对于docker compose用户: 在您的环境文件或docker-compose.yml中设置:

environment:
  N8N_MCP_TELEMETRY_DISABLED: "true"

⚙️ 数据库和内存配置

数据库适配器

n8n-mcp使用SQLite存储节点文档。有两个适配器可供选择:

  1. 更好平方3 (Docker中的默认设置)

    • 实现最佳性能的本机C++绑定
    • 直接磁盘写入(无内存开销)
    • 现在默认启用 Docker镜像(v2.20.2+)
    • 内存使用量:约100-120 MB稳定
  2. sql.js (后退)

    • 纯JavaScript实现
    • 具有定期保存功能的内存数据库
    • 当better-splite3编译失败时使用
    • 内存使用量:~150-200MB稳定

内存优化(sql.js)

如果使用sql.js回退,您可以配置保存间隔以在数据安全和内存效率之间取得平衡:

环境变量:

SQLJS_SAVE_INTERVAL_MS=5000  # Default: 5000ms (5 seconds)

用途:

  • 控制数据库更改后保存到磁盘的等待时间
  • 值越低=保存越频繁=内存流失率越高
  • 值越高=保存频率越低=内存使用率越低
  • 最小值:100ms
  • 推荐:5000-10000ms用于生产

Docker配置:

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "-e", "SQLJS_SAVE_INTERVAL_MS=10000",
        "ghcr.io/czlonkowski/n8n-mcp:latest"
      ]
    }
  }
}

docker组成:

environment:
  SQLJS_SAVE_INTERVAL_MS: "10000"

💖 支持这个项目

n8n mcp 最初是作为个人工具,但现在帮助数万名开发人员高效地自动化他们的工作流程。维护和开发这个项目与我的有偿工作竞争。

您的赞助帮助我:

  • 🚀 专注于新功能
  • 🐛 快速响应问题
  • 📚 保持文档更新
  • 🔄 确保与最新n8n版本兼容

每一笔赞助都直接转化为投入的时间,使n8n mcp对每个人都更好。 成为赞助商→


选项C:本地安装(用于开发)

先决条件: Node.js 安装在您的系统上

# 1. Clone and setup
git clone https://github.com/czlonkowski/n8n-mcp.git
cd n8n-mcp
npm install
npm run build
npm run rebuild

# 2. Test it works
npm start

添加到Claude桌面配置:

基本配置(仅限文档工具):

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/n8n-mcp/dist/mcp/index.js"],
      "env": {
        "MCP_MODE": "stdio",
        "LOG_LEVEL": "error",
        "DISABLE_CONSOLE_OUTPUT": "true"
      }
    }
  }
}

完整配置(使用n8n管理工具):

{
  "mcpServers": {
    "n8n-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/n8n-mcp/dist/mcp/index.js"],
      "env": {
        "MCP_MODE": "stdio",
        "LOG_LEVEL": "error",
        "DISABLE_CONSOLE_OUTPUT": "true",
        "N8N_API_URL": "https://your-n8n-instance.com",
        "N8N_API_KEY": "your-api-key"
      }
    }
  }
}

备注:n8n API凭据可以在 .env 文件(创建自 .env.example)或者直接在如上所示的Claude配置中。

💡 提示:如果你在同一台机器上本地运行n8n(例如,通过Docker),请使用http://host.docker.internal:5678作为N8N_ API_ URL。

选项D:铁路云部署(一键部署)☁️

先决条件: 铁路账户(提供免费等级)

将n8n MCP部署到铁路的云平台,无需配置:

优点:

  • ☁️ 即时云托管 -无需设置服务器
  • 🔒 缺省安全 -包括HTTPS,身份验证令牌警告
  • 🌐 全球访问 -从任何Claude桌面连接
  • ⚡ 自动缩放 -铁路负责基础设施
  • 📊 内置监控 -包括日志和指标

快速设置:

  1. 点击上面的“铁路部署”按钮
  2. 登录Railway(或创建免费帐户)
  3. 配置您的部署(项目名称、地区)
  4. 点击“部署”并等待约2-3分钟
  5. 复制部署URL和身份验证令牌
  6. 使用HTTPS URL添加到Claude Desktop配置

📚 有关详细的设置说明、故障排除和配置示例,请参阅我们的 铁路部署指南

配置文件位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 视窗: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

更新配置后重新启动Claude Desktop -就是这样! 🎉

🔧 n8n集成

想在n8n实例中使用n8n MCP吗?查看我们的综合 n8n部署指南 用于:

  • 使用MCP客户端工具节点进行本地测试
  • 使用Docker Compose进行生产部署
  • Hetzner、AWS和其他提供商上的云部署
  • 故障排除和安全最佳实践

💻 连接IDE

n8n MCP可与多个AI驱动的IDE和工具配合使用。选择您喜欢的开发环境:

克劳德代码

Claude Code CLI的快速设置-只需键入“添加此mcp服务器”并粘贴配置即可。

Visual Studio Code

VS Code与GitHub Copilot集成和MCP支持的完整设置指南。

光标

使用自定义规则将n8n MCP连接到Cursor IDE的分步教程。

帆板运动

使用项目规则将n8n MCP与Windsurf集成的完整指南。

法典

n8n MCP与Codex集成的完整指南。

反重力

n8n MCP与反重力集成的完整指南。

🎓 添加克劳德技能(可选)

通过教授AI如何构建生产就绪的工作流程的专业技能,增强您的n8n工作流程构建!

了解更多: n8n技能库

🤖 Claude项目设置

为了在Claude Projects中使用n8n MCP时获得最佳效果,请使用以下增强的系统说明:

You are an expert in n8n automation software using n8n-MCP tools. Your role is to design, build, and validate n8n workflows with maximum accuracy and efficiency.

## Core Principles

### 1. Silent Execution
CRITICAL: Execute tools without commentary. Only respond AFTER all tools complete.

❌ BAD: "Let me search for Slack nodes... Great! Now let me get details..."
✅ GOOD: [Execute search_nodes and get_node in parallel, then respond]

### 2. Parallel Execution
When operations are independent, execute them in parallel for maximum performance.

✅ GOOD: Call search_nodes, list_nodes, and search_templates simultaneously
❌ BAD: Sequential tool calls (await each one before the next)

### 3. Templates First
ALWAYS check templates before building from scratch (2,709 available).

### 4. Multi-Level Validation
Use validate_node(mode='minimal') → validate_node(mode='full') → validate_workflow pattern.

### 5. Never Trust Defaults
⚠️ CRITICAL: Default parameter values are the #1 source of runtime failures.
ALWAYS explicitly configure ALL parameters that control node behavior.

## Workflow Process

1. **Start**: Call `tools_documentation()` for best practices

2. **Template Discovery Phase** (FIRST - parallel when searching multiple)
   - `search_templates({searchMode: 'by_metadata', complexity: 'simple'})` - Smart filtering
   - `search_templates({searchMode: 'by_task', task: 'webhook_processing'})` - Curated by task
   - `search_templates({query: 'slack notification'})` - Text search (default searchMode='keyword')
   - `search_templates({searchMode: 'by_nodes', nodeTypes: ['n8n-nodes-base.slack']})` - By node type

   **Filtering strategies**:
   - Beginners: `complexity: "simple"` + `maxSetupMinutes: 30`
   - By role: `targetAudience: "marketers"` | `"developers"` | `"analysts"`
   - By time: `maxSetupMinutes: 15` for quick wins
   - By service: `requiredService: "openai"` for compatibility

3. **Node Discovery** (if no suitable template - parallel execution)
   - Think deeply about requirements. Ask clarifying questions if unclear.
   - `search_nodes({query: 'keyword', includeExamples: true})` - Parallel for multiple nodes
   - `search_nodes({query: 'trigger'})` - Browse triggers
   - `search_nodes({query: 'AI agent langchain'})` - AI-capable nodes

4. **Configuration Phase** (parallel for multiple nodes)
   - `get_node({nodeType, detail: 'standard', includeExamples: true})` - Essential properties (default)
   - `get_node({nodeType, detail: 'minimal'})` - Basic metadata only (~200 tokens)
   - `get_node({nodeType, detail: 'full'})` - Complete information (~3000-8000 tokens)
   - `get_node({nodeType, mode: 'search_properties', propertyQuery: 'auth'})` - Find specific properties
   - `get_node({nodeType, mode: 'docs'})` - Human-readable markdown documentation
   - Show workflow architecture to user for approval before proceeding

5. **Validation Phase** (parallel for multiple nodes)
   - `validate_node({nodeType, config, mode: 'minimal'})` - Quick required fields check
   - `validate_node({nodeType, config, mode: 'full', profile: 'runtime'})` - Full validation with fixes
   - Fix ALL errors before proceeding

6. **Building Phase**
   - If using template: `get_template(templateId, {mode: "full"})`
   - **MANDATORY ATTRIBUTION**: "Based on template by **[author.name]** (@[username]). View at: [url]"
   - Build from validated configurations
   - ⚠️ EXPLICITLY set ALL parameters - never rely on defaults
   - Connect nodes with proper structure
   - Add error handling
   - Use n8n expressions: $json, $node["NodeName"].json
   - Build in artifact (unless deploying to n8n instance)

7. **Workflow Validation** (before deployment)
   - `validate_workflow(workflow)` - Complete validation
   - `validate_workflow_connections(workflow)` - Structure check
   - `validate_workflow_expressions(workflow)` - Expression validation
   - Fix ALL issues before deployment

8. **Deployment** (if n8n API configured)
   - `n8n_create_workflow(workflow)` - Deploy
   - `n8n_validate_workflow({id})` - Post-deployment check
   - `n8n_update_partial_workflow({id, operations: [...]})` - Batch updates
   - `n8n_test_workflow({workflowId})` - Test workflow execution

## Critical Warnings

### ⚠️ Never Trust Defaults
Default values cause runtime failures. Example:
```json
// ❌ FAILS at runtime
{resource: "message", operation: "post", text: "Hello"}

// ✅ WORKS - all parameters explicit
{resource: "message", operation: "post", select: "channel", channelId: "C123", text: "Hello"}
```

### ⚠️ Example Availability
`includeExamples: true` returns real configurations from workflow templates.
- Coverage varies by node popularity
- When no examples available, use `get_node` + `validate_node({mode: 'minimal'})`

## Validation Strategy

### Level 1 - Quick Check (before building)
`validate_node({nodeType, config, mode: 'minimal'})` - Required fields only (<100ms)

### Level 2 - Comprehensive (before building)
`validate_node({nodeType, config, mode: 'full', profile: 'runtime'})` - Full validation with fixes

### Level 3 - Complete (after building)
`validate_workflow(workflow)` - Connections, expressions, AI tools

### Level 4 - Post-Deployment
1. `n8n_validate_workflow({id})` - Validate deployed workflow
2. `n8n_autofix_workflow({id})` - Auto-fix common errors
3. `n8n_executions({action: 'list'})` - Monitor execution status

## Response Format

### Initial Creation
```
[Silent tool execution in parallel]

Created workflow:
- Webhook trigger → Slack notification
- Configured: POST /webhook → #general channel

Validation: ✅ All checks passed
```

### Modifications
```
[Silent tool execution]

Updated workflow:
- Added error handling to HTTP node
- Fixed required Slack parameters

Changes validated successfully.
```

## Batch Operations

Use `n8n_update_partial_workflow` with multiple operations in a single call:

✅ GOOD - Batch multiple operations:
```json
n8n_update_partial_workflow({
  id: "wf-123",
  operations: [
    {type: "updateNode", nodeId: "slack-1", changes: {...}},
    {type: "updateNode", nodeId: "http-1", changes: {...}},
    {type: "cleanStaleConnections"}
  ]
})
```

❌ BAD - Separate calls:
```json
n8n_update_partial_workflow({id: "wf-123", operations: [{...}]})
n8n_update_partial_workflow({id: "wf-123", operations: [{...}]})
```

###   CRITICAL: addConnection Syntax

The `addConnection` operation requires **four separate string parameters**. Common mistakes cause misleading errors.

❌ WRONG - Object format (fails with "Expected string, received object"):
```json
{
  "type": "addConnection",
  "connection": {
    "source": {"nodeId": "node-1", "outputIndex": 0},
    "destination": {"nodeId": "node-2", "inputIndex": 0}
  }
}
```

❌ WRONG - Combined string (fails with "Source node not found"):
```json
{
  "type": "addConnection",
  "source": "node-1:main:0",
  "target": "node-2:main:0"
}
```

✅ CORRECT - Four separate string parameters:
```json
{
  "type": "addConnection",
  "source": "node-id-string",
  "target": "target-node-id-string",
  "sourcePort": "main",
  "targetPort": "main"
}
```

**Reference**: [GitHub Issue #327](https://github.com/czlonkowski/n8n-mcp/issues/327)

### ⚠️ CRITICAL: IF Node Multi-Output Routing

IF nodes have **two outputs** (TRUE and FALSE). Use the **`branch` parameter** to route to the correct output:

✅ CORRECT - Route to TRUE branch (when condition is met):
```json
{
  "type": "addConnection",
  "source": "if-node-id",
  "target": "success-handler-id",
  "sourcePort": "main",
  "targetPort": "main",
  "branch": "true"
}
```

✅ CORRECT - Route to FALSE branch (when condition is NOT met):
```json
{
  "type": "addConnection",
  "source": "if-node-id",
  "target": "failure-handler-id",
  "sourcePort": "main",
  "targetPort": "main",
  "branch": "false"
}
```

**Common Pattern** - Complete IF node routing:
```json
n8n_update_partial_workflow({
  id: "workflow-id",
  operations: [
    {type: "addConnection", source: "If Node", target: "True Handler", sourcePort: "main", targetPort: "main", branch: "true"},
    {type: "addConnection", source: "If Node", target: "False Handler", sourcePort: "main", targetPort: "main", branch: "false"}
  ]
})
```

**Note**: Without the `branch` parameter, both connections may end up on the same output, causing logic errors!

### removeConnection Syntax

Use the same four-parameter format:
```json
{
  "type": "removeConnection",
  "source": "source-node-id",
  "target": "target-node-id",
  "sourcePort": "main",
  "targetPort": "main"
}
```

## Example Workflow

### Template-First Approach

```
// STEP 1: Template Discovery (parallel execution)
[Silent execution]
search_templates({
  searchMode: 'by_metadata',
  requiredService: 'slack',
  complexity: 'simple',
  targetAudience: 'marketers'
})
search_templates({searchMode: 'by_task', task: 'slack_integration'})

// STEP 2: Use template
get_template(templateId, {mode: 'full'})
validate_workflow(workflow)

// Response after all tools complete:
"Found template by **David Ashby** (@cfomodz).
View at: https://n8n.io/workflows/2414

Validation: ✅ All checks passed"
```

### Building from Scratch (if no template)

```
// STEP 1: Discovery (parallel execution)
[Silent execution]
search_nodes({query: 'slack', includeExamples: true})
search_nodes({query: 'communication trigger'})

// STEP 2: Configuration (parallel execution)
[Silent execution]
get_node({nodeType: 'n8n-nodes-base.slack', detail: 'standard', includeExamples: true})
get_node({nodeType: 'n8n-nodes-base.webhook', detail: 'standard', includeExamples: true})

// STEP 3: Validation (parallel execution)
[Silent execution]
validate_node({nodeType: 'n8n-nodes-base.slack', config, mode: 'minimal'})
validate_node({nodeType: 'n8n-nodes-base.slack', config: fullConfig, mode: 'full', profile: 'runtime'})

// STEP 4: Build
// Construct workflow with validated configs
// ⚠️ Set ALL parameters explicitly

// STEP 5: Validate
[Silent execution]
validate_workflow(workflowJson)

// Response after all tools complete:
"Created workflow: Webhook → Slack
Validation: ✅ Passed"
```

### Batch Updates

```json
// ONE call with multiple operations
n8n_update_partial_workflow({
  id: "wf-123",
  operations: [
    {type: "updateNode", nodeId: "slack-1", changes: {position: [100, 200]}},
    {type: "updateNode", nodeId: "http-1", changes: {position: [300, 200]}},
    {type: "cleanStaleConnections"}
  ]
})
```

## Important Rules

### Core Behavior
1. **Silent execution** - No commentary between tools
2. **Parallel by default** - Execute independent operations simultaneously
3. **Templates first** - Always check before building (2,709 available)
4. **Multi-level validation** - Quick check → Full validation → Workflow validation
5. **Never trust defaults** - Explicitly configure ALL parameters

### Attribution & Credits
- **MANDATORY TEMPLATE ATTRIBUTION**: Share author name, username, and n8n.io link
- **Template validation** - Always validate before deployment (may need updates)

### Performance
- **Batch operations** - Use diff operations with multiple changes in one call
- **Parallel execution** - Search, validate, and configure simultaneously
- **Template metadata** - Use smart filtering for faster discovery

### Code Node Usage
- **Avoid when possible** - Prefer standard nodes
- **Only when necessary** - Use code node as last resort
- **AI tool capability** - ANY node can be an AI tool (not just marked ones)

### Most Popular n8n Nodes (for get_node):

1. **n8n-nodes-base.code** - JavaScript/Python scripting
2. **n8n-nodes-base.httpRequest** - HTTP API calls
3. **n8n-nodes-base.webhook** - Event-driven triggers
4. **n8n-nodes-base.set** - Data transformation
5. **n8n-nodes-base.if** - Conditional routing
6. **n8n-nodes-base.manualTrigger** - Manual workflow execution
7. **n8n-nodes-base.respondToWebhook** - Webhook responses
8. **n8n-nodes-base.scheduleTrigger** - Time-based triggers
9. **@n8n/n8n-nodes-langchain.agent** - AI agents
10. **n8n-nodes-base.googleSheets** - Spreadsheet integration
11. **n8n-nodes-base.merge** - Data merging
12. **n8n-nodes-base.switch** - Multi-branch routing
13. **n8n-nodes-base.telegram** - Telegram bot integration
14. **@n8n/n8n-nodes-langchain.lmChatOpenAi** - OpenAI chat models
15. **n8n-nodes-base.splitInBatches** - Batch processing
16. **n8n-nodes-base.openAi** - OpenAI legacy node
17. **n8n-nodes-base.gmail** - Email automation
18. **n8n-nodes-base.function** - Custom functions
19. **n8n-nodes-base.stickyNote** - Workflow documentation
20. **n8n-nodes-base.executeWorkflowTrigger** - Sub-workflow calls

**Note:** LangChain nodes use the `@n8n/n8n-nodes-langchain.` prefix, core nodes use `n8n-nodes-base.`

将这些说明保存在您的Claude Project中,以获得智能模板发现的最佳n8n工作流帮助。

🚨 重要提示:分享指南

这个项目是麻省理工学院授权的,每个人都可以免费使用。然而:

  • ✅ 做:自由分享此存储库,并注明出处
  • ✅ 做:包括直接链接到https://github.com/czlonkowski/n8n-mcp在你的第一篇帖子/视频中
  • ❌ 不要:将此免费工具置于参与要求之后(点赞、关注、评论)
  • ❌ 不要:将此项目用于社交媒体上的参与农业

这个工具的创建是为了让n8n社区的每个人都能毫无摩擦地受益。请尊重麻省理工学院的许可精神,让所有人都能访问。

特性

  • 🔍 智能节点搜索:按名称、类别或功能查找节点
  • 📖 基本属性:只获取10-20个重要的属性
  • 💡 真实世界的例子:从流行模板中预提取2646个配置
  • ✅ 配置验证:部署前验证节点配置
  • 🤖 AI工作流验证:AI Agent工作流的全面验证(v2.17.0中的新功能!)
    • 缺少语言模型检测
    • AI工具连接验证
    • 流模式约束
    • 内存和输出解析器检查
  • 🔗 相关性分析:了解财产关系和条件
  • 🎯 模板发现:2500多个具有智能过滤功能的工作流模板
  • ⚡ 快速响应:使用优化的SQLite,平均查询时间约为12ms
  • 🌐 通用兼容性:适用于任何Node.js版本

💬 为什么选择n8n MCP?克劳德的见证

“在MCP之前,我在翻译。现在我在作曲。这改变了我们如何构建自动化的一切。”

当Anthropic的人工智能助手Claude测试n8n MCP时,结果是革命性的:

没有MCP: “我基本上是在玩猜谜游戏 scheduleTrigger 或 schedule?需要吗 interval 或 rule“我会写一些看似合乎逻辑的东西,但n8n有自己的惯例,你不能凭直觉。我在一个简单的HackerNews抓取器中犯了六个不同的配置错误。"

使用MCP: “一切都……奏效了。我可以问,而不是猜测 get_node() 并获得我所需要的东西——不是100KB的JSON转储,而是重要的实际属性。45分钟的时间现在只需要3分钟。"

真正的价值: “这是关于信心。当你构建自动化工作流程时,不确定性是昂贵的。一个错误的参数,你的工作流程就会在凌晨3点失败。有了MCP,我可以在部署前验证我的配置。这不仅节省了时间,而且让我放心。”

阅读完整采访→

📡 可用的MCP工具

一旦连接,克劳德就可以使用这些强大的工具:

核心工具(7个工具)

  • tools_documentation -获取任何MCP工具的文档(从这里开始!)
  • search_nodes -在所有节点上进行全文搜索。使用 source: 'community'|'verified' 对于社区节点, includeExamples: true 对于配置
  • get_node -多种模式的统一节点信息工具(v2.26.0):
    • 信息模式 (默认): detail: 'minimal'|'standard'|'full', includeExamples: true
    • 文档模式: mode: 'docs' -人类可读的标记文档
    • 房产搜索: mode: 'search_properties', propertyQuery: 'auth'
    • 版本: mode: 'versions'|'compare'|'breaking'|'migrations'
  • validate_node -统一节点验证(v2.26.0):
    • mode: 'minimal' -快速必填字段检查(<100ms)
    • mode: 'full' -使用配置文件进行全面验证(最小、运行时、人工智能友好、严格)
  • validate_workflow -完整的工作流程验证,包括AI代理验证
  • search_templates -统一模板搜索(v2.26.0):
    • searchMode: 'keyword' (默认)-文本搜索 query 参数
    • searchMode: 'by_nodes' -使用特定模板查找模板 nodeTypes
    • searchMode: 'by_task' -整理好的通用模板 task 类型
    • searchMode: 'by_metadata' -筛选条件 complexity, requiredService, targetAudience
  • get_template -获取完整的工作流程JSON(模式:nodes_only、structure、full)

n8n管理工具(13个工具-需要API配置)

这些工具需要 N8N_API_URL 和 N8N_API_KEY 在您的配置中。

工作流管理

  • n8n_create_workflow -使用节点和连接创建新的工作流
  • n8n_get_workflow -统一工作流检索(v2.26.0):
    • mode: 'full' (默认)-完整的JSON工作流
    • mode: 'details' -包括执行统计数据
    • mode: 'structure' -仅节点和连接拓扑
    • mode: 'minimal' -只需ID、姓名、活动状态
  • n8n_update_full_workflow -更新整个工作流程(完全替换)
  • n8n_update_partial_workflow -使用diff操作更新工作流
  • n8n_delete_workflow -永久删除工作流
  • n8n_list_workflows -列出具有过滤和分页功能的工作流
  • n8n_validate_workflow -按ID验证n8n中的工作流
  • n8n_autofix_workflow -自动修复常见工作流错误
  • n8n_workflow_versions -管理版本历史记录和回滚
  • n8n_deploy_template -使用自动修复功能将n8n.io中的模板直接部署到您的实例中

执行管理

  • n8n_test_workflow -测试/触发工作流执行:
    • 自动检测工作流中的触发类型(webhook、表单、聊天)
    • 支持Webhook的自定义数据、标头和HTTP方法
    • 聊天触发对话的支持消息和会话ID
  • n8n_executions -统一执行管理(v2.26.0):
    • action: 'list' -列出执行情况并进行状态筛选
    • action: 'get' -按ID获取执行详细信息
    • action: 'delete' -删除执行记录

系统工具

  • n8n_health_check -检查n8n API连接和功能

示例用法

// Get node info with different detail levels
get_node({
  nodeType: "nodes-base.httpRequest",
  detail: "standard",        // Default: Essential properties
  includeExamples: true      // Include real-world examples from templates
})

// Get documentation
get_node({
  nodeType: "nodes-base.slack",
  mode: "docs"               // Human-readable markdown documentation
})

// Search for specific properties
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "search_properties",
  propertyQuery: "authentication"
})

// Version history and breaking changes
get_node({
  nodeType: "nodes-base.httpRequest",
  mode: "versions"            // View all versions with summary
})

// Search nodes with configuration examples
search_nodes({
  query: "send email gmail",
  includeExamples: true       // Returns top 2 configs per node
})

// Search community nodes only
search_nodes({
  query: "scraping",
  source: "community"         // Options: all, core, community, verified
})

// Search verified community nodes
search_nodes({
  query: "pdf",
  source: "verified"          // Only verified community integrations
})

// Validate node configuration
validate_node({
  nodeType: "nodes-base.httpRequest",
  config: { method: "POST", url: "..." },
  mode: "full",
  profile: "runtime"          // or "minimal", "ai-friendly", "strict"
})

// Quick required field check
validate_node({
  nodeType: "nodes-base.slack",
  config: { resource: "message", operation: "send" },
  mode: "minimal"
})

// Search templates by task
search_templates({
  searchMode: "by_task",
  task: "webhook_processing"
})

💻 地方发展设置

对于贡献者和高级用户:

先决条件:

  • Node.js (任何版本-必要时自动回退)
  • npm或纱线
  • Git
# 1. Clone the repository
git clone https://github.com/czlonkowski/n8n-mcp.git
cd n8n-mcp

# 2. Clone n8n docs (optional but recommended)
git clone https://github.com/n8n-io/n8n-docs.git ../n8n-docs

# 3. Install and build
npm install
npm run build

# 4. Initialize database
npm run rebuild

# 5. Start the server
npm start          # stdio mode for Claude Desktop
npm run start:http # HTTP mode for remote access

开发命令

# Build & Test
npm run build          # Build TypeScript
npm run rebuild        # Rebuild node database
npm run test-nodes     # Test critical nodes
npm run validate       # Validate node data
npm test               # Run all tests

# Update Dependencies
npm run update:n8n:check  # Check for n8n updates
npm run update:n8n        # Update n8n packages

# Run Server
npm run dev            # Development with auto-reload
npm run dev:http       # HTTP dev mode

📚 文档

设置指南

功能文档

开发与部署

项目信息

📊 指标和覆盖范围

当前数据库覆盖率(n8n v2.2.3):

  • ✅ 1084个节点 -537核心+547社区
  • ✅ 301已验证 n8n Strapi API的社区节点
  • ✅ 246热门 npm社区包已索引
  • ✅ 470 有文档的节点(87%的核心覆盖率)
  • ✅ 265 检测到具有AI功能的工具变体
  • ✅ 2,646 预提取的模板配置
  • ✅ 2,709 工作流模板可用(元数据覆盖率100%)
  • ✅ AI Agent和LangChain节点 完整记录在案的
  • ⚡ 平均响应时间:~12毫秒
  • 💾 数据库大小:~70MB(包括模板和社区节点)

🔄 最近的更新

看 更改日志.md 查看完整的版本历史记录和最近的更改。

🧪 测试

该项目包括一个全面的测试套件 2883次测试 确保代码质量和可靠性:

# Run all tests
npm test

# Run tests with coverage report
npm run test:coverage

# Run tests in watch mode
npm run test:watch

# Run specific test suites
npm run test:unit           # 933 unit tests
npm run test:integration    # 249 integration tests
npm run test:bench          # Performance benchmarks

测试套件概述

  • 总测试:2883(100%通过)
    • 单元测试:在99个文件中进行2526次测试
    • 集成测试:20个文件中的357个测试
  • 执行时间:CI约2.5分钟
  • 测试框架:Vitest(用于速度和TypeScript支持)
  • 嘲笑:MSW用于API模拟,自定义数据库模拟

覆盖范围和质量

  • 覆盖范围报告:生成于 ./coverage 目录
  • CI/CD:使用GitHub Actions对所有PR进行自动测试
  • 演出:CI与本地CI的环境感知阈值
  • 并行执行:可配置线程池,运行速度更快

测试架构

总计:3336次测试 跨单元和集成测试套件

  • 单元测试 (2766次测试):使用模拟进行独立组件测试

    • 服务层:增强的验证、属性过滤、工作流验证
    • 解析器:节点解析、属性提取、文档映射
    • 数据库:存储库、适配器、迁移、FTS5搜索
    • MCP工具:工具定义、文档系统
    • HTTP服务器:多租户支持、安全性、配置
  • 集成测试 (570次测试):完整的系统行为验证

    • n8n API集成 (172次测试):所有18个MCP处理程序工具都针对真实的n8n实例进行了测试
      • 工作流管理:创建、读取、更新、删除、列出、验证、自动修复
      • 执行管理:触发器、检索、列表、删除
      • 系统工具:健康检查、工具列表、诊断
    • MCP协议 (119个测试):协议合规性、会话管理、错误处理
    • 数据库 (226个测试):存储库操作、事务、性能、FTS5搜索
    • 模板 (35个测试):模板获取、存储、元数据操作
    • 码头工人 (18个测试):配置、入口点、安全验证

有关详细的测试文档,请参阅 测试架构.

📦 许可证

MIT许可证-请参阅 许可证 了解详情。

感谢您的署名! 如果您使用n8n MCP,请考虑:

  • ⭐ 引导此存储库
  • 💬 在你的项目中提及它
  • 🔗 链接回此仓库

🤝 贡献

欢迎投稿!拜托:

  1. 分叉存储库
  2. 创建要素分支
  3. 运行测试(npm test)
  4. 提交拉取请求

🚀 对于维护人员:自动发布

此项目使用由版本更改触发的自动发布:

# Guided release preparation
npm run prepare:release

# Test release automation
npm run test:release-automation

系统自动处理:

  • 🏷️ GitHub发布更新日志内容
  • 📦 NPM包发布
  • 🐳 多平台Docker镜像
  • 📚 文档更新

看 自动发布指南 了解完整细节。

👏 致谢

  • n8n 工作流自动化平台团队
  • Anthropic 对于模型上下文协议
  • 本项目的所有贡献者和用户

模板归因

此项目中的所有工作流模板都是从n8n的公共模板库中获取的,网址为 n8n.io/工作流每个模板包括:

  • 完全归属于原始创建者(姓名和用户名)
  • 直接链接到n8n.io上的源模板
  • 原始工作流ID供参考

本项目中的AI代理说明包含强制性归因要求。使用任何模板时,AI将自动:

  • 共享模板作者的姓名和用户名
  • 提供n8n.io上原始模板的直接链接
  • 以以下格式显示归因:“此工作流基于模板 作者 (@[用户名])。查看原件:[url]“

模板创建者保留对其工作流的所有权利。该项目对模板进行索引,以通过AI助手提高可发现性。如果您是模板创建者,并且担心您的模板被索引,请打开一个问题。

特别感谢多产的模板贡献者,他们的工作帮助数千名用户自动化了他们的工作流程,包括: 大卫·阿什比 (@cfomodz), Yaron已经 (@yaron nofuff), 吉姆白血病 (@jimello), 达维德 (@n3witalia), 大卫·奥卢索拉 (@dae221), Ranjan Dailata (@ranjancse), Airtop (@cesar at airtop), 约瑟夫·勒佩奇 (@joe), 小唐Jayamaha (@don宝石商), 安吉尔·梅内德斯 (@djangelic),以及整个n8n创作者社区!


Built with ❤️ for the n8n community
Making AI + n8n workflow creation delightful