import { Plugin } from 'vite'; interface SynapseVitePluginOptions { /** App name. If omitted, reads from ../manifest.json */ appName?: string; /** Path to manifest.json. Default: ../manifest.json (relative to ui/) */ manifest?: string; /** * Shell command to start the MCP server. If omitted, derived from manifest. * The server runs in stdio mode — stdin/stdout JSON-RPC. */ serverCmd?: string; /** Set to false to disable the preview host page at /__preview */ preview?: boolean; } /** * Synapse Vite plugin — full local dev experience for MCP apps. * * What it does: * - Reads ../manifest.json to get app name and server config * - Spawns the MCP server as a child process (stdio mode) * - Serves a preview host page at /__preview that iframes your app * - Proxies the iframe's tool calls and resource reads through POST /__mcp to * the server, the pair its handshake announces as `serverTools` and * `serverResources` * - Forwards the server's `notifications/resources/list_changed` to the iframe * (over GET /__events), as an MCP Apps host does, so `useDataSync` fires * - Handles the ext-apps handshake so Synapse hooks work * - HMR works inside the iframe — edit .tsx, see changes instantly * * Usage in vite.config.ts: * import { synapseVite } from "@nimblebrain/synapse/vite"; * export default { plugins: [react(), viteSingleFile(), synapseVite()] }; * * Then: cd ui && npm run dev && open http://localhost:5173/__preview */ declare function synapseVite(options?: SynapseVitePluginOptions): Plugin; export { type SynapseVitePluginOptions, synapseVite };