The app uses MCP Server Tauri to let AI assistants (Claude Code, Cursor) control this app: take screenshots, click buttons, and read front-end logs.
The MCP bridge requires withGlobalTauri: true which exposes window.__TAURI__ to the frontend. This would be a huge
security risk in production (untrusted JS could access system APIs, not good), so we enable it only in development:
- Compile-time exclusion: The MCP plugin is only registered via
#[cfg(debug_assertions)]inlib.rs - Config separation:
"withGlobalTauri": falseintauri.conf.json(production), only overridden viatauri.dev.jsonduring dev - Wrapper script:
apps/desktop/scripts/tauri-wrapper.jsinjects-c src-tauri/tauri.dev.jsononly fordevcommands. (pnpm tauri devcalls the wrapper which adds-c src-tauri/tauri.dev.json, then Tauri merges this withtauri.conf.jsonvia JSON Merge Patch (RFC 7396).))
To avoid security issues in dev mode, always add a condition to disable that functionality in dev mode. This way, malicious websites can't access the system APIs even on your machine.