Metadata-Version: 2.4
Name: mobile-mcp-ai
Version: 1.0.0
Summary: 移动端自动化测试框架 - 支持Android和iOS，集成AI增强功能
Home-page: https://github.com/test111ddff-hash/mobile-mcp-ai
Author: douzi
Author-email: 1492994674@qq.com
Project-URL: Documentation, https://github.com/test111ddff-hash/mobile-mcp-ai
Project-URL: Source, https://github.com/test111ddff-hash/mobile-mcp-ai
Project-URL: Tracker, https://github.com/test111ddff-hash/mobile-mcp-ai/issues
Keywords: mobile automation testing android ios mcp ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: uiautomator2>=2.16.0
Requires-Dist: adbutils>=1.2.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: dashscope>=1.10.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: pytest>=8.0.0
Requires-Dist: pytest-asyncio>=0.21.0
Requires-Dist: allure-pytest>=2.13.0
Requires-Dist: mcp>=0.9.0
Requires-Dist: fastapi>=0.104.0
Requires-Dist: uvicorn[standard]>=0.24.0
Provides-Extra: ios
Requires-Dist: Appium-Python-Client>=3.0.0; extra == "ios"
Provides-Extra: h5
Requires-Dist: Appium-Python-Client>=3.0.0; extra == "h5"
Requires-Dist: selenium>=4.0.0; extra == "h5"
Provides-Extra: ai
Requires-Dist: anthropic>=0.18.0; extra == "ai"
Requires-Dist: openai>=1.0.0; extra == "ai"
Requires-Dist: google-generativeai>=0.3.0; extra == "ai"
Provides-Extra: all
Requires-Dist: Appium-Python-Client>=3.0.0; extra == "all"
Requires-Dist: selenium>=4.0.0; extra == "all"
Requires-Dist: anthropic>=0.18.0; extra == "all"
Requires-Dist: openai>=1.0.0; extra == "all"
Requires-Dist: google-generativeai>=0.3.0; extra == "all"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Mobile MCP - 移动端自动化测试框架

## 📁 目录结构

```
backend/mobile_mcp/
├── core/                    # 核心功能模块
│   ├── locator/            # 定位器（包括Cursor AI视觉识别）
│   ├── ai/                 # AI分析模块
│   ├── assertion/          # 断言模块
│   ├── h5/                 # H5处理模块
│   ├── device_manager.py   # 设备管理
│   └── mobile_client.py    # 移动端客户端
│
├── mcp/                    # MCP服务器相关
│   └── mcp_server.py       # MCP服务器（Cursor AI工具）
│
├── examples/               # 测试示例
│   └── test_*.py          # 各种测试用例
│
├── screenshots/            # 截图目录
│   ├── requests/          # 分析请求文件（JSON）
│   └── results/           # 分析结果文件（JSON，由Cursor AI写入）
│
├── docs/                   # 文档目录
│   ├── md/                # Markdown文档
│   └── *.txt             # 其他文档
│
├── workspace/              # 工作区配置
│   └── *.code-workspace   # VS Code工作区文件
│
├── tools/                  # 工具脚本
├── utils/                  # 工具函数
├── vision/                 # 视觉识别模块
├── tests/                  # 测试文件
└── requirements.txt        # 依赖列表
```

## 🎯 核心功能

### 1. 智能定位系统
- 规则匹配（免费，85%）
- XML深度分析（免费，5%）
- 位置分析（免费，5%）
- 视觉识别（付费，4%）
- **Cursor AI视觉识别（免费，1%）** ⭐ 新增

### 2. Cursor AI自动视觉识别
- 自动截图（智能区域选择）
- 自动创建分析请求
- Cursor AI自动分析
- 自动获取坐标并点击
- 自动更新脚本

## 📖 文档

- **[📘 使用指南（推荐）](USAGE.md)** - 完整的安装和使用说明
- **[🌐 局域网共享部署](DEPLOY.md)** - HTTP服务器部署指南（方案2）
- [完整流程指南](docs/md/CURSOR_AI_COMPLETE_GUIDE.md)
- [使用说明](docs/md/CURSOR_AI_VISION_USAGE.md)
- [MCP设置](docs/md/CURSOR_MCP_SETUP.md)

## 🚀 快速开始

### 1. 安装依赖

```bash
cd backend/mobile_mcp
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
```

### 2. 配置 Cursor

在 Cursor Settings 中添加 MCP Server 配置：

```json
{
  "mcpServers": {
    "mobile-automation": {
      "command": "python",
      "args": ["/绝对路径/to/douzi-ai/backend/mobile_mcp/mcp/mcp_server.py"],
      "env": {
        "PYTHONPATH": "/绝对路径/to/douzi-ai",
        "MOBILE_DEVICE_ID": "auto"
      }
    }
  }
}
```

### 3. 连接设备

```bash
adb devices
```

### 4. 重启 Cursor 并开始使用

重启 Cursor 后，直接用自然语言告诉 AI：

```
打开 com.im30.way，点击登录按钮
```

详细说明请查看 [使用指南](USAGE.md)

---

## 🌐 局域网共享（HTTP Server）

如果你想在局域网内共享MCP服务，让其他人无需安装依赖：

### 快速启动

```bash
cd backend/mobile_mcp

# 安装HTTP服务器依赖
pip install fastapi uvicorn

# 启动服务器
python mcp/mcp_http_server.py

# 或使用启动脚本（自动获取IP）
./start_http_server.sh
```

服务器启动后会显示你的IP地址，其他人可以通过HTTP API访问。

详细说明请查看 [部署指南](DEPLOY.md)

## 🚀 快速开始（旧版）

```bash
cd backend/mobile_mcp
source venv/bin/activate
python examples/test_设置切换语言_完整版.py
```

## 📝 使用示例

当定位失败时，系统会自动：
1. 截图并创建请求文件
2. 等待Cursor AI分析（最多30秒）
3. 在Cursor中调用：`@mobile_analyze_screenshot request_id="xxx"`
4. Cursor AI分析并写入结果文件
5. 测试脚本继续执行


