克劳德·莫比尔
用于移动、桌面和浏览器自动化的MCP服务器——Android(ADB)、iOS模拟器(simctl+WDA)、桌面(任何macOS应用程序)、Aurora OS(audb)和浏览器(CDP)。喜欢 Chrome中的克劳德 但适用于设备、应用程序和浏览器。
通过Claude用自然语言控制您的Android手机、模拟器、iOS模拟器、桌面应用程序、Aurora设备或无头浏览器。
______________________________________________________________________
目录
- 自制(macOS) - 一个衬里(任何客户) - 克劳德代码 - OpenCode - 其他代理(Pi、Qwen、Gemini、Codex、Cursor) - - 视窗
- 安卓 - iOS - 桌面 - 浏览器 - Aurora操作系统
______________________________________________________________________
快速开始
# Install via Homebrew (macOS)
brew tap AlexGladkov/claude-in-mobile https://github.com/AlexGladkov/claude-in-mobile
brew install claude-in-mobile
# Verify dependencies
claude-in-mobile doctor
# Add to Claude Code
claude mcp add --scope user --transport stdio mobile -- npx claude-in-mobile@latest然后自然地与克劳德交谈:
"Take a screenshot of the Android emulator"
"Tap on the Login button"
"Type hello in the search field"
"Switch to iOS simulator"______________________________________________________________________
功能概览
| 特性 | 描述 |
|---|---|
| 统一API | 相同的8个元工具可在Android、iOS、桌面、Aurora和浏览器上使用 |
| 令牌优化 | 8个元工具+3个可选模块,而不是81个工具(约85%的令牌减少) |
| 动态模块 | 浏览器、桌面、商店按需加载——默认工具列表保持精简 |
| 智能截图 | 自动压缩以实现最佳LLM处理 |
| 带注释的屏幕截图 | 彩色边界框+编号元素标签 |
| 加强安保 | Shell注入保护、URL验证、路径遍历阻止 |
| 结构化错误 | 键入带有自动恢复提示的错误代码 |
| 多设备并行 | 在多个设备上同时运行操作 |
| 流程引擎 | 批处理、条件循环和扇出流 |
| 权限管理 | 授予/撤销/重置应用程序权限(安卓+iOS) |
| 店铺发布 | Google Play、华为AppGallery、RuStore |
| 遥测 | 每个工具调用指标通过 system(action:'metrics') |
| 医生命令 | claude-in-mobile doctor --一次检查所有依赖关系 |
______________________________________________________________________
品质工程
Claude Mobile内置高级测试和监控功能:
| 功能 | 功能 | 使用方法 |
|---|---|---|
| 可访问性审计 | WCAG 2.2检查:缺少标签、触摸目标\ |
MCP server config for Qwen / Gemini / Codex / Cursor
Qwen代码 — .qwen/settings.json 或 ~/.qwen/settings.json:
{ "mcpServers": { "mobile": { "command": "npx", "args": ["-y", "claude-in-mobile"] } } }Gemini CLI — .gemini/settings.json 或 ~/.gemini/settings.json:
{ "mcpServers": { "mobile": { "command": "npx", "args": ["-y", "claude-in-mobile"] } } }法典:
codex mcp add mobile -- npx -y claude-in-mobile光标 — .cursor/mcp.json:
{ "mcpServers": { "mobile": { "command": "npx", "args": ["-y", "claude-in-mobile"] } } }来自npm/源代码
# npm (no install)
npx claude-in-mobile
# From source
git clone https://github.com/AlexGladkov/claude-in-mobile.git
cd claude-in-mobile
npm install
npm run build:all在任何MCP客户端上使用本地构建:
{ "mcpServers": { "mobile": { "command": "node", "args": ["/path/to/claude-in-mobile/dist/index.js"] } } }视窗
claude mcp add --transport stdio mobile -- cmd /c npx claude-in-mobile@latest______________________________________________________________________
平台指南
安卓
要求:
- 已安装ADB(自动发现或设置
ADB_PATH) - 设备上已启用USB调试,或正在运行模拟器
ADB发现顺序:
| 优先级 | 位置 |
|---|---|
| 1 | ADB_PATH 有人是。 |
| 2 | $ANDROID_HOME/platform-tools/adb |
| 3 | $ANDROID_SDK_ROOT/platform-tools/adb |
| 4 | 操作系统默认值: ~/Library/Android/sdk (macOS), %LOCALAPPDATA%\Android\Sdk (Windows), ~/Android/Sdk (Linux) |
| 5 | adb 从 PATH |
如果没有找到→ [ADB_NOT_INSTALLED] 探测路径错误。
示例:
"Show connected devices"
"Take a screenshot on Android"
"Tap on Settings"
"Swipe down to scroll"
"Type 'hello' in the search field"
"Press the back button"
"Grant camera permission to com.example.app"
"Launch com.example.app"CLI:
claude-in-mobile screenshot android
claude-in-mobile tap android 540 960
claude-in-mobile input android "hello world"
claude-in-mobile ui-dump android | grep "Login"坐标空间(原始 x/y 点击/滑动/长按)
当您使用raw调用输入工具时 x/y (或 x1/y1/x2/y2 对于滑动),这些值的解释如下 最新屏幕截图的像素空间 并在发货前自动缩放到设备坐标。比例尺来自上一个 screen_capture 呼叫:例如,在 preset='low' (270×480)在1080×2400的设备上设置了一个4倍的因子,因此 tap(135, 240) 成为 tap(540, 960) 在设备上。
这对普通流程很方便 screen_capture → reason about pixel → tap,但有两个值得了解的问题:
- 坐标来源
ui_find/ui_tree是设备坐标,而不是屏幕截图坐标。他们来自uiautomator其总是在设备空间中报告。如果最近的屏幕截图是低预设值,则将这些设备坐标作为原始值传递x/y将对其进行过度扩展。更喜欢index,text,或resourceId对于ui来源的水龙头,完全避免了这个问题。 - 还没有截图? 然后就没有储存秤了,而且是原始的
x/y以1:1的比例通过设备坐标。
最干净的心智模型: *原始坐标与您在屏幕上看到的任何像素空间相匹配* (您最后的屏幕截图)。对于其他所有内容,请使用解析器字段(index, text, resourceId, label).
______________________________________________________________________
iOS
要求:
- macOS与Xcode
- iOS模拟器(尚未支持物理设备)
- WebDriver Agent用于全面UI检查(可选但推荐)
WebDriver代理设置:
# Automatic (via Appium)
npm install -g appium
appium driver install xcuitest
# Or set custom path
export WDA_PATH=/path/to/WebDriverAgent首次使用时,WDA会自动构建(一次性约2分钟),在模拟器上启动,并连接到端口8100+。
WDA能够实现什么:
ui(action:'tree')--完全可访问性树ui(action:'find')--按标签/文本发现元素input(action:'tap', label:'...')--基于元素的攻丝- 改进了滑动和手势模拟
故障排除:
# Install Xcode CLI tools
xcode-select --install
# Accept license
sudo xcodebuild -license accept
# Check simulator is booted
xcrun simctl list | grep Booted
# Check port
lsof -i :8100Manual WDA test
cd ~/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent
xcodebuild test -project WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
-destination 'platform=iOS Simulator,id='示例:
"Take a screenshot on iOS"
"Open Safari on iOS"
"Tap on the Login button"
"Type my email in the text field"
"Swipe left on the card"
"Reset all permissions for com.apple.Maps"______________________________________________________________________
桌面
要求:
- macOS(计划使用Windows/Linux)
- 辅助功能权限:系统设置→ 隐私和安全→ 无障碍
- JDK 17+(用于构建桌面伴侣)
支持的应用程序: 任何macOS应用程序——SwiftUI、AppKit、Electron、Compose Desktop。
启动模式:
| 模式 | 示例 |
|---|---|
By bundleId | desktop(action:'launch', bundleId:'com.apple.Calculator') |
By .app 路径 | desktop(action:'launch', appPath:'/Applications/Slack.app') |
| 通过PID附加 | desktop(action:'launch', pid:12345) |
首先启用模块:
"Enable desktop module"或者先自动启用 desktop(...) 电话。
示例:
"Launch Calculator"
"Take a screenshot of the desktop app"
"Get window list"
"Resize window to 1280x720"
"Tap at 100, 200 on desktop"
"Get clipboard content"
"Get performance metrics"
"Stop the desktop app"API完整文档: docs/SPEC_DESKTOP.md
______________________________________________________________________
浏览器
要求:
- 已安装(或设置)Chrome或Chromium
CHROME_PATH)
通过Chrome DevTools协议(CDP)实现浏览器自动化。这 browser 模块按需加载。
示例:
"Open https://example.com in the browser"
"Click the Sign In button"
"Fill the email field with test@example.com"
"Take a browser screenshot"
"Execute JS: document.title"
"Wait for the loading spinner to disappear"可用操作:
| 动作 | 描述 |
|---|---|
open | 在新会话中打开URL |
navigate | 转到现有会话中的URL |
click | 按ref单击元素 |
fill | 在输入框中键入 |
fill_form | 一次填写多个字段 |
press_key | 键盘输入 |
snapshot | 带有元素引用的DOM快照 |
screenshot | 视觉截图 |
evaluate | 运行JavaScript |
wait_for_selector | 等待元素出现 |
close | 结束会话 |
list_sessions | 显示活动会话 |
clear_session | 重置Cookie/存储 |
______________________________________________________________________
Aurora操作系统
要求:
audbCLI:cargo install audb-client- 启用SSH的Aurora OS设备
- 设备上的Python用于点击/滑动:
devel-su pkcon install python
示例:
"List Aurora devices"
"Take a screenshot on Aurora"
"Tap at 100, 200 on Aurora"
"Launch ru.example.app on Aurora"
"List installed apps on Aurora"
"Get logs from Aurora device"
"Push file.txt to /home/defaultuser/"______________________________________________________________________
工具参考
v3.8.0提供 8个核心元工具 + 3个可选模块每个元工具都使用一个 action 参数。
核心元工具
| 元工具 | 操作 | 描述 |
|---|---|---|
device | list, set, set_target, get_target, enable_module, disable_module, list_modules | 设备管理、模块控制 |
input | tap, double_tap, long_press, swipe, text, key | 触摸和键盘输入 |
screen | capture, annotate | 屏幕截图和视觉注释 |
ui | tree, find, find_tap, tap_text, analyze, wait, assert_visible, assert_gone | UI层次结构、元素交互 |
app | launch, stop, install, list | 应用程序生命周期 |
system | activity, shell, wait, open_url, logs, clear_logs, info, webview, clipboard_*, permission_*, file_*, metrics, reset_metrics | 系统操作、剪贴板、权限、文件、遥测 |
flow_batch | -- | 在一次往返中执行多个命令(最多50个) |
flow_run | -- | 带条件和循环的多步自动化(最多20步) |
可选模块
按需加载 device(action:'enable_module', module:'') 或在第一次通话时自动启用。
| 模块 | 操作 | 描述 |
|---|---|---|
browser | open, close, list_sessions, navigate, click, fill, fill_form, press_key, snapshot, screenshot, evaluate, wait_for_selector, clear_session | 铬/铬通过CDP |
desktop | launch, stop, windows, focus, resize, clipboard_get, clipboard_set, performance, monitors | 任何macOS应用程序 |
store | upload, set_notes, submit, get_releases, discard, promote, halt_rollout, get_versions | Google Play、华为AppGallery、RuStore |
流量工具
| 工具 | 说明 |
|---|---|
flow_batch | 顺序执行,一次往返(最多50个命令) |
flow_run | 多步流程 if_not_found, repeat, on_error (最多20步) |
flow_parallel | 通过以下方式在多个设备上执行相同操作 Promise.allSettled (最多10个) |
向后兼容
所有v3.0/v3.1工具名称都可以用作别名: tap → input(action:'tap'), screenshot → screen(action:'capture'), launch_app → app(action:'launch')等等。
______________________________________________________________________
本机CLI
2 MB Rust二进制文件。没有Node.js,没有依赖关系。
安装
brew tap AlexGladkov/claude-in-mobile
brew install claude-in-mobile或从以下网址下载 发布.
为什么使用CLI
| CLI | MCP服务器 | |
|---|---|---|
| 安装 | brew install 或复制二进制文件 | npx /npm |
| 依赖项 | 无 | Node.js |
| 初创公司 | ~5ms | ~500ms |
| 从终端使用 | 直接命令 | 需要MCP客户端 |
| CI/CD | 退出代码,stdout/stderr | 不是为CI设计的 |
| 代币成本 | 技能按需加载 | 模式始终存在 |
测试脚本示例
#!/bin/bash
claude-in-mobile launch android com.example.app
claude-in-mobile wait 2000
claude-in-mobile tap android 0 0 --text "Login"
claude-in-mobile input android "test@example.com"
claude-in-mobile screenshot android -o result.png
claude-in-mobile ui-dump android | grep "Welcome" && echo "PASS" || echo "FAIL"店铺管理(CLI)
claude-in-mobile store upload --package com.example.app --file app.aab
claude-in-mobile huawei upload --package com.example.app --file app.aab
claude-in-mobile rustore upload --package com.example.app --file app.apk医生
一次检查所有依赖关系:
claude-in-mobile doctor检查:ADB、ANDROID_HOME、Xcode、simctl、Appium、WDA、JDK、audb客户端、Chrome。带有修复建议的颜色编码输出。
______________________________________________________________________
建筑
┌─────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Claude Code │────▶│ │────▶│ Android (ADB) │
├─────────────┤ │ Claude Mobile │ ├─────────────────┤
│ OpenCode │────▶│ MCP Server │────▶│ iOS (simctl+WDA)│
├─────────────┤ │ │ ├─────────────────┤
│ Cursor │────▶│ 8 meta-tools │────▶│ Desktop (macOS) │
├─────────────┤ │ + 3 modules │ ├─────────────────┤
│ Qwen/Gemini │────▶│ │────▶│ Aurora (audb) │
├─────────────┤ │ Auto-detects │ ├─────────────────┤
│ Any MCP │────▶│ platform │────▶│ Browser (CDP) │
└─────────────┘ └──────────────────┘ └─────────────────┘- 客户端通过MCP协议发送命令(8个元工具+3个可选模块)
- 服务器路由到平台适配器(ADB、simctl+WDA、桌面、audb、CDP)
- 在设备/应用程序/浏览器上执行命令
- 结果(屏幕截图、UI树、指标)返回给客户端
- 模块在第一次调用时自动启用——无需手动设置
______________________________________________________________________
许可证
麻省理工学院
