[MCP] Properly gate login after mcp add with experimental_use_rmcp_client (#5653)

There was supposed to be a check here like in other places.
This commit is contained in:
Gabriel Peal
2025-10-24 15:32:15 -07:00
committed by GitHub
parent 817d1508bc
commit e2e1b65da6

View File

@@ -274,19 +274,33 @@ async fn run_add(config_overrides: &CliConfigOverrides, add_args: AddArgs) -> Re
http_headers, http_headers,
env_http_headers, env_http_headers,
} = transport } = transport
&& matches!(supports_oauth_login(&url).await, Ok(true))
{ {
println!("Detected OAuth support. Starting OAuth flow…"); match supports_oauth_login(&url).await {
perform_oauth_login( Ok(true) => {
&name, if !config.features.enabled(Feature::RmcpClient) {
&url, println!(
config.mcp_oauth_credentials_store_mode, "MCP server supports login. Add `experimental_use_rmcp_client = true` \
http_headers.clone(), to your config.toml and run `codex mcp login {name}` to login."
env_http_headers.clone(), );
&Vec::new(), } else {
) println!("Detected OAuth support. Starting OAuth flow…");
.await?; perform_oauth_login(
println!("Successfully logged in."); &name,
&url,
config.mcp_oauth_credentials_store_mode,
http_headers.clone(),
env_http_headers.clone(),
&Vec::new(),
)
.await?;
println!("Successfully logged in.");
}
}
Ok(false) => {}
Err(_) => println!(
"MCP server may or may not require login. Run `codex mcp login {name}` to login."
),
}
} }
Ok(()) Ok(())