import { type OAuthClientProvider } from '@ai-sdk/mcp';
import type { Tool } from 'ai';
/**
 * Supported transport types for MCP clients.
 */
export type McpTransportType = 'stdio' | 'sse' | 'http';
/**
 * Shared configuration for all MCP server transports.
 */
interface McpClientBaseConfig {
    /** Display name for the MCP server */
    name: string;
    /** Optional prefix applied to every imported tool name */
    toolPrefix?: string;
    /** Optional MCP client name override */
    clientName?: string;
    /** Optional MCP client version override */
    clientVersion?: string;
    /** Auth method for the MCP connection. */
    authMethod?: 'api-key' | 'oauth2' | 'bearer';
    /** Custom auth headers. */
    authHeaders?: Record<string, string>;
    /** API version for the MCP server. */
    apiVersion?: string;
}
/**
 * Configuration for stdio MCP servers.
 */
export interface McpStdioClientConfig extends McpClientBaseConfig {
    /** Transport type (defaults to "stdio" when omitted) */
    transport?: 'stdio';
    /** Command to spawn the MCP server process */
    command: string;
    /** Arguments to pass to the command */
    args?: string[];
    /** Environment variables for the process */
    env?: Record<string, string>;
    /** Working directory for spawned process */
    cwd?: string;
}
/**
 * Configuration for remote MCP servers (SSE / Streamable HTTP).
 */
export interface McpRemoteClientConfig extends McpClientBaseConfig {
    /** Transport type */
    transport: 'sse' | 'http';
    /** MCP endpoint URL */
    url: string;
    /** Optional static headers */
    headers?: Record<string, string>;
    /** Optional OAuth provider for MCP auth flow */
    authProvider?: OAuthClientProvider;
    /** Optional bearer token injected into Authorization header */
    accessToken?: string;
    /** Optional env var name containing bearer token */
    accessTokenEnvVar?: string;
}
/**
 * Configuration for connecting to an MCP server.
 */
export type McpClientConfig = McpStdioClientConfig | McpRemoteClientConfig;
/**
 * Result of creating an MCP client with tools.
 */
export interface McpClientResult {
    /** AI SDK tools from the MCP server */
    tools: Record<string, Tool<unknown, unknown>>;
    /** Cleanup function to close the connection */
    cleanup: () => Promise<void>;
    /** Tool names grouped by source server name */
    serverToolNames: Record<string, string[]>;
}
/**
 * Options for combining multiple MCP toolsets.
 */
export interface CreateMcpToolsetsOptions {
    /** Strategy used when two MCP servers expose the same tool name */
    onNameCollision?: 'overwrite' | 'error';
}
/**
 * Create AI SDK tools from an MCP server.
 *
 * This adapter allows ContractSpec agents to consume tools
 * from external MCP servers (e.g., filesystem, database, etc.).
 *
 * @param config - MCP server configuration
 * @returns Tools and cleanup function
 *
 * @example
 * ```typescript
 * const { tools, cleanup } = await mcpServerToTools({
 *   name: 'filesystem',
 *   command: 'npx',
 *   args: ['-y', '@modelcontextprotocol/server-filesystem', '/path'],
 * });
 *
 * // Use tools in agent...
 *
 * await cleanup();
 * ```
 */
export declare function mcpServerToTools(config: McpClientConfig): Promise<McpClientResult>;
/**
 * Create multiple MCP tool sets from configurations.
 *
 * @param configs - Array of MCP server configurations
 * @param options - Merge options for conflicts
 * @returns Combined tools and cleanup function
 */
export declare function createMcpToolsets(configs: McpClientConfig[], options?: CreateMcpToolsetsOptions): Promise<McpClientResult>;
export {};
