Lightweight coding agent that runs in your terminal
Rust
Improve MCP server startup error logging (#42370)
victor-openai76f47103fece
diff --git a/codex-rs/codex-mcp/src/rmcp_client.rs b/codex-rs/codex-mcp/src/rmcp_client.rsindex 9b4c8137b8..e469b865a2 100644--- a/codex-rs/codex-mcp/src/rmcp_client.rs+++ b/codex-rs/codex-mcp/src/rmcp_client.rs@@ -362,7 +362,7 @@ impl ManagedClientStartup {}};start_server_task(- server_name,+ server_name.clone(),client,StartServerTaskParams {is_codex_apps_mcp_server,@@ -385,6 +385,10 @@ impl ManagedClientStartup {Ok(result) => result,Err(CancelErr::Cancelled) => Err(StartupOutcomeError::Cancelled),};+ // Log once per startup attempt, including discovery without startup notifications.+ if let Err(StartupOutcomeError::Failed { error, .. }) = &outcome {+ warn!(server_name, %error, "MCP server startup failed");+ }if outcome.is_ok()&& let Some(refresh_start) = refresh_start{@@ -618,7 +622,7 @@ impl From<anyhow::Error> for StartupOutcomeError {fn from(error: anyhow::Error) -> Self {let is_authentication_required = is_authentication_required_error(&error);Self::Failed {- error: error.to_string(),+ error: format!("{error:#}"),is_authentication_required,}}