mobile-mcp-ai 2.3.9__py3-none-any.whl → 2.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1376,10 +1376,19 @@ class BasicMobileToolsLite:
1376
1376
  if not close_candidates:
1377
1377
  # 控件树未找到,自动截全屏图供 AI 分析
1378
1378
  screenshot_result = self.take_screenshot(description="弹窗全屏", compress=True)
1379
+
1380
+ # 构建更详细的视觉分析提示
1381
+ visual_hint = "请仔细查看截图,找到关闭按钮(通常是 × 或 X 图标)。"
1382
+ if popup_bounds:
1383
+ px1, py1, px2, py2 = popup_bounds
1384
+ visual_hint += f" 弹窗区域大约在 [{px1},{py1}] 到 [{px2},{py2}],关闭按钮通常在弹窗的右上角或正上方。"
1385
+ else:
1386
+ visual_hint += " 关闭按钮通常在屏幕右上角、弹窗右上角、或弹窗下方中间位置。"
1387
+
1379
1388
  return {
1380
1389
  "success": False,
1381
1390
  "message": "❌ 控件树未找到关闭按钮,已截全屏图供 AI 视觉分析",
1382
- "action_required": "请分析截图找到 X 关闭按钮位置,然后调用 mobile_click_at_coords",
1391
+ "action_required": visual_hint + " 找到后调用 mobile_click_at_coords(x, y, image_width, image_height, original_img_width, original_img_height) 点击。",
1383
1392
  "screenshot": screenshot_result.get("screenshot_path", ""),
1384
1393
  "screen_size": {"width": screen_width, "height": screen_height},
1385
1394
  "image_size": {
@@ -1392,7 +1401,14 @@ class BasicMobileToolsLite:
1392
1401
  },
1393
1402
  "popup_detected": popup_bounds is not None,
1394
1403
  "popup_bounds": f"[{popup_bounds[0]},{popup_bounds[1]}][{popup_bounds[2]},{popup_bounds[3]}]" if popup_bounds else None,
1395
- "tip": "找到 X 按钮后,直接调用 mobile_click_at_coords(x, y, image_width, image_height, original_img_width, original_img_height)"
1404
+ "search_areas": [
1405
+ "弹窗右上角(最常见)",
1406
+ "弹窗正上方外侧(浮动X按钮)",
1407
+ "弹窗下方中间(某些广告)",
1408
+ "屏幕右上角"
1409
+ ],
1410
+ "button_features": "关闭按钮通常是:小圆形/方形图标、灰色或白色、带有 × 或 X 符号",
1411
+ "tip": "注意:不要点击广告内容区域,只点击关闭按钮"
1396
1412
  }
1397
1413
 
1398
1414
  # 按得分排序,取最可能的
@@ -1401,7 +1417,10 @@ class BasicMobileToolsLite:
1401
1417
 
1402
1418
  # 点击
1403
1419
  self.client.u2.click(best['center_x'], best['center_y'])
1404
- time.sleep(0.3)
1420
+ time.sleep(0.5)
1421
+
1422
+ # 点击后截图,让 AI 判断是否成功
1423
+ screenshot_result = self.take_screenshot("关闭弹窗后")
1405
1424
 
1406
1425
  # 记录操作(使用百分比,跨设备兼容)
1407
1426
  self._record_operation(
@@ -1415,20 +1434,30 @@ class BasicMobileToolsLite:
1415
1434
  ref=f"close_popup_{best['position']}"
1416
1435
  )
1417
1436
 
