Primary
WebSocket bridge
The bridge listens on 127.0.0.1, ports 9300–9400. The page runs the script and returns the result on the socket. This path does not need window.__TAURI__.
window.__TAURI__.A CLI for deep inspection and interaction with Tauri v2 desktop apps, and the plugin that embeds an MCP server and opens the localhost socket the page connects to.
Install the CLI
brew tap dickwu/tap
brew install dickwu/tap/tauri-connector
Formula 0.17.8 installs tauri-connector and tauri-connector-mcp on macOS and Linux.
window.__TAURI__is absent in this content world
tauri-plugin-mcp-bridge injects JavaScript that sends results back through window.__TAURI__. On macOS, WKWebView runs that script in an isolated content world. The object is not there. execute_js, DOM snapshots, and console tools wait until they time out.
tauri-connector is the drop-in replacement that does not use that object for the return path. A small script in the page opens a WebSocket to the plugin on 127.0.0.1. Scripts and results travel on that socket. The MCP server runs inside the plugin and starts when the app starts.
The plugin tries the socket first. Both paths share one request id and one deadline. A timeout or a JavaScript error after the script has been dispatched is not run a second time. The caller gets an explicit failure, or an uncertain outcome.
Primary
The bridge listens on 127.0.0.1, ports 9300–9400. The page runs the script and returns the result on the socket. This path does not need window.__TAURI__.
Fallback
Used only when the socket confirms the script was not dispatched. The plugin can inject the script with window.eval and take the result from a Tauri event. Set app.withGlobalTauri to true in tauri.conf.json for this path.
Homebrew puts the command-line tools on your PATH. It does not register the plugin inside a Tauri app. Do these in order.
brew tap dickwu/tap
brew install dickwu/tap/tauri-connector
The formula installs tauri-connector and tauri-connector-mcp. tauri-connector --version prints 0.17.8.
Add the tauri-plugin-connector crate and register it. The README quick start keeps that dependency behind a dev-connector Cargo feature, so a normal release build does not compile the plugin.
Run the app. The CLI uses 127.0.0.1 and port 9555 unless --host, --port, TAURI_CONNECTOR_HOST, TAURI_CONNECTOR_PORT, or a nearby .connector.json says otherwise. Embedded MCP is at http://127.0.0.1:9556/mcp. tauri-connector doctor checks the project and prints a fix for each missing piece.
{
"mcpServers": {
"tauri-connector": {
"url": "http://127.0.0.1:9556/mcp"
}
}
}
From crates.io, pinned to the formula version:
cargo install connector-cli --version 0.17.8 --locked
Or build it from the repo with cargo build -p connector-cli --release. The binary is target/release/tauri-connector.
The agent skill is separate from the CLI: npx skills add dickwu/tauri-connector.
tauri-connector snapshot -i prints a tree with role, name, ref, and React component name, and stitches portals back under their trigger. Later commands address those refs. The same tools are on the embedded MCP server and the CLI.
tauri-connector snapshot -i
- complementary [component=MainMenu]
- menu [ref=e6, component=InheritableContextProvider]
- menuitem [ref=e7, component=LegacyMenuItem]
- img "calendar" [ref=e21]
- main [component=MainMenu]
- heading "Task Centre" [level=1, ref=e103]
- textbox "Search..." [ref=e16]
- combobox "Status" [ref=e50, component=InternalSelect, expanded=true]:
- listbox "Status options" [portal]:
- option "Active" [selected, ref=e51]
- option "Inactive" [ref=e52]
tauri-connector click @e51
tauri-connector fill @e16 "aspirin"
click @e51 clicks the Active option and fill @e16 fills the search box. Refs stay usable across later CLI calls.tauri-connector doctor checks the plugin dependency, registration, permissions, withGlobalTauri, @zumer/snapdom, and .mcp.json, and prints a fix for each missing piece.
tauri-connector screenshot captures the window with xcap. When xcap is unavailable it falls back to snapdom, which runs in the page with no CDN.
The CLI also drags, types, presses keys, reads logs, and calls IPC commands. The CLI reference and the MCP reference list every command.
Workflow run, get, cancel, and resume need a host token of at least 32 bytes. Without one, inspection still runs in debug mode.
The formula tauri-connector 0.17.8 installs two binaries, tauri-connector and tauri-connector-mcp. It does not add the plugin to your app. The app still depends on the tauri-plugin-connector crate.
The formula publishes macOS bottles for Apple silicon and Intel, and Linux bottles for arm64 and x86_64.
tauri-plugin-mcp-bridge sends JavaScript results through window.__TAURI__. On macOS, WKWebView runs that injected script in an isolated content world where window.__TAURI__ does not exist, so execute_js, DOM snapshots, and console tools time out. tauri-connector carries scripts and results on a WebSocket the page opens to 127.0.0.1.
By default the CLI WebSocket is ws://127.0.0.1:9555 and the embedded MCP server is http://127.0.0.1:9556/mcp. The internal bridge listens on 127.0.0.1 in the range 9300-9400. The plugin builder and environment variables can select other ports.
Without a host token, the plugin runs in debug mode: discovery, status, runtime health, rich screenshots, the element picker, and IPC capture work unauthenticated. Workflow run, get, cancel, and resume need a token of at least 32 bytes. Once the host sets that token, those inspection calls require it too. A shorter value is ignored.
No. Updating only the CLI cannot update the embedded plugin. Change the plugin crate in the app and rebuild it.
Yes. It is free and open source under the MIT license. The source is at https://github.com/dickwu/tauri-connector.
When the app is running, point the client at http://127.0.0.1:9556/mcp. The embedded server starts with the app. The standalone tauri-connector-mcp binary can attach over the WebSocket instead. npx skills add dickwu/tauri-connector installs the agent skill.