MCP n8n API服务器
一个mcp服务器,通过模型上下文协议(mcp)提供与n8n工作流交互的接口。
特性
- 列出所有n8n工作流
- 使用自定义数据触发特定工作流
- 与Claude Desktop和其他MCP客户端集成
安装
全局安装(建议远程使用)
npm install -g @ahmad.soliman/mcp-n8n-server然后配置n8n连接:
- 创建一个
.env工作目录中的文件 - 添加n8n API信息(请参阅下面的配置部分)
与npx一起使用(无需安装)
您可以直接使用npx运行服务器:
npx -y @ahmad.soliman/mcp-n8n-server本地安装
git clone https://github.com/ahmadsoliman/mcp-n8n-server.git
cd mcp-n8n-server
npm install配置
创建一个 .env 包含以下变量的文件:
# n8n Host URL (required)
N8N_HOST_URL=https://your-n8n-instance.com
# n8n Project ID (optional - only needed for cloud instances)
PROJECT_ID=your_project_id_here
# n8n API Key (required)
N8N_API_KEY=your_api_key_here用法
作为远程MCP服务器
全局安装后,您可以将其用作Claude AI的远程MCP服务器:
- 使用以下JSON配置将Claude AI配置为将其用作远程MCP服务器:
{
"mcpServers": {
"n8n": {
"command": "npx",
"args": ["-y", "@ahmad.soliman/mcp-n8n-server"],
"env": {
"N8N_HOST_URL": "",
"PROJECT_ID": "",
"N8N_API_KEY": ""
}
}
}
}- 在给克劳德的提示或指示中添加以下内容:
You have access to a remote MCP server for n8n integration. Use it to:
- List all n8n workflows
- Trigger webhooks and workflows
- Get information about available webhooks作为本地MCP服务器
您可以在本地运行服务器并从Claude Desktop连接到它:
# Start the server
npm start然后配置Claude Desktop以使用此MCP服务器:
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"n8n": {
"command": "npx",
"args": ["-y", "@ahmad.soliman/mcp-n8n-server"],
"env": {
"N8N_HOST_URL": "",
"PROJECT_ID": "",
"N8N_API_KEY": ""
}
}
}
}或者,如果您已在本地克隆了存储库:
{
"mcpServers": {
"n8n-server": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/server-n8n/build/index.js"]
}
}
}设置
- 安装依赖项:
npm install- 配置环境变量:
- 复制
.env.example向.env(如果尚未完成) - 更新以下变量
.env:
- N8N_API_URL:您的n8n实例URL(默认值:http://localhost:5678) - N8N_API_KEY:n8n API密钥
- 启动服务器:
# Start the MCP server (for integration with Claude Desktop and other MCP clients)
npm run mcp对于自动重新加载的开发:
npm run devMCP工具(用于LLM集成)
MCP服务器提供以下工具,供Claude Desktop或其他MCP客户端使用:
列出工作流
这 list-workflows 该工具返回所有可用n8n工作流的列表。
列出工作流Webhooks
这 list-workflow-webhooks 该工具返回特定工作流中的所有webhook。
参数:
id:从中获取webhooks的工作流的ID
调用Webhook(GET)
这 call-webhook-get 该工具允许通过GET请求调用webhook。
参数:
url:要调用的webhook URL
呼叫 Webhook(POST)
这 call-webhook-post 该工具允许通过POST请求调用webhook。
参数:
url:要调用的webhook URLdata:POST请求正文中要发送的数据

