/**
 * Multi-Server Manager
 *
 * Coordinates multiple MCP servers with load balancing, failover,
 * and unified tool discovery across all registered servers.
 *
 * Features:
 * - Load balancing strategies (round-robin, least-loaded, random)
 * - Health-aware routing
 * - Automatic failover
 * - Unified tool namespace management
 * - Cross-server tool discovery
 *
 * @module mcp/multiServerManager
 * @since 8.39.0
 */
import { EventEmitter } from "events";
import type { JsonObject, MCPServerInfo, MultiServerManagerConfig, ServerGroup, ServerMetrics, UnifiedTool } from "../types/index.js";
/**
 * Multi-Server Manager
 *
 * Coordinates multiple MCP servers for unified tool access
 * with load balancing and failover capabilities.
 *
 * @example
 * ```typescript
 * const manager = new MultiServerManager({
 *   defaultStrategy: "round-robin",
 *   healthAwareRouting: true,
 *   autoNamespace: true,
 * });
 *
 * // Add servers
 * manager.addServer(server1Info);
 * manager.addServer(server2Info);
 *
 * // Create a group for redundant servers
 * manager.createGroup({
 *   id: "data-servers",
 *   name: "Data Processing Servers",
 *   servers: ["server1", "server2"],
 *   strategy: "least-loaded",
 * });
 *
 * // Get unified tool list
 * const tools = manager.getUnifiedTools();
 *
 * // Execute with automatic routing
 * const result = await manager.executeTool("readFile", { path: "/data" });
 * ```
 */
export declare class MultiServerManager extends EventEmitter {
    private config;
    private servers;
    private groups;
    private metrics;
    private roundRobinCounters;
    private toolPreferences;
    constructor(config?: MultiServerManagerConfig);
    /**
     * Add a server to the manager
     */
    addServer(server: MCPServerInfo): void;
    /**
     * Remove a server from the manager
     */
    removeServer(serverId: string): boolean;
    /**
     * Update server info
     */
    updateServer(serverId: string, updates: Partial<MCPServerInfo>): void;
    /**
     * Create a server group
     */
    createGroup(group: ServerGroup): void;
    /**
     * Remove a server group
     */
    removeGroup(groupId: string): boolean;
    /**
     * Add a server to a group
     */
    addServerToGroup(serverId: string, groupId: string): void;
    /**
     * Remove a server from a group
     */
    removeServerFromGroup(serverId: string, groupId: string): boolean;
    /**
     * Get unified tool list from all servers
     */
    getUnifiedTools(): UnifiedTool[];
    /**
     * Get namespaced tools (server.toolName format)
     */
    getNamespacedTools(): Array<{
        fullName: string;
        toolName: string;
        serverId: string;
        serverName: string;
        description: string;
        inputSchema?: JsonObject;
    }>;
    /**
     * Set tool preference for routing
     */
    setToolPreference(toolName: string, serverId: string): void;
    /**
     * Clear tool preference
     */
    clearToolPreference(toolName: string): void;
    /**
     * Select a server for a tool using load balancing
     */
    selectServer(toolName: string, groupId?: string): {
        serverId: string;
        server: MCPServerInfo;
    } | null;
    /**
     * Apply load balancing strategy
     */
    private applyStrategy;
    /**
     * Get server priority (lower = higher priority)
     *
     * @param serverId - The server to look up
     * @param groupId - Optional group to scope the lookup to, avoiding
     *   nondeterministic iteration across all groups.
     */
    private getServerPriority;
    /**
     * Update server metrics
     */
    updateMetrics(serverId: string, updates: Partial<ServerMetrics>): void;
    /**
     * Mark request started
     */
    requestStarted(serverId: string): void;
    /**
     * Mark request completed
     */
    requestCompleted(serverId: string, duration: number, success: boolean): void;
    /**
     * Get all servers
     */
    getServers(): MCPServerInfo[];
    /**
     * Get server by ID
     */
    getServer(serverId: string): MCPServerInfo | undefined;
    /**
     * Get all groups
     */
    getGroups(): ServerGroup[];
    /**
     * Get group by ID
     */
    getGroup(groupId: string): ServerGroup | undefined;
    /**
     * Get server metrics
     */
    getServerMetrics(serverId: string): ServerMetrics | undefined;
    /**
     * Get all metrics
     */
    getAllMetrics(): Map<string, ServerMetrics>;
    /**
     * Get statistics
     */
    getStatistics(): {
        totalServers: number;
        healthyServers: number;
        totalGroups: number;
        totalTools: number;
        conflictingTools: number;
        totalRequests: number;
        activeRequests: number;
    };
}
/**
 * Global multi-server manager instance
 */
export declare const globalMultiServerManager: MultiServerManager;
