本演示展示了如何通过运行在Kubernetes中的agentgateway(作为数据平面)将n8n连接到MCP(模型上下文协议)服务器。kgateway作为控制平面。
n8n → agentgateway (K8s 数据平面) → MCP 服务器 (网站抓取器)
↑
kgateway (控制平面)
k8s/agentgateway/install.md 中的配置k8s/mcp-server/mcp-server.md 中的配置k8s/n8n/n8n-deployment.yaml 中的配置kubectl port-forward -n n8n svc/n8n 5678:5678
adminadminmcp-demo-workflow.json文件
以下设置应被设定:
POST8080。例如:http://135.23.125.225:8080/名称: Accept
值: application/json, text/event-stream
名称: Content-Type
值: application/json
{
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {
"name": "test-client",
"version": "1.0.0"
}
},
"id": 1
}
你应该会看到类似以下的输出

.
├── README.md
├── k8s/
│ ├── agentgateway/ # agentgateway安装说明
│ │ └── install.md # Helm安装命令
│ ├── mcp-server/ # MCP服务器部署
│ │ └── mcp-server.md # 完整的MCP设置(部署、服务、网关、后端、路由)
│ └── n8n/ # n8n部署
│ └── n8n-deployment.yaml
└── n8n/
└── workflows/ # 示例n8n工作流
└── mcp-demo-workflow.json
该演示使用了Kubernetes Gateway API模式:
资源关系:
Gateway (agentgateway)
↓ parentRef
HTTPRoute (mcp-route)
↓ backendRef
Backend (mcp-backend)
↓ target
Service (mcp-website-fetcher)