Distinguish unknown MCP authentication status (#36045)

## Why

OAuth discovery failures do not establish that an MCP server lacks OAuth
support. Reporting those failures as `unsupported` conflates an inconclusive
check with a confirmed result.

## What changed

- Add an `unknown` MCP authentication status across the protocol, app server,
  CLI, and TUI.
- Preserve OAuth discovery errors so callers can report `unknown`, while
  retaining `unsupported` for servers known not to support OAuth.
- Document the distinction in the app server API.

## Testing

- Verify transient HTTP discovery errors are preserved.
- Verify `codex mcp list --json` reports `unknown` when discovery is rate
  limited.

GitOrigin-RevId: e4562985971606740538e542ec7eeee502111964
This commit is contained in:
jif
2026-07-29 23:24:43 +00:00
committed by copyberry
parent 6493417150
commit 7ec480dda5
16 changed files with 58 additions and 12 deletions
@@ -16,6 +16,7 @@ use ts_rs::TS;
v2_enum_from_core!(
pub enum McpAuthStatus from codex_protocol::protocol::McpAuthStatus {
Unknown,
Unsupported,
NotLoggedIn,
BearerToken,
@@ -2409,7 +2409,7 @@ fn mcp_server_status_serializes_absent_server_info_as_null() {
tools: HashMap::new(),
resources: Vec::new(),
resource_templates: Vec::new(),
auth_status: McpAuthStatus::Unsupported,
auth_status: McpAuthStatus::Unknown,
}],
next_cursor: None,
};
@@ -2423,7 +2423,7 @@ fn mcp_server_status_serializes_absent_server_info_as_null() {
"tools": {},
"resources": [],
"resourceTemplates": [],
"authStatus": "unsupported",
"authStatus": "unknown",
}],
"nextCursor": null,
})