n8n节点文档协议服务器

n8n-MCP是一个为AI助手提供全面访问n8n节点文档、属性和操作的协议服务器,可快速部署以增强AI对543个n8n工作流自动化节点的理解。

  • by dkaptsov
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 dkaptsov/n8n-mcp

使用说明

n8n MCP

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

概述

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

  • 📚 543个n8n节点 从n8n节点基和@n8n/n8n节点langchain
  • 🔧 节点属性 -99%的覆盖率包含详细的模式
  • ⚡ 节点操作 -63.6%的可用行动覆盖率
  • 📄 文档 -87%的覆盖率来自官方n8n文档(包括AI节点)
  • 🤖 AI工具 -检测到271个具有AI功能的节点,并附有完整文档
  • 💡 真实世界的例子 -2646个从流行模板中预提取的配置
  • 🎯 模板库 -2709个元数据覆盖率为100%的工作流模板

⚠️ 重要安全警告

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

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

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

🚀 快速开始

让n8n MCP在5分钟内运行:

选项1:npx(最快-无需安装!)🚀

先决条件: 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 -就是这样! 🎉

选项2: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"

内存泄漏修复(v2.20.2)

第330期 在长时间运行的Docker/Kubernetes部署中发现了一个关键的内存泄漏:

  • 之前: 100 MB→ 2.2 GB超过72小时(OOM致死)
  • 之后: 无限期稳定在100-200MB

应用的修复:

  • ✅ Docker镜像现在默认使用better-xglite3(完全消除泄漏)
  • ✅ sql.js回退优化(保存频率降低98%)
  • ✅ 删除了不必要的内存分配(每次保存减少50%)
  • ✅ 可通过以下方式配置保存间隔 SQLJS_SAVE_INTERVAL_MS

对于具有内存限制的Kubernetes部署:

resources:
  requests:
    memory: 256Mi
  limits:
    memory: 512Mi

💖 支持这个项目

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

您的赞助帮助我:

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

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


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

先决条件: 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。

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

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

将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集成的完整指南。

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

通过教授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_essentials 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_minimal → validate_node_operation → 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_by_metadata({complexity: "simple"})` - Smart filtering
   - `get_templates_for_task('webhook_processing')` - Curated by task
   - `search_templates('slack notification')` - Text search
   - `list_node_templates(['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
   - `list_nodes({category: 'trigger'})` - Browse by category
   - `list_ai_tools()` - AI-capable nodes

4. **Configuration Phase** (parallel for multiple nodes)
   - `get_node_essentials(nodeType, {includeExamples: true})` - 10-20 key properties
   - `search_node_properties(nodeType, 'auth')` - Find specific properties
   - `get_node_documentation(nodeType)` - Human-readable docs
   - Show workflow architecture to user for approval before proceeding

5. **Validation Phase** (parallel for multiple nodes)
   - `validate_node_minimal(nodeType, config)` - Quick required fields check
   - `validate_node_operation(nodeType, config, '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_trigger_webhook_workflow()` - Test webhooks

## 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_essentials` + `validate_node_minimal`

## Validation Strategy

### Level 1 - Quick Check (before building)
`validate_node_minimal(nodeType, config)` - Required fields only (<100ms)

### Level 2 - Comprehensive (before building)
`validate_node_operation(nodeType, config, '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_list_executions()` - 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_by_metadata({
  requiredService: 'slack',
  complexity: 'simple',
  targetAudience: 'marketers'
})
get_templates_for_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})
list_nodes({category: 'communication'})

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