1437
+ # 返回候选按钮列表,让 AI 看截图判断
1438
+ # 如果弹窗还在,AI 可以选择点击其他候选按钮
1418
1439
  return {
1419
1440
  "success": True,
1420
- "message": f"✅ 点击关闭按钮 ({best['position']}): ({best['center_x']}, {best['center_y']})",
1421
- "match_type": best['match_type'],
1422
- "bounds": best['bounds'],
1423
- "position": best['position'],
1424
- "percent": f"({best['x_percent']}%, {best['y_percent']}%)",
1441
+ "message": f"✅ 已点击关闭按钮 ({best['position']}): ({best['center_x']}, {best['center_y']})",
1442
+ "clicked": {
1443
+ "position": best['position'],
1444
+ "match_type": best['match_type'],
1445
+ "coords": (best['center_x'], best['center_y']),
1446
+ "percent": (best['x_percent'], best['y_percent'])
1447
+ },
1448
+ "screenshot": screenshot_result.get("screenshot_path", ""),
1425
1449
  "popup_detected": popup_bounds is not None,
1426
1450
  "popup_bounds": f"[{popup_bounds[0]},{popup_bounds[1]}][{popup_bounds[2]},{popup_bounds[3]}]" if popup_bounds else None,
1427
- "candidates_count": len(close_candidates),
1428
- "top_candidates": [
1429
- {"position": c['position'], "type": c['match_type'], "score": round(c['score'], 1)}
1430
- for c in close_candidates[:3]
1431
- ]
1451
+ "other_candidates": [
1452
+ {
1453
+ "position": c['position'],
1454
+ "type": c['match_type'],
1455
+ "coords": (c['center_x'], c['center_y']),
1456
+ "percent": (c['x_percent'], c['y_percent'])
1457
+ }
1458
+ for c in close_candidates[1:4] # 返回其他3个候选,AI 可以选择
1459
+ ],
1460
+ "tip": "请查看截图判断弹窗是否已关闭。如果弹窗还在,可以尝试点击 other_candidates 中的其他位置;如果误点跳转了,请按返回键"
1432
1461
  }
1433
1462
 
1434
1463
  except Exception as e:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: mobile-mcp-ai
3
- Version: 2.3.9
3
+ Version: 2.4.1
4
4
  Summary: 移动端自动化 MCP Server - 支持 Android/iOS,AI 功能可选(基础工具不需要 AI)
5
5
  Home-page: https://github.com/test111ddff-hash/mobile-mcp-ai
6
6
  Author: douzi
@@ -31,6 +31,20 @@ Provides-Extra: ai
31
31
  Requires-Dist: dashscope>=1.10.0; extra == "ai"
32
32
  Requires-Dist: openai>=1.0.0; extra == "ai"
33
33
  Requires-Dist: anthropic>=0.3.0; extra == "ai"
34
+ Provides-Extra: test
35
+ Requires-Dist: pytest>=8.0.0; extra == "test"
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
37
+ Requires-Dist: allure-pytest>=2.13.0; extra == "test"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
40
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
41
+ Requires-Dist: twine>=4.0.0; extra == "dev"
42
+ Requires-Dist: build>=0.10.0; extra == "dev"
43
+ Provides-Extra: ios
44
+ Requires-Dist: Appium-Python-Client>=3.0.0; extra == "ios"
45
+ Provides-Extra: h5
46
+ Requires-Dist: Appium-Python-Client>=3.0.0; extra == "h5"
47
+ Requires-Dist: selenium>=4.0.0; extra == "h5"
34
48
  Provides-Extra: all
35
49
  Requires-Dist: dashscope>=1.10.0; extra == "all"
36
50
  Requires-Dist: openai>=1.0.0; extra == "all"
@@ -40,20 +54,19 @@ Requires-Dist: selenium>=4.0.0; extra == "all"
40
54
  Requires-Dist: pytest>=8.0.0; extra == "all"
41
55
  Requires-Dist: pytest-asyncio>=0.21.0; extra == "all"
42
56
  Requires-Dist: allure-pytest>=2.13.0; extra == "all"
43
- Provides-Extra: dev
44
- Requires-Dist: pytest>=8.0.0; extra == "dev"
45
- Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
46
- Requires-Dist: twine>=4.0.0; extra == "dev"
47
- Requires-Dist: build>=0.10.0; extra == "dev"
48
- Provides-Extra: h5
49
- Requires-Dist: Appium-Python-Client>=3.0.0; extra == "h5"
50
- Requires-Dist: selenium>=4.0.0; extra == "h5"
51
- Provides-Extra: ios
52
- Requires-Dist: Appium-Python-Client>=3.0.0; extra == "ios"
53
- Provides-Extra: test
54
- Requires-Dist: pytest>=8.0.0; extra == "test"
55
- Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
56
- Requires-Dist: allure-pytest>=2.13.0; extra == "test"
57
+ Dynamic: author
58
+ Dynamic: author-email
59
+ Dynamic: classifier
60
+ Dynamic: description
61
+ Dynamic: description-content-type
62
+ Dynamic: home-page
63
+ Dynamic: keywords
64
+ Dynamic: license-file
65
+ Dynamic: project-url
66
+ Dynamic: provides-extra
67
+ Dynamic: requires-dist
68
+ Dynamic: requires-python
69
+ Dynamic: summary
57
70
 
