m

mcp-server-tauri

@hypothesi/mcp-server-tauri
0 Stars 215 次浏览 hypothesi 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "tauri": {
      "args": [
        "-y",
        "@hypothesi/tauri-mcp-server"
      ],
      "command": "npx"
    }
  }
}

服务介绍

MCP Server Tauri

Give your AI assistant superpowers for Tauri development

npm version
crates.io

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 happeningand 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 to Cargo.toml:

[dependencies]
tauri-plugin-mcp-bridge = "0.1"

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

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_mcp_bridge::init())
        .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.

2. Configure Your AI Assistant

Use the Claude Code CLI:

claude mcp add tauri npx @hypothesi/tauri-mcp-server

Or manually add to your config (Cmd/Ctrl+Shift+P "MCP: Edit Config"):

{
  "mcpServers": {
    "tauri": {
      "command": "npx",
      "args": ["-y", "@hypothesi/tauri-mcp-server"]
    }
  }
}

Click to install:

Or manually: Go to Cursor Settings MCP New MCP Server:

{
  "mcpServers": {
    "tauri": {
      "command": "npx",
      "args": ["-y", "@hypothesi/tauri-mcp-server"]
    }
  }
}

Click to install:

Or via CLI:

code --add-mcp '{"name":"tauri","command":"npx","args":["-y","@hypothesi/tauri-mcp-server"]}'

Or manually add to settings.json:

{
  "mcp.servers": {
    "tauri": {
      "command": "npx",
      "args": ["-y", "@hypothesi/tauri-mcp-server"]
    }
  }
}

In the Cascade pane, the "MCPs" icon (it looks like a plug), then click the settings icon
in the top right corner.

Or, go to Windsurf Settings Cascade and under the MCP Servers heading click Open MCP Marketplace. Then in the Marketplace, click the gear icon to edit the config.

Add:

{
  "mcpServers": {
    "tauri": {
      "command": "npx",
      "args": ["-y", "@hypothesi/tauri-mcp-server"]
    }
  }
}

Follow the Cline MCP configuration guide and use:

{
  "mcpServers": {
    "tauri": {
      "command": "npx",
      "args": ["-y", "@hypothesi/tauri-mcp-server"]
    }
  }
}

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

Tool Description
tauri_list_windows List all open webview windows
tauri_webview_screenshot Capture webview screenshots
tauri_driver_session Start/stop automation session
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

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

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
Tool Description
tauri_list_devices List Android devices and iOS simulators
tauri_launch_emulator Launch Android AVD or iOS Simulator
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
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
# 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

相关 MCP 服务