/** * `deepspace/testing/mcp` — dependency-free JSON-RPC client for exercising * the documentation MCP endpoint over its real HTTP wire contract. * * The endpoint is JSON-only (never SSE), stateless (no session ids), and * unauthenticated, so the client is plain `fetch`: incrementing request ids, * the negotiated `MCP-Protocol-Version` echoed after `initialize`, JSON-RPC * error objects surfaced as typed throws, and notifications resolved on the * wire's 202 + null body. It must stay importable without `@playwright/test`, * so it lives beside — never inside — `./index.ts`. */ interface McpTestClientOptions { /** Endpoint path resolved against the base URL. */ endpoint?: string; /** Fetch implementation, e.g. one bound to an in-process worker. */ fetch?: typeof fetch; } interface McpInitializeResult { protocolVersion: string; capabilities: Record; serverInfo: { name: string; version: string; title?: string; }; instructions?: string; } interface McpTool { name: string; title?: string; description?: string; inputSchema: Record; } interface McpToolCallResult { content: Array<{ type: string; text?: string; }>; structuredContent?: Record; isError?: boolean; } interface McpTestClient { /** Negotiated at `initialize`; writable so suites can force a wire mismatch. */ protocolVersion: string | undefined; initialize(params?: Record): Promise; listTools(): Promise; callTool(name: string, args?: Record): Promise; notify(method: string, params?: Record): Promise; } /** A JSON-RPC `error` object answered by the endpoint. */ declare class McpRpcError extends Error { readonly code: number; readonly data: unknown; readonly status: number; constructor(status: number, error: { code: number; message: string; data?: unknown; }); } /** A response outside the JSON-RPC contract, e.g. an unpublished surface's 404 page. */ declare class McpTransportError extends Error { readonly status: number; readonly bodyHead: string; constructor(status: number, body: string); } declare function createMcpTestClient(baseUrl: string, options?: McpTestClientOptions): McpTestClient; export { type McpInitializeResult, McpRpcError, type McpTestClient, type McpTestClientOptions, type McpTool, type McpToolCallResult, McpTransportError, createMcpTestClient };