Skip to main content
Glama

Claude Mobile

用于移动和桌面自动化的 MCP 服务器 — Android(通过 ADB)、iOS 模拟器(通过 simctl)、桌面(Compose Multiplatform)和 Aurora OS(通过 audb)。类似于 Claude in Chrome,但适用于移动设备和桌面应用。

通过 Claude 使用自然语言控制您的 Android 手机、模拟器、iOS 模拟器、桌面应用程序或 Aurora OS 设备。

功能

  • 统一 API — 相同的命令适用于 Android、iOS、桌面和 Aurora OS

  • 智能截图 — 自动压缩以实现最佳 LLM 处理(不再有超大图片!)

  • 带标注的截图 — 带有彩色边界框和编号元素标签的截图,用于直观的 UI 理解

  • 权限管理 — 以编程方式授予、撤销和重置应用权限(Android 运行时权限、iOS 隐私服务)

  • 设备日志 — 读取带有过滤器的 logcat/系统日志以进行调试

  • UI 交互 — 通过坐标或元素文本进行点击、长按、滑动

  • 文本输入 — 在聚焦的字段中输入文本

  • 应用控制 — 启动、停止和安装应用

  • 平台选择 — 明确指定 Android、iOS、桌面或 Aurora OS

  • 桌面支持 — 通过窗口管理、剪贴板和性能指标测试 Compose Multiplatform 桌面应用

安装

通过 Homebrew (macOS) 的原生 CLI

brew tap AlexGladkov/claude-in-mobile https://github.com/AlexGladkov/claude-in-mobile
brew install claude-in-mobile

该 CLI 封装了所有设备自动化工具以及商店管理(Google Play、华为应用市场、RuStore):

claude-in-mobile screenshot android
claude-in-mobile tap android 540 960 --from-size 540x960
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

一行命令(任何客户端)

使用 add-mcp — 自动检测已安装的客户端:

npx add-mcp claude-in-mobile -y

或者指定特定客户端:

npx add-mcp claude-in-mobile -a claude-code -y
npx add-mcp claude-in-mobile -a opencode -y
npx add-mcp claude-in-mobile -a cursor -y

Claude Code CLI

claude mcp add --transport stdio mobile -- npx claude-in-mobile@latest

全局添加(在所有项目中可用):

claude mcp add --scope user --transport stdio mobile -- npx claude-in-mobile@latest

OpenCode

使用交互式设置:

opencode mcp add

或者手动添加到 opencode.json(项目根目录或 ~/.config/opencode/opencode.json):

{
  "mcp": {
    "mobile": {
      "type": "local",
      "command": ["npx", "-y", "claude-in-mobile"],
      "enabled": true
    }
  }
}

Cursor

添加到 .cursor/mcp.json

{
  "mcpServers": {
    "mobile": {
      "command": "npx",
      "args": ["-y", "claude-in-mobile"]
    }
  }
}

任何 MCP 客户端

为您的客户端打印配置片段:

npx claude-in-mobile --init <client-name>
# Supported: opencode, cursor, claude-code

从 npm 安装

npx claude-in-mobile

从源码安装

git clone https://github.com/AlexGladkov/claude-in-mobile.git
cd claude-in-mobile
npm install
npm run build:all  # Builds TypeScript + Desktop companion

注意: 对于桌面支持,您需要运行 npm run build:desktop(或 build:all)来编译桌面配套应用。

在 MCP 客户端中使用本地构建

从源码构建后,将您的 MCP 客户端指向本地的 dist/index.js,而不是使用 npx:

{
  "mcpServers": {
    "mobile": {
      "command": "node",
      "args": ["/path/to/claude-in-mobile/dist/index.js"]
    }
  }
}

对于 OpenCode (opencode.json):

{
  "mcp": {
    "mobile": {
      "type": "local",
      "command": ["node", "/path/to/claude-in-mobile/dist/index.js"],
      "enabled": true
    }
  }
}

手动配置

添加到您的 Claude Code 设置(~/.claude.json 或项目设置):

{
  "mcpServers": {
    "mobile": {
      "command": "npx",
      "args": ["-y", "claude-in-mobile"]
    }
  }
}

Windows

claude mcp add --transport stdio mobile -- cmd /c npx claude-in-mobile@latest

要求

Android

  • 已安装 ADB 且在 PATH 中

  • 已连接 Android 设备(已启用 USB 调试)或模拟器

