feat: MCP 后端切到 deta.city 远程端点 + 账号登录门槛
- .mcp.json / cordis.patch.yml 改为远程 streamable-http(https://deta.city/mcp-api/mcp),凭据经环境变量 DETA_TOKEN - 新增 bin/deta-login.mjs:deta.city 账号登录,写 ~/.deta/credentials.json 与 ~/.deta/env(均 0600) - 新增 plugins/deta/README.md:端点/凭据语义、两种宿主安装、本地 stdio 开发形态 - 本地 stdio 形态改为默认注释关闭(仅本机开发,不校验账号、不隔离工作区)
This commit is contained in:
@@ -16,6 +16,10 @@ DETA 领域能力在各类 Agent harness 上的分发仓:**一份产物,多
|
||||
## 安装(Codex)
|
||||
|
||||
```bash
|
||||
# 先登录(一次性,需要 deta.city 账号):换取 DETA_TOKEN
|
||||
node ~/Dev/ant/deta-agent-plugins/plugins/deta/bin/deta-login.mjs
|
||||
source ~/.deta/env # 让 DETA_TOKEN 进入当前 shell 环境
|
||||
|
||||
# 从 Git(分发用)
|
||||
codex plugin marketplace add https://git.deta.city/deta/deta-agent-plugins.git
|
||||
|
||||
@@ -26,6 +30,9 @@ codex plugin list
|
||||
codex plugin add deta@deta
|
||||
```
|
||||
|
||||
未登录(环境里没有 `DETA_TOKEN`)时,MCP 端点会返回 **401**——含义是
|
||||
「当前环境没有可用的 deta.city 登录态」,重新执行上面的登录两步即可。
|
||||
|
||||
## 内容
|
||||
|
||||
| 插件 | 技能 | 能力 | 依赖 |
|
||||
@@ -34,22 +41,37 @@ codex plugin add deta@deta
|
||||
|
||||
## 前置条件
|
||||
|
||||
`deta` 插件的 MCP 后端是领域服务的无头 MCP 服务:
|
||||
| 项 | 值 |
|
||||
|----|-----|
|
||||
| MCP 端点 | `https://deta.city/mcp-api/mcp`(MCP Streamable HTTP) |
|
||||
| 凭据来源 | **deta.city 账号**;`bin/deta-login.mjs` 登录取令牌,经环境变量 `DETA_TOKEN` 传给 harness |
|
||||
| 凭据文件 | `~/.deta/credentials.json`(令牌 + 账号 + 端点)、`~/.deta/env`(`export DETA_TOKEN=...`),均 0600 |
|
||||
|
||||
端点除探活接口(服务端 `GET /health`,经 Nginx 前缀对外为 `/mcp-api/health`)外全部需要鉴权:
|
||||
|
||||
- 未带凭据 / 凭据失效 → `401`(提示重新登录,不回显凭据);
|
||||
- 服务端认证服务不可用 → `500`,同样不放行;
|
||||
- 各账号在服务端有独立工作区(`<工作区根>/<账号 ID>`),互不可见。
|
||||
|
||||
### 本地 stdio 形态(开发用,默认关闭)
|
||||
|
||||
本机开发时也可以直连领域服务的无头 MCP 服务(`bin/deta-mcp.sh`,stdio),
|
||||
它**不校验 deta.city 账号、不隔离工作区**,仅供本机迭代领域能力:
|
||||
|
||||
```bash
|
||||
cd ~/Dev/ant/ant-copilot && npm run build
|
||||
node dist/src/headless/mcp-server.js # 冒烟:应等待 stdin/stdout
|
||||
```
|
||||
|
||||
环境变量:
|
||||
该形态的环境变量:
|
||||
|
||||
| 变量 | 缺省 | 说明 |
|
||||
|------|------|------|
|
||||
| `DETA_SERVER_ROOT` | `~/Dev/ant/ant-copilot` | 领域服务仓库根目录(内部路径) |
|
||||
| `ANT_HEADLESS_WORKSPACE` | `<cwd>/workspace` | AML 工作目录(`aml.xml` / `building.json` 落盘处,名称由底层服务决定) |
|
||||
|
||||
编译与校验类工具需要编译服务在线(`localhost:8000`);未在线时返回明确错误,
|
||||
读写类工具可离线工作。
|
||||
编译与校验类工具需要编译服务在线(服务端为 `DETA_GSA_URL`,缺省 `localhost:8000`);
|
||||
未在线时返回明确错误,读写类工具可离线工作。
|
||||
|
||||
## 本地迭代
|
||||
|
||||
@@ -117,8 +139,9 @@ node apps/cli/lib/bin.js --profile headless --dump-config \
|
||||
# 输出中应出现 `# == .../plugins/deta/cordis.patch.yml` 与 deta-mcp 行
|
||||
```
|
||||
|
||||
`cordis.patch.yml` 里远程端点那段已按公开形态写好(`streamable-http` + Bearer 头),
|
||||
当前默认启用的是本地 stdio 行;服务端化完成后注释切换即可。
|
||||
`cordis.patch.yml` 当前默认启用**远程端点**(`streamable-http` +
|
||||
`Authorization: Bearer ${DETA_TOKEN}`,指向 `https://deta.city/mcp-api/mcp`);
|
||||
本地 stdio 段保留为注释、标注「本机开发用,默认关闭」,需要时手工切换。
|
||||
|
||||
## 已知缺陷(实测,2026-09-10)
|
||||
|
||||
@@ -160,9 +183,11 @@ Duplicate namespace name 'deta'; Namespace names must be unique.
|
||||
.agents/plugins/api_marketplace.json # Codex API key 登录用户市场
|
||||
plugins/deta/ # 同一目录 = Codex 插件根 = dsh 组合包根
|
||||
├── .codex-plugin/plugin.json # Codex 插件清单
|
||||
├── .mcp.json # Codex MCP 声明(含 Codex 私有键)
|
||||
├── .mcp.json # Codex MCP 声明(远程 streamable-http)
|
||||
├── package.json # dsh 组合包声明(dsh.bundle.patch)
|
||||
├── cordis.patch.yml # dsh 配置层(挂载 MCP 服务)
|
||||
├── bin/deta-mcp.sh # 本地 MCP 启动器(开发用)
|
||||
├── bin/deta-login.mjs # 登录助手(~/.deta/credentials.json + ~/.deta/env)
|
||||
├── bin/deta-mcp.sh # 本地 stdio 启动器(开发用,默认关闭)
|
||||
├── README.md # 插件说明(安装/凭据/401 语义)
|
||||
└── skills/aml-design/SKILL.md # 领域技能(两宿主共享)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user