Skip to content

hypothesi/mcp-server-tauri

Repository files navigation

MCP Server Tauri

MCP Server Tauri

Give your AI assistant superpowers for Tauri development

npm version crates.io License: MIT Tauri v2

Documentation · Getting Started · Available Tools


A Model Context Protocol (MCP) server that enables AI assistants like Claude, Cursor, and Windsurf to build, test, and debug Tauri v2 applications. Screenshots, DOM state, and console logs from your running app give the AI rich context to understand what's happening—and tools to interact with it.

✨ Features

Category Capabilities
🎯 UI Automation Screenshots, clicks, typing, scrolling, element finding
🔍 IPC Monitoring Capture and inspect Tauri IPC calls in real-time
📱 Mobile Dev Manage iOS simulators & Android emulators
🛠️ CLI Integration Run any Tauri command (init, dev, build, etc.)
⚙️ Configuration Read/write Tauri config files with validation
📋 Logs Stream Android logcat, iOS device logs, system logs

Disclaimer: This MCP was developed using agentic coding tools. It may contain bugs.

🚀 Quick Start

Prerequisites

  • Node.js 20+ and npm
  • Rust and Cargo (for Tauri development)
  • Tauri CLI: npm install -g @tauri-apps/cli@next
  • For mobile: Xcode (macOS) or Android SDK

1. Add the MCP Bridge Plugin to Your Tauri App

Add the Rust crate:

cargo add tauri-plugin-mcp-bridge

Register in src-tauri/src/main.rs:

fn main() {
    let mut builder = tauri::Builder::default();

    #[cfg(debug_assertions)]
    {
        builder = builder.plugin(tauri_plugin_mcp_bridge::init());
    }

    builder
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Enable Global Tauri in tauri.conf.json:

{
  "app": {
    "withGlobalTauri": true
  }
}

⚠️ Required: Without withGlobalTauri, the MCP server cannot interact with your application's webview.

Note: The npm package @hypothesi/tauri-plugin-mcp-bridge is optional. It provides TypeScript bindings if you want to call the plugin from your app's frontend code. The MCP server communicates with the Rust plugin directly via WebSocket.

2. Configure Your AI Assistant

Use install-mcp to add the server to your AI assistant:

npx -y install-mcp @hypothesi/tauri-mcp-server --client claude-code

Supported clients: claude-code, cursor, windsurf, vscode, cline, roo-cline, claude, zed, goose, warp, codex

Claude Code
npx -y install-mcp @hypothesi/tauri-mcp-server --client claude-code
Cursor
npx -y install-mcp @hypothesi/tauri-mcp-server --client cursor
VS Code / Copilot
npx -y install-mcp @hypothesi/tauri-mcp-server --client vscode
Windsurf
npx -y install-mcp @hypothesi/tauri-mcp-server --client windsurf
Cline
npx -y install-mcp @hypothesi/tauri-mcp-server --client cline

That's it! Restart your AI assistant and you're ready to build Tauri apps. 🎉

Note: See the plugin documentation for advanced configuration options.


💬 Slash Commands (Prompts)

The server provides slash commands for guided, multi-step workflows:

Command Description
/fix-webview-errors Find and fix JavaScript errors in your webview. Connects to your app, retrieves console errors, analyzes them, and helps you fix the issues.

Just type the command in your AI assistant to start a guided debugging session.


🧰 Available Tools

UI Automation — Screenshots, clicks, typing, and more
Tool Description
tauri_webview_screenshot Capture webview screenshots
tauri_list_windows List all open webview windows
tauri_webview_find_element Find elements by selector
tauri_webview_interact Click, scroll, swipe, long-press
tauri_webview_keyboard Type text or send key events
tauri_webview_wait_for Wait for elements, text, or events
tauri_webview_get_styles Get computed CSS styles
tauri_webview_execute_js Execute JavaScript in webview
tauri_webview_focus_element Focus on elements
tauri_driver_get_console_logs Get browser console logs
tauri_read_platform_logs Read Android/iOS/system logs
tauri_driver_session Start/stop automation session

Multi-Window Support: All webview tools accept an optional windowId parameter to target specific windows. Use tauri_list_windows to discover available windows.

IPC & Plugin — Deep Tauri integration
Tool Description
tauri_plugin_execute_ipc Execute Tauri IPC commands
tauri_plugin_get_window_info Get window information
tauri_plugin_get_backend_state Get app metadata and state
tauri_plugin_ipc_monitor Start/stop IPC monitoring
tauri_plugin_ipc_get_events Get captured IPC events
tauri_plugin_emit_event Emit custom events
Mobile Development — Emulators and simulators
Tool Description
tauri_list_devices List Android devices and iOS simulators
tauri_launch_emulator Launch Android AVD or iOS Simulator
Project Management — CLI, config, and docs
Tool Description
tauri_run_command Run any Tauri CLI command
tauri_read_config Read Tauri config files (including platform-specific)
tauri_write_config Write config files with validation
tauri_get_docs Fetch Tauri documentation

🏗️ Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        AI Assistant                             │
│                  (Claude, Cursor, Windsurf)                     │
└─────────────────────────┬───────────────────────────────────────┘
                          │ MCP Protocol (stdio)
                          ▼
┌─────────────────────────────────────────────────────────────────┐
│                     MCP Server (Node.js)                        │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────┐   │
│  │   Manager    │  │    Driver    │  │      Monitor         │   │
│  │  CLI/Config  │  │ UI Automation│  │   Logs/IPC Events    │   │
│  └──────────────┘  └──────┬───────┘  └──────────────────────┘   │
└─────────────────────────────┼───────────────────────────────────┘
                              │ WebSocket (port 9223)
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                      Tauri Application                          │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │              MCP Bridge Plugin (Rust)                    │   │
│  │         IPC Commands • Events • Backend State            │   │
│  └──────────────────────────────────────────────────────────┘   │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                    Webview (DOM/UI)                      │   │
│  └──────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────┘

Why this approach?

  • Rich AI context — Screenshots, DOM, and logs help the AI understand your app's state
  • Cross-platform — Works on Linux, Windows, macOS, Android, and iOS
  • No external drivers — No Selenium, Playwright, or browser automation needed
  • Native integration — Direct access to Tauri's IPC and backend

🧑‍💻 Development

# Clone and install
git clone https://github.com/hypothesi/mcp-server-tauri.git
cd mcp-server-tauri
npm install

# Build all packages
npm run build

# Run tests
npm test

# Development mode
npm run dev -w @hypothesi/tauri-mcp-server
Project Structure
mcp-server-tauri/
├── packages/
│   ├── mcp-server/              # MCP server (TypeScript)
│   ├── tauri-plugin-mcp-bridge/ # Tauri plugin (Rust + JS bindings)
│   └── test-app/                # Test Tauri application
├── docs/                        # VitePress documentation
└── specs/                       # Architecture specs
Releasing
# Release plugin (Cargo + npm)
npm run release:plugin patch

# Release server (npm only)
npm run release:server patch

See specs/releasing.md for details.


📚 Documentation


🤝 Contributing

Contributions are welcome! Please:

  1. Follow existing code patterns
  2. Add tests for new features
  3. Update documentation
  4. Ensure npm test and npm run standards pass

📄 License

MIT © hypothesi

About

A Model Context Protocol (MCP) server and plugin for Tauri v2 development

Resources

License

Stars

Watchers

Forks

Packages

No packages published