/**
 * MCP (Model Context Protocol) client integration for the Agent SDK.
 *
 * Connects to one or more external MCP servers, lists their tools, and
 * wraps each as a `ToolDefinition` ready to drop into a `ToolRegistry`.
 * Consumers get the entire MCP ecosystem (filesystem, github, sqlite,
 * puppeteer, ...) without hand-wrapping every tool.
 *
 * Symmetric to `src/serve/mcp-server.ts` (which exposes minicode's
 * tools as an MCP *server*); this is the *client* side.
 */
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import type { ToolDefinition } from "../agent/types.js";
/**
 * Configuration for a single MCP server. Three transports are
 * supported: spawn a subprocess (`stdio`, the most common shape),
 * connect to a hosted Streamable-HTTP endpoint (`http`), or connect
 * to a legacy SSE endpoint (`sse`).
 */
export type McpServerConfig = {
    name: string;
    transport: "stdio";
    command: string;
    args?: string[];
    env?: Record<string, string>;
    cwd?: string;
} | {
    name: string;
    transport: "http";
    url: string;
    headers?: Record<string, string>;
} | {
    name: string;
    transport: "sse";
    url: string;
    headers?: Record<string, string>;
};
export interface CreateMcpToolsOptions {
    servers: McpServerConfig[];
    /**
     * Prefix tool names with `<server>__` to avoid collisions across
     * servers that happen to expose the same tool name (e.g. multiple
     * servers exposing `read_file`). Default: true.
     */
    namespace?: boolean;
    /**
     * Called when a server fails to connect or list its tools. The
     * agent continues with the rest of the servers — a flaky GitHub
     * MCP shouldn't break filesystem MCP. Default: `console.warn`.
     */
    onError?: (server: string, error: unknown) => void;
}
export interface McpToolBundle {
    /** Tools ready to drop into a `ToolRegistry`. */
    tools: ToolDefinition[];
    /** Disconnect every connected client. Call on agent shutdown. */
    close: () => Promise<void>;
}
interface McpContentBlock {
    type: string;
    text?: string;
    data?: string;
    mimeType?: string;
    resource?: {
        uri: string;
        text?: string;
        blob?: string;
        mimeType?: string;
    };
    uri?: string;
    name?: string;
}
/**
 * Render an MCP tool result into a string the model can read.
 * Concatenates text blocks; non-text blocks become bracketed
 * placeholders so the model knows something was returned without
 * us having to support binary content end-to-end (out of scope for
 * v1 — see #168).
 */
export declare function formatMcpResult(content: ReadonlyArray<McpContentBlock>): string;
/**
 * Discover tools on a list of already-connected MCP clients and wrap
 * each as a `ToolDefinition`. The advanced entry point — most
 * consumers want `createMcpTools` instead, which also handles
 * spawning / connecting the underlying transport. Useful when the
 * caller wants to bring its own `Client` (e.g. a custom transport or
 * an in-memory test server).
 *
 * Ownership: the returned bundle takes ownership of every client
 * passed in. `bundle.close()` closes successful clients; any client
 * whose `listTools()` throws is also closed before `onError` fires,
 * so callers don't have to worry about leaked transports.
 */
export declare function wrapMcpClients(servers: Array<{
    name: string;
    client: Client;
}>, options?: {
    namespace?: boolean;
    onError?: CreateMcpToolsOptions["onError"];
}): Promise<McpToolBundle>;
/**
 * Connect to each configured MCP server, discover its tools, and
 * return them as `ToolDefinition`s ready to register. Servers that
 * fail to connect or list their tools are skipped (with a warning);
 * the bundle still includes tools from the servers that succeeded.
 */
export declare function createMcpTools(options: CreateMcpToolsOptions): Promise<McpToolBundle>;
export {};
//# sourceMappingURL=client-registry.d.ts.map