import type { AgentTool } from "@prestyj/agent";
import type { MCPServerConfig } from "./types.js";
/** Per-server connection outcome for the dashboard / non-interactive list. */
export interface MCPConnectResult {
    name: string;
    ok: boolean;
    toolCount: number;
    tools: AgentTool[];
    error?: string;
    /** True when the server returned 401/Unauthorized and an OAuth login is
     *  required before it can connect. The UI surfaces this as "requires login". */
    requiresAuth?: boolean;
}
/** Outcome of an interactive remote-MCP OAuth login. */
export interface MCPLoginResult {
    ok: boolean;
    toolCount: number;
    error?: string;
}
export declare class MCPClientManager {
    private servers;
    connectAll(configs: MCPServerConfig[]): Promise<AgentTool[]>;
    /**
     * Connect every enabled server and return one result per server (success →
     * ok + toolCount; failure → ok:false with a human-readable error string).
     * Keeps successfully connected servers in `this.servers`.
     */
    connectAllDetailed(configs: MCPServerConfig[]): Promise<MCPConnectResult[]>;
    /**
     * Connect a single server, list its tools, then close that client so the
     * probe connection doesn't accumulate in `this.servers`. Used to validate a
     * server before persisting it.
     */
    probe(config: MCPServerConfig): Promise<MCPConnectResult>;
    /**
     * Run the interactive OAuth login for one remote MCP server end-to-end:
     * start a loopback callback server, let the SDK open the browser via
     * `onAuthorizationUrl`, capture the redirect, exchange the code, then verify
     * the authorized connection by listing tools. Tokens are persisted by the
     * provider so later (non-interactive) connects succeed silently.
     *
     * `onAuthorizationUrl` is invoked with the authorize URL so the host can open
     * it (the ezcoder-app broadcasts it to the webview, which opens the system
     * browser; the CLI prints it). Never throws — returns `{ ok:false, error }`.
     */
    login(config: MCPServerConfig, onAuthorizationUrl: (url: string) => void, timeoutMs?: number): Promise<MCPLoginResult>;
    private connectServer;
    /**
     * Connect a single HTTP (Streamable HTTP or SSE) server and return the live
     * client + transport. Transport selection:
     * - `transport === "sse"` → legacy SSE directly (Playwright MCP `--port`).
     * - otherwise → Streamable HTTP first, SSE fallback for older servers.
     *
     * An OAuth provider is attached only for REMOTE servers — localhost never
     * needs OAuth and attaching it there is dead weight that can misdiagnose a
     * protocol mismatch as a login requirement.
     */
    private connectHttp;
    dispose(): Promise<void>;
}
//# sourceMappingURL=client.d.ts.map