MCP Tauri Automation
Enables AI-driven testing and automation of Tauri desktop applications through natural language, allowing users to interact with UI elements, capture screenshots, execute commands, and test application flows without manual clicking or complex scripts.
README
MCP Tauri Automation
Automate Tauri desktop apps with AI. An MCP server that lets Claude Code test, debug, and interact with your Tauri applications through natural language.
What is this?
Testing Tauri apps usually means:
- ❌ Manually clicking through UIs for every change
- ❌ Writing complex test scripts for simple interactions
- ❌ Taking screenshots manually to debug visual issues
- ❌ Switching between code editor and running app constantly
With this MCP server:
- ✅ Ask Claude to "click the submit button and check the result"
- ✅ Get instant screenshots of your app state
- ✅ Test UI flows through natural language
- ✅ Automate repetitive testing while you code
Quick Start
1. Install tauri-driver
cargo install tauri-driver
2. Install this MCP server
git clone <repo-url>
cd mcp-tauri-automation
npm install && npm run build
3. Add to your MCP config
<details> <summary><b>Claude Desktop</b></summary>
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"tauri-automation": {
"command": "node",
"args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"],
"env": {
"TAURI_APP_PATH": "/path/to/your/tauri/app/target/debug/your-app"
}
}
}
}
</details>
<details> <summary><b>Claude Code CLI</b></summary>
Edit ~/.config/claude-code/mcp_config.json:
{
"mcpServers": {
"tauri-automation": {
"command": "node",
"args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"],
"env": {
"TAURI_APP_PATH": "/path/to/your/tauri/app/target/debug/your-app"
}
}
}
}
</details>
<details> <summary><b>Other MCP Clients</b></summary>
Any MCP client that supports stdio transport can use this server. Pass the environment variables via the client's configuration mechanism.
</details>
4. Start tauri-driver
# In a separate terminal, keep this running
tauri-driver
5. Use with Claude
Launch my Tauri app, click the "Start" button, and take a screenshot
Available Tools
| Tool | Description |
|---|---|
launch_app |
Launch your Tauri application |
close_app |
Close the running application |
capture_screenshot |
Take a screenshot (returns base64 PNG) |
click_element |
Click UI elements by CSS selector |
type_text |
Type into input fields |
wait_for_element |
Wait for elements to appear |
get_element_text |
Read text from elements |
execute_tauri_command |
Call your Tauri IPC commands |
get_app_state |
Check if app is running and get session info |
Configuration
Configure the server using environment variables:
| Variable | Description | Default |
|---|---|---|
TAURI_APP_PATH |
Path to your Tauri app binary | None (required in tool call or env) |
TAURI_SCREENSHOT_DIR |
Where to save screenshots | ./screenshots |
TAURI_WEBDRIVER_PORT |
Port where tauri-driver runs | 4444 |
TAURI_DEFAULT_TIMEOUT |
Element wait timeout in ms | 5000 |
TAURI_DRIVER_PATH |
Path to tauri-driver binary | tauri-driver |
Finding Your Tauri App Binary
After building your Tauri app, the binary is located at:
- Development build:
your-tauri-project/src-tauri/target/debug/your-app-name - Release build:
your-tauri-project/src-tauri/target/release/your-app-name - macOS apps: Add
.appextension (e.g.,your-app-name.app) - Windows apps: Add
.exeextension
Build your app first:
cd your-tauri-project
cargo build # or: cargo build --release
Usage Examples
Basic Testing Workflow
You: Launch my calculator app and test the addition feature
Claude will:
1. Launch the app using launch_app
2. Wait for the UI to load with wait_for_element
3. Click buttons and type numbers
4. Capture screenshots to verify results
5. Report back with findings
Debugging UI Issues
You: Take a screenshot of my app's settings page
Claude will:
1. Check if app is running (or launch it)
2. Navigate to settings (if needed)
3. Capture and display the screenshot
Testing Tauri Commands
You: Call the save_preferences command with theme='dark' and verify it worked
Claude will:
1. Use execute_tauri_command to call your Rust backend
2. Verify the response
3. Optionally check the UI updated correctly
Architecture
┌─────────────────┐
│ Claude Code │ Ask in natural language
└────────┬────────┘
│ MCP Protocol (stdio)
┌────────▼────────────────┐
│ MCP Tauri Automation │ Translate to automation commands
│ Server │
└────────┬────────────────┘
│ WebDriver Protocol
┌────────▼────────┐
│ tauri-driver │ Control the application
└────────┬────────┘
│
┌────────▼────────┐
│ Your Tauri │ Desktop app being tested
│ App │
└─────────────────┘
Troubleshooting
"Failed to launch application: connect ECONNREFUSED"
Solution: Make sure tauri-driver is running before using the MCP server.
# In a separate terminal
tauri-driver
"Element not found: #my-button"
Solutions:
- Use
wait_for_elementfirst for dynamically loaded content - Verify the selector in your browser DevTools (Tauri apps use web technologies)
- Increase timeout for slow-loading UIs
"Application path not found"
Solutions:
- Build your Tauri app first:
cargo build - Use absolute path to the binary
- Make sure the binary is executable:
chmod +x /path/to/app - On macOS, use the
.appbundle path
Port conflicts (Port 4444 already in use)
Solution: Use a custom port:
# Start tauri-driver on different port
tauri-driver --port 4445
Then update your MCP config:
{
"env": {
"TAURI_WEBDRIVER_PORT": "4445"
}
}
Screenshots not appearing
Solutions:
- Ensure the app is actually running: ask Claude to check with
get_app_state - Check that the screenshots directory exists and is writable
- For base64 screenshots (default), ensure your MCP client supports image display
How It Works
This server uses the WebDriver protocol to control Tauri applications. Here's what happens:
- tauri-driver acts as a WebDriver server for Tauri apps
- This MCP server translates Claude's requests into WebDriver commands
- WebDriverIO handles the low-level WebDriver communication
- Your Tauri app responds to automation commands
The server maintains a single active session and ensures proper cleanup when closing apps or on shutdown.
Advanced Usage
Calling Custom Tauri Commands
First, expose commands in your src-tauri/src/main.rs:
#[tauri::command]
fn get_user_data(user_id: i32) -> Result<String, String> {
Ok(format!("User {}", user_id))
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![get_user_data])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Then ask Claude:
Execute the get_user_data command with user_id 123
Multiple Test Runs
The server can launch and close apps multiple times in a session:
Launch the app, test feature A, close it.
Launch again, test feature B, close it.
Development
# Build
npm run build
# Watch mode
npm run watch
# Project structure
src/
├── index.ts # MCP server entry point
├── tauri-driver.ts # WebDriver wrapper
├── types.ts # TypeScript types
└── tools/
├── launch.ts # App lifecycle
├── screenshot.ts # Screenshot capture
├── interact.ts # UI interaction
└── state.ts # State & IPC commands
Requirements
- Node.js 18+
- Rust/Cargo (for tauri-driver)
- tauri-driver installed and running
- A built Tauri application to test
License
MIT
Acknowledgments
- Built with @modelcontextprotocol/sdk
- Powered by WebDriverIO
- Made for Tauri applications
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。