// STEP 3: Validation (parallel execution)
[Silent execution]
validate_node_minimal('n8n-nodes-base.slack', config)
validate_node_operation('n8n-nodes-base.slack', fullConfig, '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_essentials):

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_essentials() 并获得我所需要的东西——不是100KB的JSON转储,而是真正重要的5-10个属性。45分钟的时间现在只需要3分钟。"

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

阅读完整采访→

📡 可用的MCP工具

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

核心工具

  • tools_documentation -获取任何MCP工具的文档(从这里开始!)
  • list_nodes -列出所有具有筛选选项的n8n节点
  • get_node_info -获取特定节点的全面信息
  • get_node_essentials -只获取基本属性(10-20而不是200+)。使用 includeExamples: true 从流行模板中获取前3个真实配置
  • search_nodes -在所有节点文档中进行全文搜索。使用 includeExamples: true 从模板中获取每个节点的前2个真实配置
  • search_node_properties -在节点中查找特定属性
  • list_ai_tools -列出所有支持AI的节点(任何节点都可以用作AI工具!)
  • get_node_as_tool_info -获取将任何节点用作AI工具的指导

模板工具

  • list_templates -浏览所有带有描述和可选元数据的模板(2709个模板)
  • search_templates -跨模板名称和描述进行文本搜索
  • search_templates_by_metadata -按复杂性、设置时间、服务、受众进行高级过滤
  • list_node_templates -使用特定节点查找模板
  • get_template -获取完整的JSON工作流以供导入
  • get_templates_for_task -为常见自动化任务精心设计的模板

验证工具

  • validate_workflow -完整的工作流程验证,包括 AI代理验证 (v2.17.0新增功能!)
    • 检测缺失的语言模型连接
    • 验证AI工具连接(无错误警告)
    • 强制流模式约束
    • 检查内存和输出解析器配置
  • validate_workflow_connections -检查工作流结构和AI工具连接
  • validate_workflow_expressions -验证n8n个表达式,包括$fromAI()
  • validate_node_operation -验证节点配置(操作感知,配置文件支持)
  • validate_node_minimal -仅对必填字段进行快速验证

高级工具

  • get_property_dependencies -分析物业可见性条件
  • get_node_documentation -从n8n文档中获取解析后的文档
  • get_database_statistics -查看数据库指标和覆盖率

n8n管理工具(可选-需要API配置)

这些强大的工具允许您直接从Claude管理n8n工作流。它们仅在您提供时可用 N8N_API_URL 和 N8N_API_KEY 在您的配置中。

工作流管理

  • n8n_create_workflow -使用节点和连接创建新的工作流
  • n8n_get_workflow -按ID获取完整的工作流程
  • n8n_get_workflow_details -使用执行统计信息获取工作流
  • n8n_get_workflow_structure -获得简化的工作流程结构
  • n8n_get_workflow_minimal -获取最少的工作流信息(ID、名称、活动状态)
  • n8n_update_full_workflow -更新整个工作流程(完全替换)
  • n8n_update_partial_workflow -使用diff操作更新工作流(v2.7.0中的新功能!)
  • n8n_delete_workflow -永久删除工作流
  • n8n_list_workflows -列出具有过滤和分页功能的工作流
  • n8n_validate_workflow -通过ID验证n8n中已有的工作流(v2.6.3中的新功能)
  • n8n_autofix_workflow -自动修复常见的工作流错误(v2.13.0中的新功能!)
  • n8n_workflow_versions -管理工作流版本历史记录和回滚(v2.22.0中的新功能!)

执行管理

  • n8n_trigger_webhook_workflow -通过webhook URL触发工作流
  • n8n_get_execution -按ID获取执行详细信息
  • n8n_list_executions -列出执行情况并进行状态筛选
  • n8n_delete_execution -删除执行记录

系统工具

  • n8n_health_check -检查n8n API连接和功能
  • n8n_diagnostic -解决管理工具可见性和配置问题
  • n8n_list_available_tools -列出所有可用的管理工具

示例用法

// Get essentials with real-world examples from templates
get_node_essentials({
  nodeType: "nodes-base.httpRequest",
  includeExamples: true  // Returns top 3 configs from popular templates
})

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

// Validate before deployment
validate_node_operation({
  nodeType: "nodes-base.httpRequest",
  config: { method: "POST", url: "..." },
  profile: "runtime" // or "minimal", "ai-friendly", "strict"
})

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

💻 地方发展设置

对于贡献者和高级用户:

先决条件:

  • 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 v1.117.2):

  • ✅ 541/541 节点已加载(100%)
  • ✅ 541 具有属性的节点(100%)
  • ✅ 470 有文档的节点(87%)
  • ✅ 271 检测到具有AI功能的工具
  • ✅ 2,646 预提取的模板配置
  • ✅ 2,709 工作流模板可用(元数据覆盖率100%)
  • ✅ AI Agent和LangChain节点 完整记录
  • ⚡ 平均响应时间:~12毫秒
  • 💾 数据库大小:~68MB(包括带有元数据的模板)

🔄 最近的更新

v2.22.19-关键错误修复

固定的: 会话删除中的堆栈溢出(问题#427)

  • 消除了HTTP服务器会话清理中的无限递归
  • 关闭前删除传输资源,以防止循环事件处理程序链
  • 生产日志不再显示“RangeError:超过最大调用堆栈大小”
  • 所有会话清理操作现在都已成功完成,没有崩溃

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

⚠️ 已知问题

Claude桌面容器管理

容器累积(v2.7.20+中已修复)

以前的版本存在一个问题,即当Claude Desktop会话结束时,容器无法正确清理。此问题已在v2.7.20+中通过适当的信号处理得到修复。

为了实现最佳的容器生命周期管理:

  1. 使用--init标志 (推荐)-Docker的init系统可确保正确的信号处理:
{
  "mcpServers": {
    "n8n-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "--init",
        "ghcr.io/czlonkowski/n8n-mcp:latest"
      ]
    }
  }
}
  1. 确保您使用的是v2.7.20或更高版本 -检查您的版本:
docker run --rm ghcr.io/czlonkowski/n8n-mcp:latest --version

🧪 测试

该项目包括一个全面的测试套件 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