Repository navigation
Conversation
… streamable-http - config.mjs:解析 enabled / url / bearer_token_env_var / http_headers; 跨多行的数组(args = [ ... ])合并成一行再解析,不再标记为“仅部分解析” - mcp.mjs:跳过 enabled=false 的服务器;HTTP 服务器输出 transport: streamable-http 与 headers,bearer 用 !!js 模板动态读环境变量,不把 token 写进产物 - bin:--key value 空格形式生效(原先只认 --key=value,按 README 写法会静默变成 true) - 新增回归测试(133 个用例全过)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
迁移一台真实机器(14 个
[mcp_servers.*])时踩到三处解析/渲染问题,都会让迁移产物静默变坏,所以一起修了。全部改动只碰解析与渲染,不改迁移策略。修了什么
1.
enabled/url/bearer_token_env_var之前不被识别Codex 的 HTTP MCP 长这样:
原实现只认
type/command/args/env/startup_timeout_sec,这三个键全部落入_partial,preview报config.toml 有 N 处仅部分解析,MCP 卡片里该服务器被标成invalid。现在:
enabled被解析;enabled = false的服务器在buildMcpPlan里跳过(并入excluded),不再生成一个启动必然失败的实例url被解析,buildMcpPlan把它带进 plan,渲染时输出transport: streamable-http+urlbearer_token_env_var渲染成动态表达式,不把 token 写进产物:http_headers(内联表)2. 多行数组导致
args整段丢失行式解析器只看到
args = [就判定失败,args丢失 → 迁过去是一个没有参数、起不来的 playwright 实例。现在跨行数组会先合并成一行再解析,
args完整还原。3.
--key value空格写法失效parseArgs只处理--key=value,--key value会把key置为true、value变成 positional。README 与--help里写的都是空格形式,于是:实际写入的是
target: "true"(台账里能看到),用户以为写到了指定路径。现在两种写法都支持。测试
新增 1 个回归用例:
TOML 的 enabled / url / bearer_token_env_var 与多行 args 正确映射,覆盖上述三点(含!!js头的渲染形态、enabled=false的排除、跨行 args 的还原)。兼容性
url与headers(以前是空的),enabled=false的服务器不再出现在产物里--mask-secrets、幂等、台账、verify行为都不变复现
用一份包含 HTTP 服务器 + 跨行 args 的
config.toml跑:codex2dsh preview # 会看到“仅部分解析”与 invalid 条目 codex2dsh mcp --apply --out=./mirror.yml再对照产物:
url:为空、playwright 的args缺失、Authorization不存在。