/** * @file capability-cache.ts * @description TTL-based capability cache for remote MCP servers */ import type { McpRemoteCapabilities } from '../mcp-client.types'; /** * Configuration for the capability cache */ export interface CapabilityCacheConfig { /** Default TTL in milliseconds (default: 60000 = 60 seconds) */ defaultTTL?: number; } /** * TTL-based capability cache for remote MCP servers. * * Features: * - Configurable TTL per app or global default * - Automatic expiration checking * - Thread-safe for single-threaded Node.js */ export declare class CapabilityCache { private readonly cache; private readonly defaultTTL; constructor(config?: CapabilityCacheConfig); /** * Get cached capabilities for an app. * Returns null if not cached or expired. * * @param appId - The remote app ID * @returns Cached capabilities or null */ get(appId: string): McpRemoteCapabilities | null; /** * Store capabilities in the cache. * * @param appId - The remote app ID * @param capabilities - The capabilities to cache * @param ttl - Optional TTL in milliseconds (uses default if not specified) */ set(appId: string, capabilities: McpRemoteCapabilities, ttl?: number): void; /** * Invalidate cached capabilities for an app. * * @param appId - The remote app ID */ invalidate(appId: string): void; /** * Clear all cached capabilities. */ clear(): void; /** * Check if capabilities are expired or not cached. * * @param appId - The remote app ID * @returns True if expired or not cached */ isExpired(appId: string): boolean; /** * Get the time remaining until expiration. * * @param appId - The remote app ID * @returns Time remaining in milliseconds, or 0 if expired/not cached */ getTimeToExpiry(appId: string): number; /** * Get the timestamp when capabilities were fetched. * * @param appId - The remote app ID * @returns Fetch timestamp or null if not cached */ getFetchedAt(appId: string): Date | null; /** * Get all cached app IDs. * * @returns Array of app IDs with active (non-expired) cache entries */ getCachedAppIds(): string[]; /** * Get cache statistics. */ getStats(): { totalEntries: number; activeEntries: number; expiredEntries: number; }; } //# sourceMappingURL=capability-cache.d.ts.map