import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
import type { McpTool, McpResource, ServerDefinition, ServerStreamResultPatchNotification, Transport } from "./types.js";
import { type ServerSamplingConfig } from "./sampling-handler.js";
interface ServerConnection {
    client: Client;
    transport: Transport;
    definition: ServerDefinition;
    tools: McpTool[];
    resources: McpResource[];
    lastUsedAt: number;
    inFlight: number;
    status: "connected" | "closed" | "needs-auth";
}
type UiStreamListener = (serverName: string, notification: ServerStreamResultPatchNotification["params"]) => void;
export declare class McpServerManager {
    private connections;
    private connectPromises;
    private uiStreamListeners;
    private samplingConfig;
    setSamplingConfig(config: ServerSamplingConfig | undefined): void;
    connect(name: string, definition: ServerDefinition): Promise<ServerConnection>;
    private createConnection;
    private createClient;
    private createHttpTransport;
    private fetchAllTools;
    private fetchAllResources;
    private attachAdapterNotificationHandlers;
    registerUiStreamListener(streamToken: string, listener: UiStreamListener): void;
    removeUiStreamListener(streamToken: string): void;
    readResource(name: string, uri: string): Promise<ReadResourceResult>;
    close(name: string): Promise<void>;
    closeAll(): Promise<void>;
    getConnection(name: string): ServerConnection | undefined;
    getAllConnections(): Map<string, ServerConnection>;
    touch(name: string): void;
    incrementInFlight(name: string): void;
    decrementInFlight(name: string): void;
    isIdle(name: string, timeoutMs: number): boolean;
}
export {};
//# sourceMappingURL=server-manager.d.ts.map