mirror of
https://github.com/openai/codex.git
synced 2026-11-13 21:30:47 +00:00
Clarify removal scope for profile MCP servers (#61357)
## Why `codex mcp get` suggests `codex mcp remove` for servers defined in the active profile, but that command only edits the global config. ## What changed For servers defined in the active profile, replace the removal hint with the profile settings file path and an explanation of the command's scope. Keep the removal hint for servers inherited from the global config. ## Testing Add CLI coverage for profile-only servers, profile overrides of global servers, and inherited global servers. GitOrigin-RevId: 454df034f7e74b10f96983a9f13821d5ababfde7
This commit is contained in:
@@ -7,6 +7,7 @@ use anyhow::anyhow;
|
||||
use anyhow::bail;
|
||||
use clap::ArgGroup;
|
||||
use clap::builder::TypedValueParser;
|
||||
use codex_config::ConfigLayerSource;
|
||||
use codex_config::types::AppToolApproval;
|
||||
use codex_config::types::McpServerAuth;
|
||||
use codex_config::types::McpServerConfig;
|
||||
@@ -1131,7 +1132,23 @@ async fn run_get(config: &Config, get_args: GetArgs) -> Result<()> {
|
||||
};
|
||||
println!(" default_tools_approval_mode: {approval_mode}");
|
||||
}
|
||||
println!(" remove: codex mcp remove {}", get_args.name);
|
||||
if let Some(layer) = config.config_layer_stack.get_active_user_layer()
|
||||
&& let ConfigLayerSource::User {
|
||||
file,
|
||||
profile: Some(_),
|
||||
} = &layer.name
|
||||
&& !layer.is_disabled()
|
||||
&& layer
|
||||
.config
|
||||
.get("mcp_servers")
|
||||
.and_then(|servers| servers.get(&get_args.name))
|
||||
.is_some()
|
||||
{
|
||||
println!(" profile settings: {}", file.as_path().display());
|
||||
println!(" removal scope: `codex mcp remove` only edits the global config.");
|
||||
} else {
|
||||
println!(" remove: codex mcp remove {}", get_args.name);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user