iOS

  • 已安装 Xcode 的 macOS

  • iOS 模拟器(暂不支持物理设备)

  • WebDriverAgent,用于完整的 UI 检查和基于元素的交互:

    npm install -g appium
    appium driver install xcuitest

    或者将 WDA_PATH 环境变量设置为自定义的 WebDriverAgent 位置

桌面

  • macOS(计划支持 Windows/Linux)

  • JDK 17+,用于构建桌面配套应用

  • 待测试的 Compose Multiplatform 桌面应用程序

Aurora OS

  • 已安装 audb CLI 且在 PATH 中 (cargo install audb-client)

  • 已连接启用了 SSH 的 Aurora OS 设备

  • 设备上需要 Python 才能进行点击/滑动:devel-su pkcon install python

可用工具

核心工具(所有平台)

工具

Android

iOS

桌面

Aurora

描述

list_devices

列出所有已连接设备

set_device

选择活动设备

screenshot

截屏

tap

⚠️

在坐标处或按文本/标签点击(iOS:元素点击需要 WDA)

long_press

长按手势

swipe

⚠️

按方向或坐标滑动(Aurora 需要 Python)

input_text

输入文本

press_key

按下硬件按钮

launch_app

启动应用

stop_app

停止应用

install_app

安装 APK/.app/.rpm

list_apps

列出已安装应用(仅限 Aurora)

get_ui

获取 UI 层级(iOS:需要 WebDriverAgent)

find_element

按文本/ID/标签查找元素(iOS:需要 WebDriverAgent)

annotate_screenshot

带彩色边界框和编号元素标签的截图

grant_permission

授予应用权限(Android:运行时,iOS:隐私服务)

revoke_permission

撤销应用权限

reset_permissions

重置应用的所有权限

get_current_activity

获取前台活动

open_url

在浏览器中打开 URL(Aurora 尚未实现)

shell

运行 shell 命令

wait

等待一段时间

get_logs

获取设备日志 (logcat/系统日志)

clear_logs

⚠️

清除日志缓冲区

get_system_info

电池、内存信息

wait_for_element

等待元素出现(轮询 + 超时)

assert_visible

断言元素可见(通过/失败)

assert_not_exists

断言元素不存在(通过/失败)

batch_commands

在单次往返中执行多个命令

get_webview

通过 Chrome DevTools 协议检查 WebView

push_file

上传文件(仅限 Aurora)

pull_file

下载文件(仅限 Aurora)

桌面专用工具

工具

描述

set_target

设置目标平台 (android/ios/desktop)

get_target

获取当前目标平台

launch_desktop_app

启动 Compose 桌面应用程序

stop_desktop_app

停止正在运行的桌面应用程序

get_window_info

获取桌面窗口位置和大小

focus_window

将桌面窗口置于前台

resize_window

调整桌面窗口大小

get_clipboard

获取系统剪贴板内容

set_clipboard

设置系统剪贴板内容

get_performance_metrics

获取桌面应用的 CPU/内存使用情况

有关详细的桌面 API 文档,请参阅 Desktop Specification

使用示例

只需自然地与 Claude 对话:

"Show me all connected devices"
"Take a screenshot of the Android emulator"
"Take a screenshot on iOS"
"Tap on Settings"
"Swipe down to scroll"
"Type 'hello world' in the search field"
"Press the back button on Android"
"Open Safari on iOS"
"Switch to iOS simulator"
"Run the app on both platforms"

权限管理

"Grant camera permission to com.example.app on Android"
"Revoke location access from com.example.app"
"Reset all permissions for com.apple.Maps on iOS"

带标注的截图

"Take an annotated screenshot"  → Screenshot with green (clickable) and red (non-clickable) bounding boxes + numbered element index

平台选择

您可以明确指定平台:

"Screenshot on android"     → Uses Android device
"Screenshot on ios"         → Uses iOS simulator
"Screenshot on desktop"     → Uses Desktop app
"Screenshot on aurora"      → Uses Aurora OS device
"Screenshot"                → Uses last active device

或者设置活动设备:

"Use the iPhone 15 simulator"
"Switch to the Android emulator"
"Switch to desktop"
"Switch to Aurora device"

桌面示例

"Launch my desktop app from /path/to/app"
"Take a screenshot of the desktop app"
"Get window info"
"Resize window to 1280x720"
"Tap at coordinates 100, 200"
"Get clipboard content"
"Set clipboard to 'test text'"
"Get performance metrics"
"Stop the desktop app"

Aurora 示例

