mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Let extensions supply per-request authentication for MCP servers (#63532)
## Why An extension that manages its own credentials needs to refresh them without restarting an MCP session, while keeping each session tied to the identity that opened it. ## What changed Add `McpServerContribution::SetWithAuthProvider` for host-local Streamable HTTP servers. Codex asks the provider for fresh headers on each request. It reuses the connection across credential refreshes for the same owner, rejects requests whose owner differs from the session owner, and rebuilds the connection when the active owner changes. Provider-backed servers reject conflicting credential configuration, disable HTTP redirects, and bypass the shared startup tool catalog. Rebuilding the catalog disables a provider-backed registration if its transport changes. ## Testing Add coverage for credential rotation, owner changes, conflicting auth configuration, transport changes, and tool discovery for the current owner. GitOrigin-RevId: 409cbb2237ff306932491335461e87cf5a9ec890
This commit is contained in:
@@ -7,7 +7,7 @@ use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Error returned while applying authentication to an outbound request.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[derive(Clone, Debug, thiserror::Error)]
|
||||
pub enum AuthError {
|
||||
#[error(transparent)]
|
||||
Policy(#[from] NetworkPolicyDenied),
|
||||
|
||||
Reference in New Issue
Block a user