import type { McpServerRef, ToolDef } from './types.js'; export { isNonPublicAddress } from './public-address.js'; /** * A one-shot MCP client for `scan`: initialize, list every tool, close. * * It never calls a tool, reads a resource or answers a sampling request. Over * stdio it starts the server the way the client config says to — which runs * that program, exactly as the MCP client would — so `scan --no-launch` exists * for places (CI on a pull request) where running it is not acceptable. */ export declare const PROTOCOL_VERSION = "2025-06-18"; export declare const RESPONSE_BYTES: number; export interface FetchedServer { tools: ToolDef[]; serverInfo?: { name?: string; version?: string; }; protocolVersion?: string; instructions?: string; } export interface ClientOptions { timeoutMs: number; clientVersion: string; /** Remote servers only: refuse loopback, private, link-local and metadata addresses. */ publicOnly?: boolean; headers?: Record; /** stdio: base environment for the child (defaults to process.env). */ baseEnv?: NodeJS.ProcessEnv; cwd?: string; } export declare class McpClientError extends Error { readonly kind: 'timeout' | 'spawn' | 'protocol' | 'http' | 'network' | 'refused'; constructor(kind: 'timeout' | 'spawn' | 'protocol' | 'http' | 'network' | 'refused', message: string); } export declare function fetchStdio(ref: McpServerRef, opts: ClientOptions): Promise; /** Incremental SSE parser: yields `{event, data}` per dispatched event. */ export declare class SseParser { private buf; private event; private data; push(text: string): Array<{ event: string; data: string; }>; end(): Array<{ event: string; data: string; }>; } /** Streamable HTTP (2025-03-26 and later): every request is a POST; the reply is JSON or an SSE stream. */ export declare function fetchStreamableHttp(ref: McpServerRef, opts: ClientOptions): Promise; /** Legacy HTTP+SSE (2024-11-05): GET opens the stream, its `endpoint` event names where to POST. */ export declare function fetchLegacySse(ref: McpServerRef, opts: ClientOptions): Promise; /** Dispatch on the server's transport. */ export declare function fetchServer(ref: McpServerRef, opts: ClientOptions): Promise; //# sourceMappingURL=mcp-client.d.ts.map