diff --git a/rust/crates/commands/src/lib.rs b/rust/crates/commands/src/lib.rs index ea825003..f63c1ea3 100644 --- a/rust/crates/commands/src/lib.rs +++ b/rust/crates/commands/src/lib.rs @@ -2806,7 +2806,11 @@ fn render_mcp_report_json_for( runtime_config.mcp().get(server_name), ); if let Some(map) = value.as_object_mut() { - map.insert("status".to_string(), Value::String("ok".to_string())); + // Only override status to "ok" if the server was found; + // render_mcp_server_report_json already sets status:"error" for not-found. + if map.get("found") == Some(&Value::Bool(true)) { + map.insert("status".to_string(), Value::String("ok".to_string())); + } map.insert("config_load_error".to_string(), Value::Null); } Ok(value) @@ -3890,6 +3894,7 @@ fn render_mcp_server_report_json( Some(server) => json!({ "kind": "mcp", "action": "show", + "status": "ok", "working_directory": cwd.display().to_string(), "found": true, "server": mcp_server_json(server_name, server), @@ -3897,6 +3902,8 @@ fn render_mcp_server_report_json( None => json!({ "kind": "mcp", "action": "show", + "status": "error", + "error_kind": "server_not_found", "working_directory": cwd.display().to_string(), "found": false, "server_name": server_name, diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 4cc4a1eb..602b9d0f 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -5872,7 +5872,8 @@ impl LiveCli { // Propagate ok:false → non-zero exit so automation callers // can rely on exit code instead of inspecting the envelope. // (#68: mcp error envelopes previously always exited 0.) - let is_error = value.get("ok").and_then(|v| v.as_bool()) == Some(false); + let is_error = value.get("ok").and_then(|v| v.as_bool()) == Some(false) + || value.get("status").and_then(|v| v.as_str()) == Some("error"); println!("{}", serde_json::to_string_pretty(&value)?); if is_error { std::process::exit(1);