first build nexus
This commit is contained in:
204
Technical/Workflow/使用Claude自动生成N8N工作流的实操教程.md
Normal file
204
Technical/Workflow/使用Claude自动生成N8N工作流的实操教程.md
Normal file
@@ -0,0 +1,204 @@
|
||||
|
||||
```table-of-contents
|
||||
```
|
||||
# 标题:使用Claude自动生成N8N工作流的实操教程
|
||||
|
||||
## 概述📚
|
||||
本视频主要介绍如何借助AI助手Claude自动创建n8n工作流,解决新手在架构设计和节点选择中遇到的困惑。作者从零开始手把手演示环境搭建、配置连接、输入提示词,让Claude根据指令自动为我们完成复杂的工作流设计和代码生成,极大提高制作效率。视频内容通俗易懂,重点突出自动化流程创建的实用技巧,适合无编码基础的N8N初学者。
|
||||
|
||||
## Youtube
|
||||
https://www.youtube.com/watch?v=AosTiLQaZc4
|
||||
|
||||
## 核心知识点总结⏰
|
||||
|
||||
### n8n工作流创建难点及Claude介入**
|
||||
新手在建立N8N工作流时常常无从下手,不晓得节点使用和架构设计。作者介绍了一个开源的N8N MCP(多功能控制面板)项目,可嫁接到Claude,通过输入自然语言提示直接生成工作流,免去繁琐操作。
|
||||
|
||||
### n8n-mcp 项目
|
||||
https://github.com/czlonkowski/n8n-mcp
|
||||
n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to:
|
||||
|
||||
- 📚 **543 n8n nodes** from both n8n-nodes-base and @n8n/n8n-nodes-langchain
|
||||
- 🔧 **Node properties** - 99% coverage with detailed schemas
|
||||
- ⚡ **Node operations** - 63.6% coverage of available actions
|
||||
- 📄 **Documentation** - 87% coverage from official n8n docs (including AI nodes)
|
||||
- 🤖 **AI tools** - 271 AI-capable nodes detected with full documentation
|
||||
- 💡 **Real-world examples** - 2,646 pre-extracted configurations from popular templates
|
||||
- 🎯 **Template library** - 2,709 workflow templates with 100% metadata coverage
|
||||
|
||||
### 环境搭建:Node.js安装与启动n8n-mcp**
|
||||
演示如何下载Node.js安装包(根据操作系统选择),并在Windows的Terminal中运行命令完成安装,确保环境支持后续工作流自动化操作。
|
||||
#### 安装node.js
|
||||
https://nodejs.org/en/download
|
||||
|
||||
``` shell
|
||||
# Docker has specific installation instructions for each operating system.
|
||||
# Please refer to the official documentation at https://docker.com/get-started/
|
||||
|
||||
# Pull the Node.js Docker image:
|
||||
docker pull node:24-alpine
|
||||
|
||||
# Create a Node.js container and start a Shell session:
|
||||
docker run -it --rm --entrypoint sh node:24-alpine
|
||||
|
||||
# Verify the Node.js version:
|
||||
node -v # Should print "v24.12.0".
|
||||
|
||||
# Verify npm version:
|
||||
npm -v # Should print "11.6.2".
|
||||
|
||||
```
|
||||
|
||||
#### 启动n8n-mcp
|
||||
|
||||
在之前node.js的terminal里直接输入以下命令
|
||||
|
||||
``` shell
|
||||
# Run directly with npx (no installation needed!)
|
||||
npx n8n-mcp
|
||||
```
|
||||
|
||||
看到以下log,说明安装成功:
|
||||
```
|
||||
/ # npx n8n-mcp
|
||||
Need to install the following packages:
|
||||
n8n-mcp@2.31.3
|
||||
Ok to proceed? (y) y
|
||||
|
||||
|
||||
╔════════════════════════════════════════════════════════════╗
|
||||
║ Anonymous Usage Statistics ║
|
||||
╠════════════════════════════════════════════════════════════╣
|
||||
║ ║
|
||||
║ n8n-mcp collects anonymous usage data to improve the ║
|
||||
║ tool and understand how it's being used. ║
|
||||
║ ║
|
||||
║ We track: ║
|
||||
║ • Which MCP tools are used (no parameters) ║
|
||||
║ • Workflow structures (sanitized, no sensitive data) ║
|
||||
║ • Error patterns (hashed, no details) ║
|
||||
║ • Performance metrics (timing, success rates) ║
|
||||
║ ║
|
||||
║ We NEVER collect: ║
|
||||
║ • URLs, API keys, or credentials ║
|
||||
║ • Workflow content or actual data ║
|
||||
║ • Personal or identifiable information ║
|
||||
║ • n8n instance details or locations ║
|
||||
║ ║
|
||||
║ Your anonymous ID: 17c0ba5830754999 ║
|
||||
║ ║
|
||||
║ This helps me understand usage patterns and improve ║
|
||||
║ n8n-mcp for everyone. Thank you for your support! ║
|
||||
║ ║
|
||||
║ To opt-out at any time: ║
|
||||
║ npx n8n-mcp telemetry disable ║
|
||||
║ ║
|
||||
║ Data deletion requests: ║
|
||||
║ Email romuald@n8n-mcp.com with your anonymous ID ║
|
||||
║ ║
|
||||
║ Learn more: ║
|
||||
║ https://github.com/czlonkowski/n8n-mcp/blob/main/PRIVACY.md ║
|
||||
║ ║
|
||||
╚════════════════════════════════════════════════════════════╝
|
||||
|
||||
[2025-12-31T05:40:02.650Z] [n8n-mcp] [INFO] Node.js version: v24.12.0
|
||||
[2025-12-31T05:40:02.650Z] [n8n-mcp] [INFO] Platform: linux x64
|
||||
[2025-12-31T05:40:02.650Z] [n8n-mcp] [INFO] Attempting to use better-sqlite3...
|
||||
[2025-12-31T05:40:02.651Z] [n8n-mcp] [INFO] Initializing n8n Documentation MCP server
|
||||
[2025-12-31T05:40:02.652Z] [n8n-mcp] [WARN] Failed to initialize better-sqlite3, falling back to sql.js Error: Failed to create better-sqlite3 adapter: Error: Cannot find module 'better-sqlite3'
|
||||
Require stack:
|
||||
- /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/database/database-adapter.js
|
||||
- /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/server.js
|
||||
- /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/index.js
|
||||
at createBetterSQLiteAdapter (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/database/database-adapter.js:96:15)
|
||||
at createDatabaseAdapter (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/database/database-adapter.js:55:31)
|
||||
at N8NDocumentationMCPServer.initializeDatabase (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/server.js:180:74)
|
||||
at new N8NDocumentationMCPServer (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/server.js:109:33)
|
||||
at main (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/index.js:143:32)
|
||||
at Object.<anonymous> (/root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/dist/mcp/index.js:217:5)
|
||||
at Module._compile (node:internal/modules/cjs/loader:1761:14)
|
||||
at Object..js (node:internal/modules/cjs/loader:1893:10)
|
||||
at Module.load (node:internal/modules/cjs/loader:1481:32)
|
||||
at Module._load (node:internal/modules/cjs/loader:1300:12)
|
||||
[2025-12-31T05:40:02.854Z] [n8n-mcp] [INFO] Loaded existing database from /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/data/nodes.db
|
||||
[2025-12-31T05:40:02.855Z] [n8n-mcp] [INFO] Successfully initialized sql.js adapter (pure JavaScript, no native dependencies)
|
||||
[2025-12-31T05:40:02.885Z] [n8n-mcp] [INFO] FTS5 not available, using LIKE search for templates
|
||||
[2025-12-31T05:40:02.886Z] [n8n-mcp] [INFO] Database initialized successfully from: /root/.npm/_npx/b6a381d62ce0fe56/node_modules/n8n-mcp/data/nodes.db
|
||||
[2025-12-31T05:40:02.887Z] [n8n-mcp] [INFO] MCP server initialized with 7 tools (n8n API: not configured)
|
||||
[2025-12-31T05:40:02.891Z] [n8n-mcp] [WARN] FTS5 not available - using fallback search. For better performance, ensure better-sqlite3 is properly installed.
|
||||
[2025-12-31T05:40:02.891Z] [n8n-mcp] [INFO] Database health check passed: 802 nodes loaded
|
||||
[2025-12-31T05:40:02.892Z] [n8n-mcp] [INFO] n8n Documentation MCP Server running on stdio transport
|
||||
[2025-12-31T05:40:02.892Z] [n8n-mcp] [INFO] Server startup completed in 246ms (6 checkpoints passed)
|
||||
```
|
||||
|
||||
#### Claude客户端下载安装及开发者配置**
|
||||
指导下载安装Claude桌面版,进入“Developer”设置页编辑配置文件,将N8N服务地址和API密钥填入,确保Claude连接N8N MCP功能正常。
|
||||
[[🟠如何用指纹浏览器安全注册并订阅Claude Pro会员全攻略]]
|
||||
#### 高级prompt配置与项目初始化**
|
||||
介绍用于指导Claude理解N8N所有功能的复杂prompt,粘贴到Claude项目的指令区,激活39个集成工具,丰富Claude的工作流构建能力。
|
||||
|
||||
#### 优化Claude设置及自动生成实际案例演示**
|
||||
调整模型为Opensea、开启extended thinking,尝试命令让Claude创建定时爬取新闻、更新到Google表格的N8N工作流。Claude自动选节点、写代码实现工作流逻辑。
|
||||
|
||||
#### 运行结果调试及问题反馈**
|
||||
实际运行中出现节点无输出错误,反馈给Claude让其检查API问题并修复流程。演示如何通过迭代让Claude改进脚本,节省手工调试成本。
|
||||
|
||||
#### Claude自动生成工作流优缺点分析**
|
||||
Claude能实现约80%-90%正确的工作流布局和逻辑,尽管有细节错误仍需人工二次修正,但对新手尤其友好,显著降低学习门槛和工作时间。未来随着AI模型迭代,期待更完善的自动化解决方案。
|
||||
|
||||
|
||||
## 重要术语与定义📖
|
||||
|
||||
- **N8N**:一款开源的工作流自动化工具,支持节点连接执行任务。
|
||||
- **工作流(Workflow)**:由多个任务节点按照一定顺序执行的自动化流程。
|
||||
- **节点(Node)**:工作流中的单个操作单元,如触发器、数据处理、API调用等。
|
||||
- **Claude**:基于人工智能的助手工具,可读取指令并自动生成代码或工作流。
|
||||
- **MCP**:此处指代N8N的功能扩展模块,允许外部工具调用其所有节点功能。
|
||||
- **Prompt**:向AI模型输入的描述性文本,用以引导其执行特定任务。
|
||||
- **API Key**:用于认证访问服务的密钥,保证接口调用的安全。
|
||||
- **extended thinking**:Claude的一种运行模式,支持更深层次逻辑推理。
|
||||
- **Opensea模型**:为代码生成优化的Claude子模型,适合自动编程任务。
|
||||
|
||||
## 推理结构🧩
|
||||
|
||||
1. **提出难题**:新手不知如何设计和搭建N8N工作流架构 →
|
||||
2. **引入方案**:利用Claude与N8N MCP结合,输入自然语言创建工作流 →
|
||||
3. **搭建环境**:安装Node.js、下载Claude桌面端,配置API连接 →
|
||||
4. **激活功能**:导入高级prompt学习全部N8N节点功能 →
|
||||
5. **执行任务**:Claude根据提示自动寻找节点并编码,生成工作流 →
|
||||
6. **反馈修正**:发现错误交由Claude检查修复代码 →
|
||||
7. **总结成效**:Claude可完成大部分工作流规划,减轻人力负担,未来发展空间大。
|
||||
|
||||
## 实例讲解🛠️
|
||||
|
||||
- **新闻爬取上传Google表格案例**
|
||||
指令:每小时爬取最新新闻,更新至Google表格。Claude查找爬取节点、设置触发器、写入Google Sheets节点,无需用户编码。此示例充分展示了Claude智能串联节点、实现自动化流程的能力,并帮助用户解决了选节点和写代码的难题。
|
||||
|
||||
## 容易出错点⚠️
|
||||
|
||||
- **环境安装步骤遗漏**:未正确安装Node.js会导致后续命令无法执行,确保版本号显示正确。
|
||||
- **API Key配置错误**:API Key格式或权限错误会导致Claude无法连接N8N服务器,需在N8N后台正确生成并复制。
|
||||
- **第一次运行弹窗授权忽视**:首次运行需确认弹窗授权,否则功能不全。
|
||||
- **自动生成工作流的不完美**:Claude生成的脚本约有10%-20%的错误率,需用户反复修正。误以为可“一劳永逸”是误区。
|
||||
- **模型选择失误**:没有切换到Opensea模型时,代码生成效果差强人意。
|
||||
|
||||
## 快速复习提示/自测题📝
|
||||
|
||||
**提示(无答案)**
|
||||
- Claude是如何帮助自动创建N8N工作流的?
|
||||
- 设置Claude连接N8N需要填写哪些关键配置数据?
|
||||
- 为什么要选择Opensea模型和开启extended thinking模式?
|
||||
- 遇到工作流节点无输出时应该如何排查处理?
|
||||
|
||||
**练习(含答案)**
|
||||
1. N8N MCP是什么?
|
||||
答:N8N的多功能控制面板,可以让外部工具(如Claude)调用N8N所有节点,实现自动工作流创建。
|
||||
2. 配置Claude连接N8N时,需要从N8N后台获取哪两个关键参数?
|
||||
答:N8N服务器地址和API Key。
|
||||
3. Claude生成的自动化工作流大概能达到的完成度是多少?
|
||||
答:约80%-90%,部分细节仍需人工调整。
|
||||
4. 新手如何使用Claude减少N8N编程难度?
|
||||
答:直接输入自然语言需求,让Claude自动设计工作流和编写代码,避免自行搭建节点和写复杂代码。
|
||||
|
||||
## 总结与回顾🔍
|
||||
本视频系统地介绍了利用Claude智能助手自动生成N8N工作流的完整流程,从环境搭建、关键配置到提示词导入、实际任务执行和调试改进。通过此方法,特别是缺乏编程基础的新手能快速搭建功能复杂的自动化流程,大幅提升效率。尽管现阶段自动化结果还不完美,仍需反复迭代,但整体架构合理、逻辑清晰,展现了AI辅助工作流创建的巨大潜力。未来随着大模型的进步,这种流程自动化将越来越成熟,成为低代码甚至无代码开发的重要助力。
|
||||
Reference in New Issue
Block a user