使用说明
n8n顾问
用于n8n工作流管理的MCP服务器。为AI助手提供在n8n实例中查看工作流状态的能力。
特性
- 检查工作流:审查所有工作流并报告其状态,包括活动/非活动计数和最近出现错误的工作流。
安装
pip install m2ai-mcp-n8n-advisor
配置
创建一个 .env 文件或设置环境变量:
# Base URL of your n8n instance (no trailing slash)
N8N_BASE_URL=https://your-n8n-instance.app.n8n.cloud
# API key from n8n Settings > API
N8N_API_KEY=your_api_key_here
获取n8n API密钥
- 打开n8n实例
- 首选 设置 > API
- 创建新的API密钥或复制现有密钥
- 使用n8n实例的完整URL
N8N_BASE_URL
用法
Claude桌面配置
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"n8n": {
"command": "n8n-advisor",
"env": {
"N8N_BASE_URL": "https://your-n8n-instance.app.n8n.cloud",
"N8N_API_KEY": "your_api_key_here"
}
}
}
}
或者直接用Python运行:
{
"mcpServers": {
"n8n": {
"command": "python",
"args": ["-m", "n8n_mcp.server"],
"env": {
"N8N_BASE_URL": "https://your-n8n-instance.app.n8n.cloud",
"N8N_API_KEY": "your_api_key_here"
}
}
}
}
可用工具
检查工作流
查看所有工作流并报告其状态。
参数:无
退货:
total_workflows:工作流总数active_workflows:活动工作流的数量inactive_workflows:非活动工作流的数量workflows_with_errors:最近发生错误的工作流计数error_workflows:有错误的工作流列表(id、名称、错误计数)workflows:包含执行统计信息的所有工作流的详细列表
示例响应:
{
"total_workflows": 5,
"active_workflows": 3,
"inactive_workflows": 2,
"workflows_with_errors": 1,
"error_workflows": [
{"id": "2", "name": "Data Sync", "errors": 3}
],
"workflows": [
{
"id": "1",
"name": "Email Notifications",
"active": true,
"recent_executions": {
"success": 10,
"error": 0,
"waiting": 0,
"running": 0
}
}
]
}
发展
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=n8n_mcp
# Type checking
mypy src/
# Linting
ruff check src/
许可证
麻省理工学院