mirror of
https://github.com/openai/codex.git
synced 2026-04-29 00:55:38 +00:00
Propagate MCP disabled reason (#9207)
Indicate why MCP servers are disabled when they are disabled by
requirements:
```
➜ codex git:(main) ✗ just codex mcp list
cargo run --bin codex -- "$@"
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
Running `target/debug/codex mcp list`
Name Command Args Env Cwd Status Auth
docs docs-mcp - - - disabled: requirements (MDM com.openai.codex:requirements_toml_base64) Unsupported
hello_world hello-world-mcp - - - disabled: requirements (MDM com.openai.codex:requirements_toml_base64) Unsupported
➜ codex git:(main) ✗ just c
cargo run --bin codex -- "$@"
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.90s
Running `target/debug/codex`
╭─────────────────────────────────────────────╮
│ >_ OpenAI Codex (v0.0.0) │
│ │
│ model: gpt-5.2 xhigh /model to change │
│ directory: ~/code/codex/codex-rs │
╰─────────────────────────────────────────────╯
/mcp
🔌 MCP Tools
• No MCP tools available.
• docs (disabled)
• Reason: requirements (MDM com.openai.codex:requirements_toml_base64)
• hello_world (disabled)
• Reason: requirements (MDM com.openai.codex:requirements_toml_base64)
```
This commit is contained in:
@@ -1358,7 +1358,6 @@ pub(crate) fn new_mcp_tools_output(
|
||||
if tools.is_empty() {
|
||||
lines.push(" • No MCP tools available.".italic().into());
|
||||
lines.push("".into());
|
||||
return PlainHistoryCell { lines };
|
||||
}
|
||||
|
||||
let mut servers: Vec<_> = config.mcp_servers.iter().collect();
|
||||
@@ -1382,6 +1381,9 @@ pub(crate) fn new_mcp_tools_output(
|
||||
header.push(" ".into());
|
||||
header.push("(disabled)".red());
|
||||
lines.push(header.into());
|
||||
if let Some(reason) = cfg.disabled_reason.as_ref().map(ToString::to_string) {
|
||||
lines.push(vec![" • Reason: ".into(), reason.dim()].into());
|
||||
}
|
||||
lines.push(Line::from(""));
|
||||
continue;
|
||||
}
|
||||
@@ -1836,6 +1838,7 @@ mod tests {
|
||||
cwd: None,
|
||||
},
|
||||
enabled: true,
|
||||
disabled_reason: None,
|
||||
startup_timeout_sec: None,
|
||||
tool_timeout_sec: None,
|
||||
enabled_tools: None,
|
||||
@@ -1856,6 +1859,7 @@ mod tests {
|
||||
env_http_headers: Some(env_headers),
|
||||
},
|
||||
enabled: true,
|
||||
disabled_reason: None,
|
||||
startup_timeout_sec: None,
|
||||
tool_timeout_sec: None,
|
||||
enabled_tools: None,
|
||||
|
||||
Reference in New Issue
Block a user