/**
 * MCP server connection — connect, listTools, callTool, close.
 */
import type { AuthStorage } from '../auth/auth-storage.js';
import type { McpOAuthStore } from './oauth-state-store.js';
import { type McpConnection, type McpFailureKind, type McpRequestPolicy, type McpServerConfig } from './types.js';
export declare class McpConnectionError extends Error {
    readonly failureKind: McpFailureKind;
    constructor(failureKind: McpFailureKind, message: string);
}
export declare function resolveStartupTimeoutMs(config: McpServerConfig): number;
export declare function buildRequestPolicy(config: McpServerConfig): McpRequestPolicy;
export declare function createHostedMcpLoggingFetch(serverName: string, fetchImpl?: typeof fetch): typeof fetch;
/**
 * Connect a server, list tools, and return a live MCP connection.
 */
export declare function connectServer(name: string, config: McpServerConfig, defaultCwd: string, authStorage?: AuthStorage, mcpOAuthStore?: McpOAuthStore): Promise<McpConnection>;
/**
 * Call a tool on a connected server. Returns the result text or throws.
 */
export declare function callTool(connection: McpConnection, toolName: string, args: Record<string, unknown> | undefined, signal?: AbortSignal, attemptedReconnect?: boolean): Promise<{
    text: string;
    isError: boolean;
}>;
/**
 * Close a connection.
 */
export declare function closeConnection(connection: McpConnection): void;
//# sourceMappingURL=connection.d.ts.map