部署:video_gen 双监听(全量 3000 内网 / 只读 3001 公网供中转),mcp 默认不占宿主机端口
- video_gen: UPLOAD_BASE_URL(AI 上传,内网)与 PUBLIC_BASE_URL(智谱下载,公网)拆开配置; 新增 PUBLIC_PORT 公网只读监听,只挂 GET /uploads/*(无 /mcp、无 POST /upload) - video_gen: 上传目录落到宿主 ./uploads(重启不让已发出的 URL 失效),Dockerfile EXPOSE 3000 3001 - docker-compose: 三个服务默认都不映射宿主机端口(调试用的 ports 注释保留); video_gen 配 UPLOAD_BASE_URL/PUBLIC_BASE_URL/PUBLIC_PORT/UPLOAD_DIR + ./uploads 挂载 - .gitignore(新): node_modules/ 与 uploads/ - 文档: 根 README 说明「只开 agent 端口」与图片到智谱的完整链路;三个子 README 同步端口与调试方式
This commit is contained in:
@@ -21,14 +21,13 @@ cd /root/workspace/tools/mcp
|
||||
docker compose up -d --build mcp_image_gen
|
||||
```
|
||||
|
||||
服务容器名 `mcp_image_gen`,容器内端口 3000,默认映射到宿主机 8082,即 `http://<服务器IP>:8082/mcp`。
|
||||
|
||||
直接连容器调试:
|
||||
服务容器名 `mcp_image_gen`,容器内端口 3000,**默认不占宿主端口**:agent 走 `my-app-network`
|
||||
按容器名访问(`http://mcp_image_gen:3000/mcp`)。需要从宿主机 curl 调试时,去仓库根
|
||||
`docker-compose.yml` 把 `mcp_image_gen` 注释掉的 `ports` 两行打开(默认写的是 8082),调试完记得注释回去。
|
||||
|
||||
```bash
|
||||
docker exec -it mcp_image_gen sh
|
||||
# 或本机(宿主机映射端口)
|
||||
curl http://localhost:8082/health
|
||||
# 不占端口的健康检查
|
||||
docker exec mcp_image_gen node -e "fetch('http://localhost:3000/health').then(r=>r.text()).then(console.log)"
|
||||
# {"status":"ok","service":"image_gen","sessions":0}
|
||||
```
|
||||
|
||||
@@ -42,7 +41,7 @@ curl http://localhost:8082/health
|
||||
{
|
||||
"mcpServers": {
|
||||
"image_gen": {
|
||||
"url": "http://<服务器IP>:8082/mcp",
|
||||
"url": "http://localhost:8082/mcp",
|
||||
"headers": {
|
||||
"Authorization": "Bearer <your-zhipu-api-key>"
|
||||
}
|
||||
@@ -51,6 +50,8 @@ curl http://localhost:8082/health
|
||||
}
|
||||
```
|
||||
|
||||
> 上面 `url` 里的端口 `8082` 需要先把 compose 里注释的 `ports` 打开(默认不占宿主端口)。
|
||||
|
||||
> **重要**:客户端必须在 **每一个 HTTP 请求**(`initialize` / `notifications/initialized` / `tools/call`)都带上 `Authorization` header。配置在 `headers` 里、由客户端自动重发即可。直连模式下 token 不在 session 间共享。
|
||||
|
||||
#### 不支持 `headers` 字段的客户端
|
||||
|
||||
Reference in New Issue
Block a user