fix(codex): huanxi/huanxi-admin MCP token 改用 bearer_token_env_var 字段

原来的 headers.Authorization: "Bearer ${VAR}" 是字符串模板插值写法,
Codex 官方文档(config.toml 场景)没有支持这种写法,正式字段是
bearer_token_env_var(只放变量名,不放值)。openai/codex#24401 目前
仍在讨论插件级 MCP server 用户密钥配置路径未定案的问题,环境变量注入
是当前唯一可用的路径,README 补充了对应免责声明和排查提示。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVyxoP4cDXeoQ3uAqLcEd2
This commit is contained in:
SkyJourney
2026-08-22 17:36:57 +08:00
co-authored by Claude Sonnet 5
parent eb0e7c3006
commit a64c64667c
3 changed files with 4 additions and 6 deletions
+2
View File
@@ -54,6 +54,8 @@ codex plugin marketplace add https://gitea.rk-health.com/yixiong/yixiong-claude-
安装完成后开一个新会话,Codex 才会加载新装的技能和 MCP 工具。 安装完成后开一个新会话,Codex 才会加载新装的技能和 MCP 工具。
> ⚠️ **桌面应用读不到 shell 里 `export` 的环境变量**`huanxi`/`huanxi-admin` 的 Token 走环境变量注入(见下一节),但 macOS/Windows 上从 Dock/开始菜单启动的图形应用不会继承 `~/.zshrc` 里 `export` 的变量——这是终端应用和图形应用两种不同的启动路径决定的,不是我们插件的问题。桌面应用场景要设置成**系统级/用户级持久环境变量**才行,具体见下一节。 > ⚠️ **桌面应用读不到 shell 里 `export` 的环境变量**`huanxi`/`huanxi-admin` 的 Token 走环境变量注入(见下一节),但 macOS/Windows 上从 Dock/开始菜单启动的图形应用不会继承 `~/.zshrc` 里 `export` 的变量——这是终端应用和图形应用两种不同的启动路径决定的,不是我们插件的问题。桌面应用场景要设置成**系统级/用户级持久环境变量**才行,具体见下一节。
>
> ⚠️ **插件级 Token 配置目前是 Codex 官方还没定案的能力**:截至本文写作时,插件打包的 MCP server 没有类似 Claude 侧「安装时弹窗填 Token」的正式支持(见 [openai/codex#24401](https://github.com/openai/codex/issues/24401)),环境变量是目前唯一现实可用的路径。装完插件连不上 MCP,先检查 Token 环境变量是不是在 Codex/ChatGPT 启动**之前**就已经生效。
> Codex 侧的插件清单独立维护在 [`.agents/plugins/marketplace.json`](./.agents/plugins/marketplace.json)。除 `memcore` 外,其余三个插件与 Claude Code 版共用同一份 `skills/``memcore` 因为架构差异(会话入口、记忆目录约定、有无远程同步都不同)走的是独立目录 [`plugins/memcore-codex/`](./plugins/memcore-codex),两边分开维护。 > Codex 侧的插件清单独立维护在 [`.agents/plugins/marketplace.json`](./.agents/plugins/marketplace.json)。除 `memcore` 外,其余三个插件与 Claude Code 版共用同一份 `skills/``memcore` 因为架构差异(会话入口、记忆目录约定、有无远程同步都不同)走的是独立目录 [`plugins/memcore-codex/`](./plugins/memcore-codex),两边分开维护。
+1 -3
View File
@@ -3,9 +3,7 @@
"huanxi-admin": { "huanxi-admin": {
"type": "http", "type": "http",
"url": "https://huanxi.office.yixiong-tech.com/admin-mcp/", "url": "https://huanxi.office.yixiong-tech.com/admin-mcp/",
"headers": { "bearer_token_env_var": "HUANXI_ADMIN_TOKEN"
"Authorization": "Bearer ${HUANXI_ADMIN_TOKEN}"
}
} }
} }
} }
+1 -3
View File
@@ -3,9 +3,7 @@
"huanxi": { "huanxi": {
"type": "http", "type": "http",
"url": "https://huanxi.office.yixiong-tech.com/mcp/", "url": "https://huanxi.office.yixiong-tech.com/mcp/",
"headers": { "bearer_token_env_var": "HUANXI_TOKEN"
"Authorization": "Bearer ${HUANXI_TOKEN}"
}
} }
} }
} }