快速开始
Tapilot 有三种使用方式,选择最适合你的:
方式 1: MCP 协议(AI 助手直接调用)
bash
npx mobai-mcp在 Claude Code 或 Cursor 的 MCP 配置中添加:
json
{
"mcpServers": {
"mobai": {
"command": "npx",
"args": ["mobai-mcp"]
}
}
}配置后 AI 助手自动获得 37 个设备操控工具。
方式 2: HTTP REST API
bash
npx mobai-api
# 监听 http://localhost:3210bash
# 列出设备
curl http://localhost:3210/devices
# 截图
curl http://localhost:3210/devices/emulator-5554/screenshot -o screen.png
# 点击
curl -X POST http://localhost:3210/devices/emulator-5554/tap \
-H "Content-Type: application/json" \
-d '{"label": "Settings"}'
# 视觉断言
curl -X POST http://localhost:3210/devices/emulator-5554/assert-visual \
-H "Content-Type: application/json" \
-d '{"prompt": "页面显示了设置列表"}'方式 3: DSL 测试脚本
yaml
id: my-test
platform: android
vars:
APP: com.example.app
steps:
- launch: { package: "${APP}", force: true }
- waitStable: { timeoutMs: 5000 }
- tap: Login
- input: admin@example.com
- assert: Welcome运行:
bash
node --experimental-strip-types apps/mcp-server/scripts/run-test-pack.ts my-test前提条件
- Node.js 20+
- adb 在 PATH 中(
brew install android-commandlinetools) - 设备已连接(USB 调试开启 + 已授权)
- 可选: Xcode(iOS 支持)、
GEMINI_API_KEY(AI 功能)