58
71
  # 📱 Mobile MCP AI
59
72
 
@@ -1,7 +1,7 @@
1
1
  mobile_mcp/__init__.py,sha256=sQJZTL_sxQFzmcS7jOtS2AHCfUySz40vhX96N6u1qy4,816
2
2
  mobile_mcp/config.py,sha256=yaFLAV4bc2wX0GQPtZDo7OYF9E88tXV-av41fQsJwK4,4480
3
3
  mobile_mcp/core/__init__.py,sha256=ndMy-cLAIsQDG5op7gM_AIplycqZSZPWEkec1pEhvEY,170
4
- mobile_mcp/core/basic_tools_lite.py,sha256=ki2hTa-1Liupuvf0alQSQMRvKiZM2FJ-hdLVCAVSBOA,83010
4
+ mobile_mcp/core/basic_tools_lite.py,sha256=1fa9DwbZtv-HoCIq7F3Sqv_-1ik6CpX7rfVXEk00ums,84798
5
5
  mobile_mcp/core/device_manager.py,sha256=PX3-B5bJFnKNt6C8fT7FSY8JwD-ngZ3toF88bcOV9qA,8766
6
6
  mobile_mcp/core/dynamic_config.py,sha256=Ja1n1pfb0HspGByqk2_A472mYVniKmGtNEWyjUjmgK8,9811
7
7
  mobile_mcp/core/ios_client_wda.py,sha256=QUAoILP3P54YF1TtwgTNXxh8C_uHbuUjlMEdghA6-mk,18757
@@ -17,9 +17,9 @@ mobile_mcp/utils/__init__.py,sha256=8EH0i7UGtx1y_j_GEgdN-cZdWn2sRtZSEOLlNF9HRnY,
17
17
  mobile_mcp/utils/logger.py,sha256=Sqq2Nr0Y4p03erqcrbYKVPCGiFaNGHMcE_JwCkeOfU4,3626
18
18
  mobile_mcp/utils/xml_formatter.py,sha256=uwTRb3vLbqhT8O-udzWT7s7LsV-DyDUz2DkofD3hXOE,4556
19
19
  mobile_mcp/utils/xml_parser.py,sha256=QhL8CWbdmNDzmBLjtx6mEnjHgMFZzJeHpCL15qfXSpI,3926
20
- mobile_mcp_ai-2.3.9.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
21
- mobile_mcp_ai-2.3.9.dist-info/METADATA,sha256=t_t_XDylk8sWdLkT276_v85ExSx7Ux8UX85sxtWRP28,9423
22
- mobile_mcp_ai-2.3.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
23
- mobile_mcp_ai-2.3.9.dist-info/entry_points.txt,sha256=KB_FglozgPHBprSM1vFbIzGyheFuHFmGanscRdMJ_8A,68
24
- mobile_mcp_ai-2.3.9.dist-info/top_level.txt,sha256=lLm6YpbTv855Lbh8BIA0rPxhybIrvYUzMEk9OErHT94,11
25
- mobile_mcp_ai-2.3.9.dist-info/RECORD,,
20
+ mobile_mcp_ai-2.4.1.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
21
+ mobile_mcp_ai-2.4.1.dist-info/METADATA,sha256=b5dKb1bsDbLW3j9JX9323_LTp3GwxlFtzUR0IjBPIrs,9705
22
+ mobile_mcp_ai-2.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ mobile_mcp_ai-2.4.1.dist-info/entry_points.txt,sha256=KB_FglozgPHBprSM1vFbIzGyheFuHFmGanscRdMJ_8A,68
24
+ mobile_mcp_ai-2.4.1.dist-info/top_level.txt,sha256=lLm6YpbTv855Lbh8BIA0rPxhybIrvYUzMEk9OErHT94,11
25
+ mobile_mcp_ai-2.4.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5