Skip to main content

移动端自动化 MCP Server - 支持 Android/iOS,AI 功能可选(基础工具不需要 AI)

Project description

📱 Mobile MCP AI

让 Cursor 直接控制手机的 MCP 工具

PyPI Python License

⭐ 觉得有用?给个 Star 支持一下!


🎬 演示


✨ 核心特性

🧠 AI 原生驱动

基于 MCP 协议与 Cursor AI 深度集成,自然语言直接操控手机,告别繁琐的脚本编写

👁️ 视觉智能识别

Cursor AI 自动分析截图,精准定位 UI 元素,游戏、原生应用通吃

⚡ 零配置启动

pip install 一行命令,开箱即用,无需额外 AI 密钥

🔄 一键生成脚本

操作即录制,自动生成可复用的 pytest 测试脚本

🎯 双模式定位

元素树 + 视觉坐标双引擎,普通 App 秒定位,游戏场景不迷路

🛡️ 智能验证机制

按键操作自动验证生效,告别"假成功"


📦 安装

pip install mobile-mcp-ai

升级到最新版

pip install --upgrade mobile-mcp-ai

查看当前版本

pip show mobile-mcp-ai

📱 连接设备

确保手机已开启 USB 调试,然后:

adb devices

看到设备列表即表示连接成功。


⚙️ 配置 Cursor

编辑 ~/.cursor/mcp.json

{
  "mcpServers": {
    "mobile-automation": {
      "command": "python",
      "args": ["-m", "mobile_mcp.mcp.mcp_server"],
      "cwd": "/your/project/path"
    }
  }
}

保存后重启 Cursor


🚀 使用示例

在 Cursor 中直接对话:

基础操作

@MCP 列出当前页面所有元素
@MCP 点击"登录"按钮
@MCP 在用户名输入框输入 test123

应用控制

@MCP 启动微信
@MCP 打开抖音,向上滑动 3 次
@MCP 列出手机上所有已安装的应用

截图分析

@MCP 截图看看当前页面
@MCP 截图,然后点击页面上的搜索图标

测试脚本生成

@MCP 帮我测试登录流程:输入用户名密码,点击登录
@MCP 把刚才的操作生成 pytest 测试脚本

组合操作

@MCP 打开设置,找到 WLAN,点进去截图
@MCP 打开微信,点击发现,再点击朋友圈

🛠️ 工具列表

类别 工具 说明
📋 mobile_list_elements 列出页面元素
📸 mobile_take_screenshot 截图
📐 mobile_get_screen_size 屏幕尺寸
👆 mobile_click_by_text 文本点击
👆 mobile_click_by_id ID 点击
👆 mobile_click_at_coords 坐标点击
⌨️ mobile_input_text_by_id ID 输入
⌨️ mobile_input_at_coords 坐标输入
👆 mobile_swipe 滑动
⌨️ mobile_press_key 按键
⏱️ mobile_wait 等待
📦 mobile_launch_app 启动应用
📦 mobile_terminate_app 终止应用
📦 mobile_list_apps 列出应用
📱 mobile_list_devices 列出设备
🔌 mobile_check_connection 检查连接
mobile_assert_text 断言文本
📜 mobile_get_operation_history 操作历史
🗑️ mobile_clear_operation_history 清空历史
📝 mobile_generate_test_script 生成测试脚本

📞 联系作者

微信

添加微信交流(备注:mobile-mcp)


📄 License

Apache 2.0


Gitee · GitHub · PyPI

🚀 让移动端测试更简单

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mobile_mcp_ai-2.2.7.tar.gz (60.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mobile_mcp_ai-2.2.7-py3-none-any.whl (63.3 kB view details)

Uploaded Python 3

File details

Details for the file mobile_mcp_ai-2.2.7.tar.gz.

File metadata

  • Download URL: mobile_mcp_ai-2.2.7.tar.gz
  • Upload date:
  • Size: 60.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for mobile_mcp_ai-2.2.7.tar.gz
Algorithm Hash digest
SHA256 f1d1052e76ba76af059a4959f59dd3d35c0c89986218ca00dd43982511764367
MD5 523770a90595dc40b63353000c4c53b6
BLAKE2b-256 76400be8cd4dae12e4b11d373cca83cd4dd4bc30715b31eee99d2fb2a87670bc

See more details on using hashes here.

File details

Details for the file mobile_mcp_ai-2.2.7-py3-none-any.whl.

File metadata

  • Download URL: mobile_mcp_ai-2.2.7-py3-none-any.whl
  • Upload date:
  • Size: 63.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for mobile_mcp_ai-2.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b847f458dbc408285320df8a357fea24261c99a0dead521cbcfaae6d73bc43a4
MD5 104ec879286e150560ce2f2d8ee20427
BLAKE2b-256 e5cc3905291707ea4b568e878a3a3b38c0df4bce35440ce01a89d666b82856e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page