Tauri MCP Bridge Plugin
A Tauriยฎ plugin that bridges the Model Context Protocol (MCP) with Tauri applications, enabling deep inspection and interaction with Tauri's IPC layer, backend state, and window management.
๐ฆ This npm package is optional. It provides TypeScript bindings for calling the plugin from your app's frontend code. If you're just using the MCP Server for Tauri, you only need the Rust crate (
tauri-plugin-mcp-bridge)โthe MCP server communicates with it directly via WebSocket.
Overview
The MCP Bridge plugin extends MCP servers with direct access to Tauri internals. It provides real-time IPC monitoring, window state inspection, backend state access, and event emission capabilities.
Installation
Or add manually to your src-tauri/Cargo.toml:
[]
= "0.2"
Optional: TypeScript Bindings
If you want to call the plugin from your app's frontend code (not required for MCP server functionality):
Usage
Register the plugin in your Tauri application:
Custom Configuration
By default, the plugin binds to 0.0.0.0 (all interfaces) to support remote device development. For localhost-only access:
use Builder;
Features
1. IPC Monitoring
Monitor all Tauri IPC calls in real-time with timing and argument capture:
// Start monitoring
await invoke('plugin:mcp-bridge|start_ipc_monitor');
// Execute some commands to generate IPC traffic
await invoke('greet', { name: 'World' });
// Get captured events
const events = await invoke('plugin:mcp-bridge|get_ipc_events');
2. Window Information
Get detailed window state:
const windowInfo = await invoke('plugin:mcp-bridge|get_window_info');
// Returns: { width, height, x, y, title, focused, visible }
3. Backend State
Inspect application backend state:
const state = await invoke('plugin:mcp-bridge|get_backend_state');
// Returns: { app: { name, identifier, version }, tauri: { version },
// environment: { debug, os, arch, family }, windows: [...], timestamp }
4. Event Emission
Trigger custom events for testing:
await invoke('plugin:mcp-bridge|emit_event', {
eventName: 'custom-event',
payload: { data: 'test' }
});
MCP Server Integration
This plugin is part of the larger MCP Server for Tauri, which provides 18 total MCP tools for comprehensive Tauri development and testing. The plugin specifically enables the following tools:
Mobile Development Tools (1)
- list_devices - List connected Android devices and iOS simulators
UI Automation & WebView Tools (12)
Tools for UI automation and webview interaction via the plugin's WebSocket connection:
- driver_session - Manage automation session (start, stop, or status)
- manage_window - List windows, get window info, or resize windows
- webview_find_element - Find elements by CSS selector, XPath, text, or ref ID
- read_logs - Read logs (console, Android logcat, iOS, system)
- webview_interact - Perform gestures (click, double-click, long-press, swipe, scroll, focus)
- webview_screenshot - Take screenshots (JPEG default, with optional resizing)
- webview_keyboard - Type text or simulate keyboard events with optional modifiers
- webview_wait_for - Wait for element selectors, text content, or IPC events
- webview_get_styles - Get computed CSS styles for element(s)
- webview_execute_js - Execute arbitrary JavaScript code in the webview context
- webview_dom_snapshot - Get structured DOM snapshot (accessibility or structure type)
- get_setup_instructions - Get setup/update instructions for the MCP Bridge plugin
IPC Tools (5)
Tools that directly use the MCP Bridge plugin's Rust backend:
- ipc_execute_command - Execute any Tauri IPC command
- ipc_monitor - Manage IPC monitoring (start or stop)
- ipc_get_captured - Retrieve captured IPC traffic with optional filtering
- ipc_emit_event - Emit custom Tauri events for testing event handlers
- ipc_get_backend_state - Get backend application state and metadata
Architecture
MCP Server (Node.js)
โ
โโโ Native IPC (via plugin) โโโโ> Tauri App Webview (DOM/UI)
โ โ
โโโ Plugin Client โโโโโโโโโโโโโโโโโโโโโโโผโโ> Plugin Commands
(WebSocket port 9223) โ
โ
mcp-bridge Plugin
(Rust Backend)
WebSocket Communication
The plugin runs a WebSocket server on port 9223 (or next available in range 9223-9322) for real-time communication with the MCP server.
Remote Device Development
By default, the WebSocket server binds to 0.0.0.0 (all network interfaces), enabling connections from:
- iOS devices on the same network
- Android devices on the same network or via
adb reverse - Emulators/Simulators via localhost
Connecting from MCP Server
The MCP server supports connecting to remote Tauri apps via the driver_session tool:
// Connect to a Tauri app on a remote device
driver_session({ action: 'start', host: '192.168.1.100' })
// Or use environment variables:
// MCP_BRIDGE_HOST=192.168.1.100 npx mcp-server-tauri
// TAURI_DEV_HOST=192.168.1.100 npx mcp-server-tauri (same as Tauri CLI uses)
Connection Strategy
The MCP server uses a fallback strategy:
- Try
localhost:{port}first (most reliable for simulators/emulators/desktop) - If localhost fails and a remote host is configured, try
{host}:{port} - Auto-discover apps on localhost if specific connection fails
Development
Building the Plugin
From the plugin directory:
Or from the workspace root:
Documentation
View the comprehensive Rust API documentation:
Or directly:
Testing
Run the MCP server tests which include plugin integration tests:
Permissions
Add the plugin's default permission to your Tauri capabilities file (src-tauri/capabilities/default.json):
This grants all permissions required by the MCP server. The plugin is designed to work as a complete unitโpartial permissions are not recommended as the MCP server expects all commands to be available.
API Documentation
For detailed API documentation, including:
- Complete function signatures and parameters
- Rust examples for backend integration
- TypeScript examples for frontend usage
- Architecture and design details
Visit the docs.rs documentation or build locally with npm run docs:rust.
License
MIT ยฉ hypothesi
Trademark Notice
TAURIยฎ is a registered trademark of The Tauri Programme within the Commons Conservancy. https://tauri.app/
This project is not affiliated with, endorsed by, or sponsored by The Tauri Programme within the Commons Conservancy.