Token导航 LogoToken导航TokenDH.com
MCP Tauri Automation logo
开发工具未说明官方级别未说明来源级核验

MCP Tauri Automation

MCP Server

一款通过AI自动化测试Tauri桌面应用的工具,支持自然语言交互、截图调试和UI流程测试。

工具数

9

提示词数

0

GitHub Stars

2

资源数

0
TypeScriptClaude开发工具Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Radek44

提供方

Radek44

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP Tauri自动化

使用人工智能自动化Tauri桌面应用程序。 一个MCP服务器,允许Claude Code通过自然语言测试、调试和与Tauri应用程序交互。

这是什么?

测试Tauri应用程序通常意味着:

  • ❌ 手动点击UI以进行每次更改
  • ❌ 为简单的交互编写复杂的测试脚本
  • ❌ 手动截取屏幕截图以调试视觉问题
  • ❌ 在代码编辑器和正在运行的应用程序之间不断切换

使用此MCP服务器:

  • ✅ 让克劳德“点击提交按钮并检查结果”
  • ✅ 获取应用程序状态的即时屏幕截图
  • ✅ 测试UI通过自然语言流动
  • ✅ 在编写代码时自动化重复测试

快速开始

1.安装tauri驱动器

cargo install tauri-driver

2.安装此MCP服务器

git clone 
cd mcp-tauri-automation
npm install && npm run build

3.添加到MCP配置中

Claude Code (Recommended)

使用Claude Code CLI注册服务器:

# Simplest setup - works with any Tauri app
# (you'll specify which app to launch when you ask Claude)
claude mcp add --transport stdio tauri-automation \
  --scope user \
  -- node /absolute/path/to/mcp-tauri-automation/dist/index.js

替换 /absolute/path/to/mcp-tauri-automation 使用您克隆此仓库的实际路径。例如:

  • Linux/macOS: ~/projects/mcp-tauri-automation/dist/index.js
  • 窗户: C:/Users/YourName/projects/mcp-tauri-automation/dist/index.js

可选:设置默认应用程序路径

如果你主要使用一个Tauri应用程序,你可以将其设置为默认值:

claude mcp add --transport stdio tauri-automation \
  --env TAURI_APP_PATH=/path/to/your-app/src-tauri/target/debug/your-app \
  --scope user \
  -- node /absolute/path/to/mcp-tauri-automation/dist/index.js
💡 我可以测试多个应用程序吗? 对!这 TAURI_APP_PATH 这只是一个方便的默认设置。当你询问Claude时,你仍然可以通过指定路径来启动任何其他Tauri应用程序(例如,“在~/projects/calculator app/target/debug/calculator上启动我的计算器应用程序”)。

高级:自定义默认值

claude mcp add --transport stdio tauri-automation \
  --env TAURI_SCREENSHOT_DIR=./my-screenshots \
  --env TAURI_DEFAULT_TIMEOUT=10000 \
  --scope user \
  -- node /absolute/path/to/mcp-tauri-automation/dist/index.js

所有环境变量都有合理的默认值,并且是可选的:

  • TAURI_APP_PATH:无默认值(启动时指定,或为方便起见在此处设置)
  • TAURI_SCREENSHOT_DIR: ./screenshots (相对于运行Claude Code的位置)
  • TAURI_WEBDRIVER_PORT: 4444 (金牛座司机在听)
  • TAURI_DEFAULT_TIMEOUT: 5000 ms(等待UI元素的时间)

管理服务器:

# List all configured servers
claude mcp list

# Get details for a specific server
claude mcp get tauri-automation

# Remove a server
claude mcp remove tauri-automation

# Inside Claude Code, check server status
/mcp

替代:JSON格式

Click to see JSON configuration format

claude mcp add-json tauri-automation '{
  "type": "stdio",
  "command": "node",
  "args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"],
  "env": {
    "TAURI_APP_PATH": "/optional/default/app/path"
  }
}'

范围选项:

  • --scope user:适用于所有项目(推荐)
  • --scope local (默认):仅在当前项目中对您可用
  • --scope project:通过与项目中的每个人共享 .mcp.json 文件

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "tauri-automation": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"]
    }
  }
}

可选:添加环境变量

{
  "mcpServers": {
    "tauri-automation": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"],
      "env": {
        "TAURI_APP_PATH": "/path/to/your/default/app"
      }
    }
  }
}

Claude Code (Manual Config)

编辑 ~/.config/claude-code/mcp_config.json:

{
  "mcpServers": {
    "tauri-automation": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"]
    }
  }
}

可选:添加环境变量

{
  "mcpServers": {
    "tauri-automation": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-tauri-automation/dist/index.js"],
      "env": {
        "TAURI_APP_PATH": "/path/to/your/default/app"
      }
    }
  }
}

备注:使用 claude mcp add 命令(见上面的“克劳德代码(推荐)”)比手动编辑更容易,更不容易出错。

Other MCP Clients

任何支持stdio传输的MCP客户端都可以使用此服务器。通过客户端的配置机制传递环境变量。

4.启动tauri驱动程序

在使用MCP服务器之前,请启动 tauri-driver 在单独的终端中:

