import { MCPTransportType } from "../types/utility.js";
import { StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { ClientCapabilities } from "@modelcontextprotocol/sdk/types.js";
import { SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.js";

//#region src/utils/mcp-client.d.ts
declare const activeMcpClients: Set<McpClient>;
interface SharedServerConfig {
  timeout?: number;
  activeTools?: string[];
  selectedTools?: string[];
}
interface McpStreamableHttpConfig extends SharedServerConfig {
  type: typeof MCPTransportType.streamableHttp;
  url: string | URL;
  headers?: Record<string, string>;
  requestInit?: StreamableHTTPClientTransportOptions['requestInit'];
  eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
  reconnectionOptions?: StreamableHTTPClientTransportOptions['reconnectionOptions'];
  sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
}
interface McpSSEConfig extends SharedServerConfig {
  type: typeof MCPTransportType.sse;
  url: string | URL;
  headers?: Record<string, string>;
  eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
}
type McpServerConfig = McpStreamableHttpConfig | McpSSEConfig;
interface McpClientOptions {
  name: string;
  version?: string;
  server: McpServerConfig;
  capabilities?: ClientCapabilities;
  timeout?: number;
}
declare class McpClient {
  name: string;
  private client;
  private readonly timeout;
  private transport?;
  private serverConfig;
  private connected;
  constructor(opts: McpClientOptions);
  isConnected(): boolean;
  getInstructions(): string | undefined;
  connect(): Promise<void>;
  private connectSSE;
  private connectHttp;
  disconnect(): Promise<void>;
  private validateSelectedTools;
  private selectTools;
  tools(): Promise<Record<string, any>>;
}
//#endregion
export { McpClient, McpClientOptions, McpSSEConfig, McpServerConfig, McpStreamableHttpConfig, activeMcpClients };