diff --git a/codex-rs/core/src/mcp_connection_manager.rs b/codex-rs/core/src/mcp_connection_manager.rs index 938d6d0b2b..eac8485048 100644 --- a/codex-rs/core/src/mcp_connection_manager.rs +++ b/codex-rs/core/src/mcp_connection_manager.rs @@ -1440,7 +1440,12 @@ async fn make_rmcp_client( } => { let command_os: OsString = command.into(); let args_os: Vec = args.into_iter().map(Into::into).collect(); - RmcpClient::new_stdio_client(command_os, args_os, env, &env_vars, cwd) + let env_os = env.map(|env| { + env.into_iter() + .map(|(key, value)| (key.into(), value.into())) + .collect::>() + }); + RmcpClient::new_stdio_client(command_os, args_os, env_os, &env_vars, cwd) .await .map_err(|err| StartupOutcomeError::from(anyhow!(err))) } diff --git a/codex-rs/rmcp-client/src/rmcp_client.rs b/codex-rs/rmcp-client/src/rmcp_client.rs index b073480775..4ccb329b8a 100644 --- a/codex-rs/rmcp-client/src/rmcp_client.rs +++ b/codex-rs/rmcp-client/src/rmcp_client.rs @@ -390,7 +390,7 @@ enum TransportRecipe { Stdio { program: OsString, args: Vec, - env: Option>, + env: Option>, env_vars: Vec, cwd: Option, }, @@ -478,7 +478,7 @@ impl RmcpClient { pub async fn new_stdio_client( program: OsString, args: Vec, - env: Option>, + env: Option>, env_vars: &[String], cwd: Option, ) -> io::Result { diff --git a/codex-rs/rmcp-client/tests/process_group_cleanup.rs b/codex-rs/rmcp-client/tests/process_group_cleanup.rs index bb033af875..2d6c220ce8 100644 --- a/codex-rs/rmcp-client/tests/process_group_cleanup.rs +++ b/codex-rs/rmcp-client/tests/process_group_cleanup.rs @@ -73,8 +73,8 @@ async fn drop_kills_wrapper_process_group() -> Result<()> { ), ], Some(HashMap::from([( - "CHILD_PID_FILE".to_string(), - child_pid_file_str, + OsString::from("CHILD_PID_FILE"), + OsString::from(child_pid_file_str), )])), &[], None,