feat: websearch MCP worker wiring + egress (public SearXNG route)
Worker --websearch-mcp (default off) seeds tenant codex-home with websearch MCP on _tenant_dirs (container path); old tenants merge on next task. Autoscaler unit gains the flag. Tinyproxy filter adds Perplexity/Exa/Tavily/Brave/DuckDuckGo + exact searx.diante.me (no diante.me wildcard, control plane stays out). Tests: test_websearch_worker 4 + websearch_mcp 12 + tenant 7 = 23 OK. Not pushed, not merged, not deployed; SearXNG host/DNS/nginx and tinyproxy reload are host steps.
This commit is contained in:
1 parent
075908fe58
commit
b72a2abae4
6 files changed
+209
-14
No files matched your search
+23
-12
@@ -73,20 +73,31 @@ Docker 租户必须传容器内路径
|
||||
`/var/lib/codex-app-server/codex-home/websearch_mcp.py`,
|
||||
因为该目录正是租户 codex-home 的容器内挂载点。
|
||||
|
||||
## 生产接线前必须另做的事(本批未做)
|
||||
## 生产接线(worker + egress + 自托管 SearXNG)
|
||||
|
||||
- worker 自动播种:目前播种助手已写好并有单测,但没有
|
||||
接进 worker 的派发路径,新项目不会自动获得搜索工具;
|
||||
老项目(config.toml 已存在且无该 section)需要一次
|
||||
配置合并,不能只改模板。
|
||||
- egress 白名单:Docker 任务走 tinyproxy,只放行中转、
|
||||
GitHub、PyPI、npmjs;搜索要通必须把以下域名加进
|
||||
`deploy/egress/tinyproxy-filter` 并重载 tinyproxy:
|
||||
`api.perplexity.ai`、`api.exa.ai`、`api.tavily.com`、
|
||||
`api.search.brave.com`、`html.duckduckgo.com`,以及你
|
||||
自己的 SearXNG 实例域名。未加之前,Docker 任务的搜索
|
||||
- worker 自动播种:`cloud/worker.py --websearch-mcp`(默认关)。
|
||||
开启后 `_tenant_dirs` 在播种 config.toml 之后调播种助手,
|
||||
写容器内路径 `/var/lib/codex-app-server/codex-home/websearch_mcp.py`。
|
||||
老租户下一次任务自动合并(`_tenant_dirs` 每次派发都调到),
|
||||
已有 section 不重写。autoscaler unit 已加 `--websearch-mcp`,
|
||||
但 unit 文件不在 deploy tar 里,主机上须单独 scp +
|
||||
daemon-reload + restart autoscaler 才生效(见部署教训)。
|
||||
- egress 白名单:`deploy/egress/tinyproxy-filter` 已加
|
||||
Perplexity、Exa、Tavily、Brave、DuckDuckGo 与
|
||||
`searx.diante.me`(精确匹配,不用 diante.me 通配,否则
|
||||
任务经代理也能摸到 api.diante.me 控制面)。主机上须把
|
||||
该文件拷到 `/etc/tinyproxy/tinyproxy-filter` 并重载
|
||||
tinyproxy,重载后先验中转域名还通,再验新域名。
|
||||
- 自托管 SearXNG(公开子域名路):主机 Docker 跑
|
||||
`searxng/searxng`,经 nginx 反代到 `searx.diante.me`
|
||||
(DNS A 记录 + certbot 证书),MCP 侧
|
||||
`SEARXNG_URL=https://searx.diante.me` 走 worker 进程
|
||||
环境(`/etc/codex-app-server/env`)继承到 codex 再到
|
||||
MCP,不写进 config.toml。公开实例的代价是可能被外人
|
||||
刷:SearXNG limiter 保持开启,JSON 格式是 MCP 要用的
|
||||
唯一格式。未加域名进白名单之前,Docker 任务的搜索
|
||||
会被代理 403 挡住(fail closed,工具报错,不会静默绕过)。
|
||||
- 付费后端实测:本批付费后端只以 mock 响应验证了请求
|
||||
- 付费后端实测:付费后端只以 mock 响应验证了请求
|
||||
字段与结果映射,未用真实 key 跑过;上生产前须用真实
|
||||
key 在测试项目跑一遍,再谈默认链顺序是否合理。
|
||||
|
||||
|
||||
Reference in new issue
Block a user