feat: classify authorization-required errors (#1056)

This commit is contained in:
Dale Seo 2026-07-31 09:00:23 -04:00 • committed by GitHub
commit 65f05e9924
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,6 +111,17 @@ impl ClientInitializeError {
}
None
}
/// Returns whether client initialization failed because authorization is required.
///
/// This covers both missing or expired local OAuth authorization and an HTTP
/// authorization challenge from the MCP server.
pub fn is_authorization_required(&self) -> bool {
matches!(
self,
Self::TransportError { error, .. } if error.is_authorization_required()
)
}
}
/// Helper function to get the next message from the stream