/** * Virtual Filesystem for MCP Resources * Main orchestrator for handling mcp:// URIs in SQL queries */ import { MCPConnectionPool } from '../federation/ConnectionPool.js'; import { ResourceRegistry } from '../federation/ResourceRegistry.js'; import { DataFormat } from './FormatDetector.js'; /** * Configuration for Virtual Filesystem */ export interface VirtualFilesystemConfig { cacheConfig?: { cacheDir?: string; defaultTTL?: number; maxSize?: number; maxItems?: number; }; connectionPoolConfig?: { maxConnections?: number; connectionTTL?: number; idleTimeout?: number; }; autoConnect?: boolean; autoDiscovery?: boolean; connectionPatterns?: string[]; } /** * Resource resolution result */ export interface ResourceResolution { uri: string; localPath: string; format: DataFormat; cached: boolean; server?: string; } /** * Virtual Filesystem for transparent MCP resource access */ /** * Statistics for Virtual Filesystem */ export interface VFSStats { totalResolutions: number; cacheHits: number; cacheMisses: number; cacheHitRate: number; errors: number; discoveredResources?: number; } export declare class VirtualFilesystem { private cache; private connectionPool; private resourceRegistry; private connectedServers; private config; private pendingResolutions; private stats; constructor(resourceRegistry: ResourceRegistry, connectionPool?: MCPConnectionPool, config?: VirtualFilesystemConfig); /** * Initialize the virtual filesystem */ initialize(): Promise; /** * Process a SQL query with mcp:// URIs * @param sql The original SQL query * @returns Transformed query with local paths */ processQuery(sql: string): Promise; /** * Resolve an MCP URI to a local path * @param uri The MCP URI to resolve * @returns Resolution result with local path */ resolveURI(uri: string): Promise; private doResolveURI; /** * Fetch a resource from an MCP server * @param parsed The parsed URI * @returns Resource data */ private fetchResource; /** * Detect format from parsed URI and content */ private detectFormat; /** * Get connection patterns from configuration or environment */ private getConnectionPatterns; /** * Connect to an MCP server * @param serverName The server name */ connectToServer(serverName: string): Promise; /** * Discover available MCP servers */ discoverServers(): Promise; /** * List all available resources * @returns Array of available resource URIs */ listAvailableResources(): string[]; /** * Search for resources matching a pattern * @param pattern The search pattern (supports wildcards) * @returns Matching resource URIs */ searchResources(pattern: string): string[]; /** * Expand glob patterns to matching resources * @param globPattern The glob pattern with wildcards * @returns Array of matching URIs */ expandGlob(globPattern: string): string[]; /** * Pre-cache a resource * @param uri The MCP URI to pre-cache * @returns True if cached successfully */ precacheResource(uri: string): Promise; /** * Clear the cache */ clearCache(): Promise; /** * Get cache statistics */ getCacheStats(): { itemCount: number; totalSize: number; maxSize: number; hitRate: number; oldestItem?: Date; newestItem?: Date; }; /** * Get connection pool statistics */ getConnectionStats(): { totalConnections: number; healthyConnections: number; unhealthyConnections: number; activeConnections: number; idleConnections: number; connectionsByTransport: Record; connectionsByUseCount: Array<{ url: string; useCount: number; ageMs: number; }>; averageUseCount: number; }; /** * Check if a URI is valid and available * @param uri The MCP URI to check * @returns True if valid and available */ isAvailable(uri: string): boolean; /** * Create a view with auto-refresh for real-time resources * @param viewName The view name * @param uri The MCP URI * @param refreshInterval Refresh interval in milliseconds */ createLiveView(viewName: string, uri: string, _refreshInterval?: number): Promise; /** * Resolve multiple URIs efficiently * @param uris Array of MCP URIs to resolve * @returns Array of resolution results (null for failures) */ resolveMultiple(uris: string[]): Promise>; /** * Get VFS statistics * @returns Statistics object */ getStats(): VFSStats; /** * Destroy the virtual filesystem */ destroy(): Promise; } //# sourceMappingURL=VirtualFilesystem.d.ts.map