/** * MCP-Based Token Manager for HubSpot OAuth * Handles token refresh through MCP protocol to avoid direct API issues */ export interface TokenData { portalId: string; accessToken: string; refreshToken: string; expiresAt: number; scope?: string; } export interface TokenRefreshResult { success: boolean; accessToken?: string; refreshToken?: string; expiresAt?: number; error?: string; } export declare class MCPTokenManager { private hubspotClient; private refreshLocks; private readonly TOKEN_LIFETIME_MS; private readonly EARLY_REFRESH_BUFFER_MS; private readonly REFRESH_JITTER_MS; constructor(accessToken: string); /** * Check if token needs refresh based on HubSpot's 30-minute expiry */ needsRefresh(tokenData: TokenData): boolean; /** * Refresh token using MCP protocol with singleflight locking */ refreshToken(tokenData: TokenData): Promise; /** * Perform the actual token refresh */ private performRefresh; /** * Validate current token by checking with HubSpot */ validateToken(accessToken: string): Promise<{ valid: boolean; expiresIn?: number; hubId?: string; }>; /** * Get token status and health information */ getTokenHealth(tokenData: TokenData): { status: 'healthy' | 'expiring_soon' | 'expired'; minutesToExpiry: number; needsRefresh: boolean; }; }