本项目将 n8n工作流自动化 与 Claude代码 以及 模型上下文协议(MCP)服务器 进行全面集成,可用于智能项目管理、自动内存转储以及由人工智能驱动的开发工作流。
# 克隆或下载项目
git clone
cd my-project-n8n
# 安装依赖
npm install
# 运行设置脚本
./automation/windows-fix.sh # Windows用户
./setup-targets.sh # 设置目标目录
# 使用您的设置编辑.env文件
cp .env.example .env
nano .env
# 需要更新的关键设置:
# - N8N_API_KEY=your_api_key_here
# - N8N_BASIC_AUTH_PASSWORD=your_password
# - TARGET_PROJECT_DIR=/c/Workspace/MyProject
# 启动n8n
npm run start &
# 对Claude代码进行身份验证(一次性设置)
claude auth
claude --dangerously-skip-permissions
# 使用MCP启动Claude代码
claude
# 检查系统状态
npm run check:dumps
# 测试MCP服务器
claude "/mcp"
# 测试代码生成
claude "Create a simple README.md in the target directory"
# 添加任务并跟踪进度
claude "Add todo: Implement user authentication, high priority, due tomorrow"
claude "Update project status to development with 75% progress"
claude "Record decision: Use PostgreSQL for database with rationale: better performance for complex queries"
# 获取项目洞察
claude "Get project overview with details"
claude "What are my next recommended actions?"
claude "Show me all high priority pending tasks"
# 前端开发
claude "Create a React UserProfile component with TypeScript in the frontend directory"
claude "Generate a responsive dashboard layout in the frontend/src/pages directory"
# 后端开发
claude "Create Express API routes for user CRUD operations in the backend directory"
claude "Generate Mongoose models for User and Product in the backend/models directory"
# 全栈功能
claude "Create a complete authentication system with React frontend, Express backend, and shared TypeScript types"
# 工作流文档
claude "Show me available n8n nodes for HTTP requests"
claude "Create a workflow that triggers when a GitHub issue is created and sends a Slack notification"
# 工作流管理
claude "List all n8n workflows and their status"
claude "Export the user-registration workflow to the workflows directory"
# 手动转储
claude "Create memory dump with type full"
claude "Create daily summary with metrics and tomorrow's plan"
# 搜索和洞察
claude "Search memory for 'authentication' across all types"
claude "What decisions have we made about the database?"
claude "Show me recent learnings from the past week"
# 早上:检查项目状态
npm run check:dumps
claude "Get project overview and next actions"
# 开发:使用人工智能辅助
claude "Add todo: Implement password reset feature"
claude "Create React component for password reset form"
# 晚上:回顾和转储
claude "Update project status with today's progress"
npm run dump:daily
# 规划
claude "Add upcoming feature: Real-time notifications with medium priority"
claude "Break down the implementation steps for real-time notifications"
# 实现
claude "Create WebSocket server in backend for real-time features"
claude "Generate React hooks for WebSocket connection in frontend"
# 完成
claude "Complete task with notes: Real-time notifications implemented successfully"
claude "Record learning: WebSocket implementation requires careful connection management"
# 文档编写
claude "Create API documentation for the authentication endpoints"
claude "Generate team update report for the past sprint"
# 知识共享
claude "Record decision: Use Redis for session storage with rationale and alternatives"
claude "Export project report for stakeholder meeting"
http://localhost:5678/rest/ 访问。.env:环境变量和设置。.mcp.json:MCP服务器配置。package.json:依赖项和脚本。project-memory.json 中。memory-dumps/ 目录下的Markdown文件。backups/ 目录下的压缩JSON文件。logs/ 目录下的操作日志。workflows/ 目录下的n8n导出文件。.env)# 项目配置
PROJECT_NAME=My Awesome Project
PROJECT_VERSION=1.0.0
# n8n配置
N8N_HOST=http://localhost:5678
N8N_API_KEY=your_api_key_here
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=your_secure_password
# 代码生成目标
TARGET_PROJECT_DIR=/c/Workspace/MyProject
FRONTEND_DIR=/c/Workspace/MyProject/frontend
BACKEND_DIR=/c/Workspace/MyProject/backend
SHARED_DIR=/c/Workspace/MyProject/shared
# 内存和转储
MEMORY_FILE=./project-memory.json
DUMP_DIR=./memory-dumps
BACKUP_DIR=./backups
AUTO_DUMP=true
# 自动化
CRON_ENABLED=true
DAILY_DUMP_TIME=18:00
BACKUP_INTERVAL=4h
CLEANUP_DAYS=30
# 日志记录
LOG_LEVEL=info
LOG_FILE=./logs/project.log
.mcp.json){
"mcpServers": {
"memory-dump": {
"command": "node",
"args": ["./mcp-servers/memory-dump-server.js"],
"env": {
"MEMORY_FILE": "./project-memory.json",
"DUMP_DIR": "./memory-dumps",
"AUTO_DUMP": "true"
}
},
"filesystem-target": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "${TARGET_PROJECT_DIR}"],
"env": {}
},
"filesystem-current": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "./"],
"env": {}
}
}
}
# n8n管理
npm run start # 启动n8n服务器
npm run start:docker # 使用Docker启动
npm run stop:docker # 停止Docker容器
# Claude代码
npm run claude # 启动Claude代码
npm run test:mcp # 测试MCP服务器连接
# 内存和转储
npm run dump:manual # 创建手动内存转储
npm run dump:daily # 创建每日摘要
npm run dump:shutdown # 创建关机转储
# 系统管理
npm run check:dumps # 检查系统状态
npm run setup:cron # 设置自动化(Linux/Mac)
npm run change-target # 更改目标目录
npm run test:targets # 测试目标目录访问
# 日志
npm run logs:n8n # 查看n8n日志
npm run logs:project # 查看项目日志
# 检查MCP状态
claude "/mcp"
# 重启Claude代码
# 在项目目录中退出并重新启动
cd /path/to/project
claude
# 检查n8n是否正在运行
curl http://localhost:5678/rest/health
# 重启n8n
npm run start
# 修复脚本权限
chmod +x automation/*.sh
chmod +x mcp-servers/*.js
# 修复目录权限
chmod 755 memory-dumps backups logs
# 运行Windows修复脚本
./automation/windows-fix.sh
# 手动转换路径
# C:\Workspace\Project -> /c/Workspace/Project
# 系统检查
./automation/check-dumps.sh
# 查看日志
tail -f logs/project.log
tail -f logs/dump.log
# 测试单个组件
node mcp-servers/memory-dump-server.js
curl http://localhost:5678/rest/health
mcp-servers/ 目录中创建服务器。.mcp.json 中。automation/ 目录中添加脚本。package.json 脚本。本项目采用MIT许可证 - 有关详细信息,请参阅 LICENSE 文件。
npm run check:dumps 和调试脚本。logs/ 目录中的日志。报告问题时,请提供以下信息:
改进建议:
编码愉快!🚀
使用n8n、Claude代码和MCP精心打造 ❤️