/** * MCP OAuth Auto-Discovery * * Automatically detects OAuth requirements from MCP server responses * and extracts authentication endpoints. */ export interface OAuthEndpoints { authorizationUrl: string; tokenUrl: string; clientId?: string; scopes?: string; } export interface AuthDetectionResult { requiresAuth: boolean; authType?: "oauth" | "apikey" | "unknown"; oauth?: OAuthEndpoints; authServerUrl?: string; message?: string; } export declare function extractMcpAuthServerUrl(error: Error): string | undefined; /** * Detect if an error indicates authentication is required. * Checks for common auth error patterns. */ export declare function detectAuthError(error: Error): boolean; /** * Extract OAuth endpoints from error response. * Looks for WWW-Authenticate header format or JSON error bodies. */ export declare function extractOAuthEndpoints(error: Error): OAuthEndpoints | null; /** * Analyze an error to determine authentication requirements. * Returns structured info about what auth is needed. */ export declare function analyzeAuthError(error: Error): AuthDetectionResult; /** * Try to discover OAuth endpoints by querying the server's well-known endpoints. * This is a fallback when error responses don't include OAuth metadata. */ export declare function discoverOAuthEndpoints(serverUrl: string, authServerUrl?: string): Promise;