# In a separate terminal, keep this running
tauri-driver
为什么金牛座的司机是分开的? tauri-driver 是一个独立的WebDriver服务器,用于控制Tauri应用程序。保持独立意味着: - ✅ 您可以在不丢失应用程序状态的情况下重新启动MCP服务器 - ✅ 多个工具可以连接到同一个驱动程序实例 - ✅ 它在易于配置的已知端口(4444)上运行 未来改进:如果此MCP服务器未运行,则可以将其增强为自动启动tauri驱动程序。有兴趣贡献吗?看 贡献 在......下面

5.与Claude一起使用

Launch my Tauri app, click the "Start" button, and take a screenshot

或者,如果您没有设置默认应用程序路径:

Launch my calculator app at ~/projects/calculator/target/debug/calculator and test addition

可用工具

工具说明
launch_app启动您的Tauri应用程序
close_app关闭正在运行的应用程序
capture_screenshot截图(返回base64 PNG)
click_element通过CSS选择器单击UI元素
type_text在输入字段中键入
wait_for_element等待元素出现
get_element_text从元素中读取文本
execute_tauri_command调用Tauri IPC命令
get_app_state检查应用程序是否正在运行并获取会话信息

配置

所有环境变量都是可选的 有合理的默认值:

变量描述默认值何时设置
TAURI_APP_PATHTauri应用程序二进制文件的路径如果你主要使用一个应用程序(但你仍然可以启动其他应用程序),则设置
TAURI_SCREENSHOT_DIR在哪里保存截图./screenshots如果你想在不同的位置截图,请更改
TAURI_WEBDRIVER_PORTtauri司机奔跑的港口4444只有当你在自定义港口运行tauri驱动程序时
TAURI_DEFAULT_TIMEOUT元素等待超时(毫秒)5000加载速度较慢的应用程序增加,反馈速度较快的应用程序减少
TAURI_DRIVER_PATHtauri驱动程序二进制文件的路径tauri-driver只有当tauri司机不在您的路径中时

查找您的Tauri应用程序二进制文件

构建Tauri应用程序后,二进制文件位于:

  • 开发建设: your-tauri-project/src-tauri/target/debug/your-app-name
  • 发布版本: your-tauri-project/src-tauri/target/release/your-app-name
  • macOS应用程序:添加 .app 扩展(例如。, your-app-name.app)
  • Windows应用程序:添加 .exe 扩展

先构建你的应用程序:

cd your-tauri-project
cargo build  # or: cargo build --release

用法示例

基本测试工作流程

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

调试UI问题

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

测试Tauri命令

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

建筑

┌─────────────────┐
│   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        │
└─────────────────┘

故障排除

“启动应用程序失败:连接ECONNREFUSED”

解决方案:确保 tauri-driver 在使用MCP服务器之前正在运行。

# In a separate terminal
tauri-driver

“找不到元素:#我的按钮”

解决方案:

  1. 使用 wait_for_element 首先用于动态加载的内容
  2. 验证浏览器DevTools中的选择器(Tauri应用程序使用web技术)
  3. 增加慢速加载UI的超时时间

“找不到应用程序路径”

解决方案:

  1. 首先构建您的Tauri应用程序: cargo build
  2. 使用二进制文件的绝对路径
  3. 确保二进制文件可执行: chmod +x /path/to/app
  4. 在macOS上,使用 .app 捆绑路径

端口冲突(端口4444已在使用中)

解决方案:使用自定义端口:

# Start tauri-driver on different port
tauri-driver --port 4445

然后更新您的MCP配置:

{
  "env": {
    "TAURI_WEBDRIVER_PORT": "4445"
  }
}

屏幕截图未显示

解决方案:

  1. 确保应用程序确实在运行:让Claude检查 get_app_state
  2. 检查屏幕截图目录是否存在并且可写
  3. 对于base64屏幕截图(默认),请确保您的MCP客户端支持图像显示

运作原理

此服务器使用WebDriver协议来控制Tauri应用程序。事情是这样的:

  1. 金牛座司机 充当Tauri应用程序的WebDriver服务器
  2. 此MCP服务器 将Claude的请求转换为WebDriver命令
  3. WebDriver IO 处理低级WebDriver通信
  4. 您的Tauri应用程序 响应自动化命令

服务器维护一个活动会话,并确保在关闭应用程序或关机时进行适当的清理。

高级用法

调用自定义Tauri命令

首先,在您的 src-tauri/src/main.rs:

#[tauri::command]
fn get_user_data(user_id: i32) -> Result {
    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");
}

然后问克劳德:

Execute the get_user_data command with user_id 123

多次试运行

服务器可以在会话中多次启动和关闭应用程序:

Launch the app, test feature A, close it.
Launch again, test feature B, close it.

发展

# 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

需求

  • Node.js 18+
  • 锈蚀/货物 (适用于金牛座司机)
  • 金牛座司机 已安装并正在运行
  • A. 构建Tauri应用程序 测试

许可证

麻省理工学院

致谢

目录标签

目录标签

TypeScriptClaude开发工具Tauri自动化本地部署AI测试桌面应用测试自然语言编程WebDriver

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

9

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明nonelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP