feat(mcp): add HTTP mode for remote Agent access (Hermes/OpenClaw URL support)
Build and Deploy / build-and-push (push) Successful in 52s
Build and Deploy / build-and-push (push) Successful in 52s
This commit is contained in:
+44
-3
@@ -12,7 +12,16 @@ TaskPool 提供官方 **MCP Server**,让 Hermes、OpenClaw、Cursor 等 AI Age
|
||||
2. 系统设置 → **启用 OpenAPI** → **生成 Token**
|
||||
3. 本机或 Agent 环境能访问面板地址(如 `http://127.0.0.1:8052`)
|
||||
|
||||
## 启动
|
||||
## 两种传输模式
|
||||
|
||||
| 模式 | 传输方式 | 适用场景 | Agent 配置 |
|
||||
|------|----------|----------|------------|
|
||||
| **stdio** | stdin/stdout | 本地 Agent(Claude Desktop、Cursor) | `command` |
|
||||
| **http** | HTTP/SSE | 远程 Agent(Hermes、OpenClaw) | `url` |
|
||||
|
||||
### stdio 模式(默认)
|
||||
|
||||
由 Agent 拉起子进程,通过标准输入输出通信。日志输出在 **stderr**,不会污染协议。
|
||||
|
||||
```bash
|
||||
export TASKPOOL_URL=http://127.0.0.1:8052
|
||||
@@ -20,9 +29,29 @@ export TASKPOOL_TOKEN=你的OpenAPI_Token
|
||||
taskpool mcp
|
||||
```
|
||||
|
||||
仅 stdio 传输:由 Agent 拉起子进程,通过标准输入输出通信。日志输出在 **stderr**,不会污染协议。
|
||||
### HTTP 模式
|
||||
|
||||
## Hermes / OpenClaw 配置
|
||||
独立 HTTP 服务,Agent 通过 URL 访问,无需本地安装二进制。
|
||||
|
||||
```bash
|
||||
# 监听默认端口 :8053
|
||||
taskpool mcp --http
|
||||
|
||||
# 指定端口
|
||||
taskpool mcp --http :9000
|
||||
|
||||
# 或通过环境变量
|
||||
export MCP_HTTP_ADDR=:8053
|
||||
taskpool mcp --http
|
||||
```
|
||||
|
||||
HTTP 模式暴露端点:
|
||||
- `POST /mcp` - MCP 协议端点
|
||||
- `GET /health` - 健康检查
|
||||
|
||||
## Agent 配置示例
|
||||
|
||||
### stdio 模式(Claude Desktop / Cursor)
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -52,6 +81,18 @@ taskpool mcp
|
||||
}
|
||||
```
|
||||
|
||||
### HTTP 模式(Hermes / OpenClaw)
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"taskpool": {
|
||||
"url": "http://your-server:8053/mcp"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Docker 部署时,把 `TASKPOOL_URL` 写成 Agent 能访问的地址(宿主机映射端口或内网域名)。
|
||||
|
||||
## 工具清单(Tools)
|
||||
|
||||
Reference in New Issue
Block a user