From a64c64667c75c418be618574eb2c1a2c375adb78 Mon Sep 17 00:00:00 2001 From: SkyJourney Date: Sat, 22 Aug 2026 17:36:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(codex):=20huanxi/huanxi-admin=20MCP=20token?= =?UTF-8?q?=20=E6=94=B9=E7=94=A8=20bearer=5Ftoken=5Fenv=5Fvar=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原来的 headers.Authorization: "Bearer ${VAR}" 是字符串模板插值写法, Codex 官方文档(config.toml 场景)没有支持这种写法,正式字段是 bearer_token_env_var(只放变量名,不放值)。openai/codex#24401 目前 仍在讨论插件级 MCP server 用户密钥配置路径未定案的问题,环境变量注入 是当前唯一可用的路径,README 补充了对应免责声明和排查提示。 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01LVyxoP4cDXeoQ3uAqLcEd2 --- README.md | 2 ++ plugins/huanxi-admin/.mcp.json | 4 +--- plugins/huanxi/.mcp.json | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec38f5a..05d1c27 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ codex plugin marketplace add https://gitea.rk-health.com/yixiong/yixiong-claude- 安装完成后开一个新会话,Codex 才会加载新装的技能和 MCP 工具。 > ⚠️ **桌面应用读不到 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),两边分开维护。 diff --git a/plugins/huanxi-admin/.mcp.json b/plugins/huanxi-admin/.mcp.json index 98ff1fb..8881c58 100644 --- a/plugins/huanxi-admin/.mcp.json +++ b/plugins/huanxi-admin/.mcp.json @@ -3,9 +3,7 @@ "huanxi-admin": { "type": "http", "url": "https://huanxi.office.yixiong-tech.com/admin-mcp/", - "headers": { - "Authorization": "Bearer ${HUANXI_ADMIN_TOKEN}" - } + "bearer_token_env_var": "HUANXI_ADMIN_TOKEN" } } } diff --git a/plugins/huanxi/.mcp.json b/plugins/huanxi/.mcp.json index 2584772..ef199b8 100644 --- a/plugins/huanxi/.mcp.json +++ b/plugins/huanxi/.mcp.json @@ -3,9 +3,7 @@ "huanxi": { "type": "http", "url": "https://huanxi.office.yixiong-tech.com/mcp/", - "headers": { - "Authorization": "Bearer ${HUANXI_TOKEN}" - } + "bearer_token_env_var": "HUANXI_TOKEN" } } }