/** * MCP SDK Client Wrapper * * Provides a singleton SDK client instance for MCP tool handlers. * This module wraps the LLMBrowserClient from the SDK package and provides * additional MCP-specific functionality. * * Design principle: MCP handlers should be thin wrappers that delegate to SDK. */ import { BrowserManager } from '../core/browser-manager.js'; import { ContentExtractor } from '../utils/content-extractor.js'; import { ApiAnalyzer } from '../core/api-analyzer.js'; import { SessionManager } from '../core/session-manager.js'; import { SmartBrowser } from '../core/smart-browser.js'; import { LearningEngine } from '../core/learning-engine.js'; import { AuthWorkflow } from '../core/auth-workflow.js'; import { BrowseTool } from '../tools/browse-tool.js'; import { ApiCallTool } from '../tools/api-call-tool.js'; import type { SmartBrowseOptions, SmartBrowseResult, DomainCapabilitiesSummary, DomainKnowledgeSummary } from '../core/smart-browser.js'; import type { RenderTier } from '../core/tiered-fetcher.js'; /** * MCP SDK Client * * Singleton instance providing SDK access for MCP tool handlers. * Initializes all core components and provides typed access. */ export declare class McpSdkClient { private static instance; readonly browserManager: BrowserManager; readonly contentExtractor: ContentExtractor; readonly apiAnalyzer: ApiAnalyzer; readonly sessionManager: SessionManager; readonly learningEngine: LearningEngine; readonly smartBrowser: SmartBrowser; readonly authWorkflow: AuthWorkflow; readonly browseTool: BrowseTool; readonly apiCallTool: ApiCallTool; private constructor(); /** * Get the singleton instance */ static getInstance(): McpSdkClient; /** * Reset the singleton instance (for testing) */ static resetInstance(): void; /** * Smart browse with automatic learning and optimization */ browse(url: string, options?: SmartBrowseOptions): Promise; /** * Batch browse multiple URLs */ batchBrowse(urls: string[], browseOptions?: SmartBrowseOptions, batchOptions?: { concurrency?: number; stopOnError?: boolean; continueOnRateLimit?: boolean; perUrlTimeoutMs?: number; totalTimeoutMs?: number; }): Promise[]>; /** * Get domain intelligence summary */ getDomainIntelligence(domain: string): Promise<{ knownPatterns: number; selectorChains: number; validators: number; paginationPatterns: number; recentFailures: number; successRate: number; domainGroup: string | null; recommendedWaitStrategy: string; shouldUseSession: boolean; }>; /** * Get domain capabilities summary */ getDomainCapabilities(domain: string): Promise<{ domain: string; capabilities: { canBypassBrowser: boolean; hasLearnedPatterns: boolean; hasActiveSession: boolean; hasSkills: boolean; hasPagination: boolean; hasContentSelectors: boolean; }; confidence: { level: "high" | "medium" | "low" | "unknown"; score: number; basis: string; }; performance: { preferredTier: string; avgResponseTimeMs: number | null; successRate: number; }; recommendations: string[]; details: { apiPatternCount: number; skillCount: number; selectorCount: number; validatorCount: number; paginationPatternCount: number; recentFailureCount: number; domainGroup: string | null; }; }>; /** * Get both capabilities and intelligence for domain insights */ getDomainInsights(domain: string): Promise<{ capabilities: DomainCapabilitiesSummary; knowledge: DomainKnowledgeSummary; }>; /** * Get learning statistics */ getLearningStats(): { totalDomains: number; totalApiPatterns: number; totalSelectors: number; totalValidators: number; bypassablePatterns: number; domainGroups: string[]; recentLearningEvents: import("../types/index.js").LearningEvent[]; }; /** * Get procedural memory (skills) statistics */ getProceduralMemoryStats(): { totalSkills: number; totalTrajectories: number; skillsByDomain: Record; avgSuccessRate: number; mostUsedSkills: Array<{ name: string; uses: number; }>; }; /** * Find applicable skills for a URL */ findApplicableSkills(url: string, topK?: number): import("../sdk.js").SkillMatch[]; /** * Get tiered fetcher statistics */ getTieredFetcherStats(): { totalDomains: number; byTier: Record; avgResponseTimes: Record; playwrightAvailable: boolean; }; /** * Set preferred tier for a domain */ setDomainTier(domain: string, tier: RenderTier): void; /** * Get domain tier preference */ getDomainTierPreference(domain: string): import("../core/tiered-fetcher.js").DomainPreference | undefined; /** * Get session health for a domain */ getSessionHealth(domain: string, profile?: string): import("../core/session-manager.js").SessionHealth; /** * Get all session health */ getAllSessionHealth(): import("../core/session-manager.js").SessionHealth[]; /** * Save session for a domain */ saveSession(domain: string, profile?: string): Promise; /** * List all sessions */ listSessions(): { domain: string; profile: string; lastUsed: number; }[]; /** * Capture screenshot */ captureScreenshot(url: string, options?: { fullPage?: boolean; element?: string; waitForSelector?: string; sessionProfile?: string; width?: number; height?: number; }): Promise; /** * Export HAR */ exportHar(url: string, options?: { includeResponseBodies?: boolean; maxBodySize?: number; pageTitle?: string; waitForSelector?: string; sessionProfile?: string; }): Promise; /** * Cleanup browser resources */ cleanup(): Promise; } /** * Get the singleton MCP SDK client instance */ export declare function getMcpSdkClient(): McpSdkClient; //# sourceMappingURL=sdk-client.d.ts.map