import { T as Transport, M as MicroMcpServer } from '../server-DJJygNo1.cjs'; export { a as McpServerOptions, e as errorResult, r as rpcError, t as textResult } from '../server-DJJygNo1.cjs'; import { d as JsonRpcMessage } from '../types-ITRQFAir.cjs'; export { C as CallToolResult, e as ContentBlock, I as InitializeResult, j as JSONRPC_INTERNAL_ERROR, k as JSONRPC_INVALID_PARAMS, l as JSONRPC_INVALID_REQUEST, m as JSONRPC_METHOD_NOT_FOUND, n as JSONRPC_PARSE_ERROR, J as JsonObject, o as JsonRpcError, p as JsonRpcId, f as JsonRpcNotification, g as JsonRpcRequest, q as JsonRpcSuccess, h as JsonValue, M as MCP_PROTOCOL_VERSION, R as RegisterToolOptions, b as RegisteredTool, c as ServerCapabilities, S as ServerInfo, r as ToolAnnotations, i as ToolCallContext, T as ToolDefinition, a as ToolHandler, s as ToolInputSchema } from '../types-ITRQFAir.cjs'; import '../tool-host-BBSaU7IJ.cjs'; /** * InProcessTransport — direct function-call wiring between an in-page MCP * client (e.g. an embedded chat agent) and a MicroMcpServer running in * the same JS context. No serialization, no network. * * Usage: * * const t = new InProcessTransport(); * server.attach(t); * t.onServerMessage((msg) => { ... }); // client subscribes * t.send({ jsonrpc: "2.0", id: 1, method: "tools/list" }); // client → server */ declare class InProcessTransport implements Transport { private server?; private listeners; /** Bind to a server. Called from the client's setup, not directly. */ bindServer(server: MicroMcpServer): void; /** Server → client (delivered to subscribed listeners). */ send(message: JsonRpcMessage): void; /** Client → server. Awaitable so callers can flush. */ deliver(message: JsonRpcMessage): Promise; /** Subscribe to messages the server pushes to this client. */ onServerMessage(listener: (msg: JsonRpcMessage) => void): () => void; close(): void; } /** * Convenience: create a server-attached in-process transport in one call. */ declare function attachInProcess(server: MicroMcpServer): InProcessTransport; /** * RelayTransport — wraps any duplex JSON-frame channel (e.g. a Reverb * websocket private channel, a WebRTC data channel) so external agents * can talk to a browser-side MicroMcpServer. * * The host app owns the actual channel. This class only handles framing * (JSON.stringify / JSON.parse) and the server contract. * * Channel contract: * - host calls `transport.deliverFromRemote(payload)` with each frame * it receives from the remote agent * - host implements `sendToRemote(frame)` so the transport can deliver * server → client frames outward * * See docs/relay-protocol.md for the wire format. */ type RelayChannel = { sendToRemote: (frame: JsonRpcMessage) => void; /** Optional: notify the channel that the server is gone. */ onClose?: () => void; }; declare class RelayTransport implements Transport { private channel; private server?; constructor(channel: RelayChannel); bindServer(server: MicroMcpServer): void; send(message: JsonRpcMessage): void; /** * Host calls this with each frame received from the remote agent. Accepts * either a parsed object or a raw JSON string. */ deliverFromRemote(payload: JsonRpcMessage | string): Promise; close(): void; } /** * Convenience wiring. Returns the bound transport. */ declare function attachRelay(server: MicroMcpServer, channel: RelayChannel): RelayTransport; export { InProcessTransport, JsonRpcMessage, MicroMcpServer, type RelayChannel, RelayTransport, Transport, attachInProcess, attachRelay };