/** * Minimal subset of the Model Context Protocol (MCP) wire format that sigil * needs to act as a stdio tool server for Claude Code (and any other MCP * client). MCP rides on JSON-RPC 2.0; this module defines the request, * response, and notification shapes plus helpers for encoding. * * Spec reference: https://modelcontextprotocol.io/specification * * We implement: initialize, notifications/initialized, tools/list, tools/call. * Everything else (resources, prompts, sampling, completions, logging, * pagination cursors) is intentionally omitted. */ export declare const PROTOCOL_VERSION = "2025-06-18"; export declare const SERVER_INFO: { readonly name: "sigil-mcp"; readonly version: "0.0.1"; }; export type McpId = string | number | null; export interface McpRequest { jsonrpc: '2.0'; id: McpId; method: string; params?: unknown; } export interface McpNotification { jsonrpc: '2.0'; method: string; params?: unknown; } export interface McpSuccess { jsonrpc: '2.0'; id: McpId; result: unknown; } export interface McpErrorBody { code: number; message: string; data?: unknown; } export interface McpError { jsonrpc: '2.0'; id: McpId; error: McpErrorBody; } export type McpResponse = McpSuccess | McpError; export declare const MCP_PARSE_ERROR = -32700; export declare const MCP_INVALID_REQUEST = -32600; export declare const MCP_METHOD_NOT_FOUND = -32601; export declare const MCP_INVALID_PARAMS = -32602; export declare const MCP_INTERNAL_ERROR = -32603; export interface ToolInputSchema { type: 'object'; properties: Record; required?: string[]; additionalProperties?: boolean; } export interface ToolDefinition { name: string; description: string; inputSchema: ToolInputSchema; } export type ToolContent = { type: 'text'; text: string; }; export interface ToolResult { content: ToolContent[]; /** When omitted, treated as false. */ isError?: boolean; /** Structured payload for clients that want typed access; supplemental to content. */ structuredContent?: unknown; } /** * Parse a single NDJSON line into an MCP envelope. * * Returns: * - `{ kind: 'request', request }` for an incoming request (has id + method) * - `{ kind: 'notification', notification }` for an incoming notification (method, no id) * - `{ kind: 'parse_error' }` for non-JSON * - `{ kind: 'invalid', id, reason }` for a JSON object that isn't a valid envelope */ export type ParseResult = { kind: 'request'; request: McpRequest; } | { kind: 'notification'; notification: McpNotification; } | { kind: 'parse_error'; } | { kind: 'invalid'; id: McpId; reason: string; }; export declare function parseMessage(line: string): ParseResult; export declare function encodeSuccess(id: McpId, result: unknown): string; export declare function encodeError(id: McpId, code: number, message: string, data?: unknown): string; //# sourceMappingURL=protocol.d.ts.map