/** * Minimal hand-rolled JSON-RPC 2.0 client for the Aexol MCP backend. * * Why hand-rolled, not @modelcontextprotocol/sdk? * - The Aexol backend speaks a non-standard MCP dialect (custom content types, * protocol version 0.1.0 negotiation, no SSE). The official SDK adds a lot * of negotiation overhead we don't need and would actively break against * this server. * - All we want is: POST a JSON-RPC envelope with a Bearer token, get a * JSON-RPC reply, surface errors. fetch() is built into Node 20+. */ export interface McpTool { name: string; description?: string; inputSchema: unknown; } export interface McpContentItem { type: string; json?: unknown; text?: string; [k: string]: unknown; } export interface McpToolCallResult { content: McpContentItem[]; isError?: boolean; } /** * Errors thrown by AexolMcpClient carry an optional HTTP `status` so callers * can produce friendlier messages (e.g. 401 → "invalid token"). */ export declare class AexolMcpError extends Error { readonly status?: number; readonly code?: number; constructor(message: string, opts?: { status?: number; code?: number; }); } export declare class AexolMcpClient { private readonly apiUrl; private readonly apiKey; private readonly timeoutMs; constructor(apiUrl: string, apiKey: string, timeoutMs?: number); /** Low-level: send a JSON-RPC call and return its `result` field. */ call(method: string, params?: unknown): Promise; /** * Fetch the tool catalog. The Aexol backend returns `{ tools: [...] }` * per JSON-RPC convention, but we accept the raw array shape too in case * the server format drifts. */ listTools(): Promise; /** * Invoke a single tool. Returns the raw `{ content, isError? }` envelope — * the caller (the spectral extension) decides how to surface it back to the model. */ callTool(name: string, args: unknown): Promise; } //# sourceMappingURL=mcp-client.d.ts.map