mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-28 13:42:51 +08:00
Compare commits
2 Commits
codex/issu
...
fix/mcp-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ac4a64087 | ||
|
|
6f555cb274 |
@@ -146,7 +146,9 @@ impl ConfigService {
|
|||||||
let cfg_text = settings.get("config").and_then(Value::as_str);
|
let cfg_text = settings.get("config").and_then(Value::as_str);
|
||||||
|
|
||||||
crate::codex_config::write_codex_live_atomic(auth, cfg_text)?;
|
crate::codex_config::write_codex_live_atomic(auth, cfg_text)?;
|
||||||
crate::mcp::sync_enabled_to_codex(config)?;
|
// 注意:MCP 同步在 v3.7.0 中已通过 McpService 进行,不再在此调用
|
||||||
|
// sync_enabled_to_codex 使用旧的 config.mcp.codex 结构,在新架构中为空
|
||||||
|
// MCP 的启用/禁用应通过 McpService::toggle_app 进行
|
||||||
|
|
||||||
let cfg_text_after = crate::codex_config::read_and_validate_codex_config_text()?;
|
let cfg_text_after = crate::codex_config::read_and_validate_codex_config_text()?;
|
||||||
if let Some(manager) = config.get_manager_mut(&AppType::Codex) {
|
if let Some(manager) = config.get_manager_mut(&AppType::Codex) {
|
||||||
|
|||||||
@@ -76,19 +76,8 @@ fn sync_codex_provider_writes_auth_and_config() {
|
|||||||
|
|
||||||
let mut config = MultiAppConfig::default();
|
let mut config = MultiAppConfig::default();
|
||||||
|
|
||||||
// 添加入测 MCP 启用项,确保 sync_enabled_to_codex 会写入 TOML
|
// 注意:v3.7.0 后 MCP 同步由 McpService 独立处理,不再通过 provider 切换触发
|
||||||
config.mcp.codex.servers.insert(
|
// 此测试仅验证 auth.json 和 config.toml 基础配置的写入
|
||||||
"echo-server".into(),
|
|
||||||
json!({
|
|
||||||
"id": "echo-server",
|
|
||||||
"enabled": true,
|
|
||||||
"server": {
|
|
||||||
"type": "stdio",
|
|
||||||
"command": "echo",
|
|
||||||
"args": ["hello"]
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
let provider_config = json!({
|
let provider_config = json!({
|
||||||
"auth": {
|
"auth": {
|
||||||
@@ -133,9 +122,10 @@ fn sync_codex_provider_writes_auth_and_config() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let toml_text = fs::read_to_string(&config_path).expect("read config.toml");
|
let toml_text = fs::read_to_string(&config_path).expect("read config.toml");
|
||||||
|
// 验证基础配置正确写入
|
||||||
assert!(
|
assert!(
|
||||||
toml_text.contains("command = \"echo\""),
|
toml_text.contains("base_url"),
|
||||||
"config.toml should contain serialized enabled MCP server"
|
"config.toml should contain base_url from provider config"
|
||||||
);
|
);
|
||||||
|
|
||||||
// 当前供应商应同步最新 config 文本
|
// 当前供应商应同步最新 config 文本
|
||||||
|
|||||||
Reference in New Issue
Block a user