Repository navigation
Open
Description
What version of Codex CLI is running?
0.137.0
What subscription do you have?
Enterprise
Which model were you using?
gpt-5.5
What platform is your computer?
Darwin 25.5.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
iTerm2
Codex doctor report
What issue are you seeing?
Codex currently shows misleading remediation for some MCP startup auth failures.
For remote MCP servers configured with bearer_token_env_var, a startup failure that contains Auth required is currently surfaced as:
Codex currently shows misleading remediation for some MCP startup auth failures.
That message reads like an OAuth-login problem, but for bearer-token-configured servers the real issue is more likely that the configured token is missing, expired, invalid, or rejected by the server.
codex/codex-rs/codex-mcp/src/connection_manager.rs
Lines 811 to 852 in 87b808b
| fn mcp_init_error_display( | |
| server_name: &str, | |
| entry: Option<&McpAuthStatusEntry>, | |
| err: &StartupOutcomeError, | |
| ) -> String { | |
| if let Some(McpServerTransportConfig::StreamableHttp { | |
| url, | |
| bearer_token_env_var, | |
| http_headers, | |
| .. | |
| }) = entry.and_then(|entry| entry.config.as_ref().map(|config| &config.transport)) | |
| && url == "https://api.githubcopilot.com/mcp/" | |
| && bearer_token_env_var.is_none() | |
| && http_headers.as_ref().map(HashMap::is_empty).unwrap_or(true) | |
| { | |
| format!( | |
| "GitHub MCP does not support OAuth. Log in by adding a personal access token (https://github.com/settings/personal-access-tokens) to your environment and config.toml:\n[mcp_servers.{server_name}]\nbearer_token_env_var = CODEX_GITHUB_PERSONAL_ACCESS_TOKEN" | |
| ) | |
| } else if is_mcp_client_auth_required_error(err) { | |
| format!( | |
| "The {server_name} MCP server is not logged in. Run `codex mcp login {server_name}`." | |
| ) | |
| } else if is_mcp_client_startup_timeout_error(err) { | |
| let startup_timeout_secs = match entry { | |
| Some(entry) => match entry | |
| .config | |
| .as_ref() | |
| .and_then(|config| config.startup_timeout_sec) | |
| { | |
| Some(timeout) => timeout, | |
| None => DEFAULT_STARTUP_TIMEOUT, | |
| }, | |
| None => DEFAULT_STARTUP_TIMEOUT, | |
| } | |
| .as_secs(); | |
| format!( | |
| "MCP client for `{server_name}` timed out after {startup_timeout_secs} seconds. Add or adjust `startup_timeout_sec` in your config.toml:\n[mcp_servers.{server_name}]\nstartup_timeout_sec = XX" | |
| ) | |
| } else { | |
| format!("MCP client for `{server_name}` failed to start: {err:#}") | |
| } | |
| } |
So any startup error containing Auth required gets mapped to the codex mcp login hint, even when the server is configured to use bearer-token auth.
What steps can reproduce the bug?
- Configure a remote MCP server with bearer_token_env_var in ~/.codex/config.toml.
- Set that environment variable to a bearer token value.
- Make the token invalid for the server, for example by using an expired or rejected token.
- Start Codex or trigger MCP server startup.
- Observe that Codex reports the server as “not logged in” and suggests codex mcp login instead of pointing to the configured bearer token as the likely source of the failure.
What is the expected behavior?
No response
Additional information
No response
Reacted by Xin Yu
Activity
xinyu-dev commentedon Jun 7, 2026
Same here
Necmttn commentedon Jun 21, 2026
The remediation branch can probably key off the configured auth mode before looking at the error text.
If the MCP server has
bearer_token_env_var, anAuth requiredstartup failure should name the server and env var, for example:Only servers configured for OAuth should point users at
codex mcp login <server>. A regression test can cover the same response body under both auth modes so the generic substring match does not override the configured credential type.Generated with ax.