/** * @fileoverview SignalR service for Web Interact MCP communication * @description Framework-agnostic SignalR service for real-time communication with MCP servers * @version 1.0.0 * @author Vijay Nirmal */ import * as signalR from '@microsoft/signalr'; import { ToolStartConfig, CallToolResult, TransportOptions } from './types'; import { ToolRegistry } from './tool-registry'; /** * Forward declaration to avoid circular dependency */ export interface WebInteractMCPController { start(tools: ToolStartConfig[]): Promise; } /** * SignalR service for Web Interact MCP communication * This is a framework-agnostic implementation that can be used with any JavaScript framework */ export declare class WebInteractSignalRService { private serverUrl; private mcpController; private toolRegistry; private connection; private readonly config; private readonly logger; private reconnectAttempts; private isManuallyDisconnected; /** * Maps our TransportType enum to SignalR's HttpTransportType * Explicitly maps each transport type and handles flag combinations */ private mapTransportType; /** * Maps our LogLevel enum to SignalR's LogLevel */ private mapLogLevel; /** * Creates a new WebInteractSignalRService instance * @param serverUrl - The base URL of the MCP server * @param mcpController - The MCP controller instance * @param toolRegistry - The tool registry instance for tool discovery * @param config - Configuration options for the service */ constructor(serverUrl: string, mcpController: WebInteractMCPController, toolRegistry: ToolRegistry, config?: Partial); /** * Start the SignalR connection * @returns Promise that resolves when the connection is established */ start(): Promise; /** * Stop the SignalR connection * @returns Promise that resolves when the connection is stopped */ stop(): Promise; /** * Gets the SignalR connection ID which serves as the session ID * @returns The connection ID or null if not connected */ getConnectionId(): string | null; /** * Check if the connection is active * @returns True if connected, false otherwise */ get isConnected(): boolean; /** * Get the current connection state * @returns The current SignalR connection state */ get connectionState(): signalR.HubConnectionState | null; /** * Send a ping to test the connection * @returns Promise that resolves with the server response */ ping(): Promise; /** * Dispose of the service and clean up resources */ dispose(): void; /** * Setup SignalR connection with event handlers * @private */ private setupConnection; /** * Setup SignalR event handlers * @private */ private setupEventHandlers; /** * Invoke a tool using the MCP controller * @private */ private invokeTool; /** * Sanitize parameters to ensure they are safe and valid * @private */ private sanitizeParameters; /** * Schedule a reconnect attempt with exponential backoff * @private */ private scheduleReconnect; /** * Creates a silent logger that doesn't output anything * @private */ private createSilentLogger; } export { WebInteractSignalRService as MCPSignalRService }; //# sourceMappingURL=signalr.service.d.ts.map