"List all Aurora devices"
"Take a screenshot on Aurora"
"Tap at coordinates 100, 200 on Aurora"
"Launch ru.example.app on Aurora"
"List installed apps on Aurora device"
"Get logs from Aurora device"
"Push file.txt to /home/defaultuser/ on Aurora device"

原生 CLI

一个 2 MB 的原生 Rust 二进制文件,具有所有相同的命令。无需 Node.js,无依赖。

安装 CLI

brew tap AlexGladkov/claude-in-mobile
brew install claude-in-mobile

或者从 Releases 下载。

相比 MCP 的优势

  • 易于安装brew install 或复制单个 2 MB 二进制文件

  • 无依赖 — 无 Node.js,无 npm,什么都没有

  • 从终端使用 — 直接运行命令,无需 Claude Code 或 MCP 客户端

  • 测试自动化 — 为任何平台编写通用的 .sh 脚本,无需学习平台内部原理

  • Token 高效 — 技能文档仅在需要时加载;MCP 会将所有工具模式加载到每个请求中,这在会话中会迅速增加 Token 消耗

  • 快速 — ~5ms 命令启动 (Rust) 对比 ~500ms (Node.js MCP)

  • CI/CD 就绪 — 退出代码,stdout/stderr,可在任何地方运行

测试脚本示例

#!/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"

Claude Code 插件

claude plugin marketplace add AlexGladkov/claude-in-mobile
claude plugin install claude-in-mobile@claude-in-mobile

安装后,Claude Code 可以通过自然语言控制设备。技能仅在需要时加载到上下文中 — 不使用时没有 Token 开销。

请参阅 cli/README.md 获取完整的 CLI 文档。

iOS WebDriverAgent 设置

为了进行完整的 iOS UI 检查和基于元素的交互,需要 WebDriverAgent。它支持:

  • get_ui - JSON 可访问性树检查

  • tap 配合 labeltext 参数 - 基于元素的点击

  • find_element - 元素发现和查询

  • swipe - 改进的手势模拟

安装

自动(通过 Appium):

npm install -g appium
appium driver install xcuitest

手动:WDA_PATH 环境变量设置为您的 WebDriverAgent 位置:

export WDA_PATH=/path/to/WebDriverAgent

首次使用

首次使用时,WebDriverAgent 将自动:

  1. 从 Appium 安装或 WDA_PATH 中发现

  2. 使用 xcodebuild 构建(一次性,约 2 分钟)

  3. 在 iOS 模拟器上启动

  4. 通过 HTTP 在 8100+ 端口连接

故障排除

构建失败:

# Install Xcode command line tools
xcode-select --install

# Accept license
sudo xcodebuild -license accept

# Set Xcode path
sudo xcode-select -s /Applications/Xcode.app

会话失败:

  • 确保模拟器已启动:xcrun simctl list | grep Booted

  • 检查端口可用性:lsof -i :8100

  • 尝试重启模拟器

手动测试:

cd ~/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent
xcodebuild test -project WebDriverAgent.xcodeproj \
  -scheme WebDriverAgentRunner \
  -destination 'platform=iOS Simulator,id=<DEVICE_UDID>'

工作原理

┌─────────────┐     ┌──────────────────┐     ┌─────────────────┐
│ Claude Code │────▶│                  │────▶│  Android (ADB)  │
├─────────────┤     │  Claude Mobile   │     └─────────────────┘
│  OpenCode   │────▶│   MCP Server     │     ┌─────────────────┐
├─────────────┤     │                  │────▶│ iOS (simctl+WDA)│
│   Cursor    │────▶│  (auto-detects   │     └─────────────────┘
├─────────────┤     │   client via     │     ┌─────────────────┐
│  Any MCP    │────▶│   MCP protocol)  │────▶│ Desktop (Compose)│
│   Client    │     │                  │     └─────────────────┘
└─────────────┘     │                  │     ┌─────────────────┐
                    │                  │────▶│ Aurora (audb)   │
                    └──────────────────┘     └─────────────────┘
  1. Claude 通过 MCP 协议发送命令

  2. 服务器路由到适当的平台(ADB、simctl+WDA、桌面配套应用或 audb)

  3. 命令在您的设备或桌面应用上执行

  4. 结果(截图、UI 数据、指标)返回给 Claude

许可证

MIT

Install Server
A
security – no known vulnerabilities
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AlexGladkov/claude-in-mobile'

If you have feedback or need assistance with the MCP directory API, please join our Discord server