mobile-mcp-ai 2.3.0__tar.gz → 2.3.2__tar.gz
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.
- {mobile_mcp_ai-2.3.0/mobile_mcp_ai.egg-info → mobile_mcp_ai-2.3.2}/PKG-INFO +1 -1
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/basic_tools_lite.py +23 -2
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/ios_client_wda.py +2 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/mobile_client.py +10 -3
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2/mobile_mcp_ai.egg-info}/PKG-INFO +1 -1
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/setup.py +1 -1
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/LICENSE +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/MANIFEST.in +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/README.md +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/__init__.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/config.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/__init__.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/device_manager.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/dynamic_config.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/ios_device_manager_wda.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/utils/__init__.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/utils/logger.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/utils/operation_history_manager.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/core/utils/smart_wait.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/docs/iOS_SETUP_GUIDE.md +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mcp_tools/__init__.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mcp_tools/mcp_server.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mobile_mcp_ai.egg-info/SOURCES.txt +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mobile_mcp_ai.egg-info/dependency_links.txt +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mobile_mcp_ai.egg-info/entry_points.txt +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mobile_mcp_ai.egg-info/not-zip-safe +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mobile_mcp_ai.egg-info/requires.txt +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/mobile_mcp_ai.egg-info/top_level.txt +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/requirements.txt +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/setup.cfg +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_mind_cloud_my_space.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_mind_correct.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_mind_improved.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_mind_optimized.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_open_mind.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_priority_demo.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_simple.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_/344/270/276/346/212/245.py" +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_/345/210/207/346/215/242/350/257/255/350/250/200/345/210/260English.py" +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/tests/test_/346/265/213/350/257/225.py" +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/utils/__init__.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/utils/logger.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/utils/xml_formatter.py +0 -0
- {mobile_mcp_ai-2.3.0 → mobile_mcp_ai-2.3.2}/utils/xml_parser.py +0 -0
|
@@ -113,7 +113,18 @@ class BasicMobileToolsLite:
|
|
|
113
113
|
ratio = max_width / img.width
|
|
114
114
|
new_w = max_width
|
|
115
115
|
new_h = int(img.height * ratio)
|
|
116
|
-
|
|
116
|
+
# 兼容不同版本的 Pillow
|
|
117
|
+
try:
|
|
118
|
+
# Pillow 10.0.0+
|
|
119
|
+
resample = Image.Resampling.LANCZOS
|
|
120
|
+
except AttributeError:
|
|
121
|
+
try:
|
|
122
|
+
# Pillow 9.x
|
|
123
|
+
resample = Image.LANCZOS
|
|
124
|
+
except AttributeError:
|
|
125
|
+
# Pillow 旧版本
|
|
126
|
+
resample = Image.ANTIALIAS
|
|
127
|
+
img = img.resize((new_w, new_h), resample)
|
|
117
128
|
|
|
118
129
|
# 第4步:生成最终文件名(JPEG 格式)
|
|
119
130
|
if description:
|
|
@@ -125,7 +136,17 @@ class BasicMobileToolsLite:
|
|
|
125
136
|
final_path = self.screenshot_dir / filename
|
|
126
137
|
|
|
127
138
|
# 第5步:保存为 JPEG(PNG 可能有透明通道,需转 RGB)
|
|
128
|
-
|
|
139
|
+
# 先转换为 RGB 模式,处理可能的 RGBA 或 P 模式
|
|
140
|
+
if img.mode in ('RGBA', 'LA', 'P'):
|
|
141
|
+
# 创建白色背景
|
|
142
|
+
background = Image.new('RGB', img.size, (255, 255, 255))
|
|
143
|
+
if img.mode == 'P':
|
|
144
|
+
img = img.convert('RGBA')
|
|
145
|
+
background.paste(img, mask=img.split()[-1] if img.mode == 'RGBA' else None)
|
|
146
|
+
img = background
|
|
147
|
+
elif img.mode != 'RGB':
|
|
148
|
+
img = img.convert("RGB")
|
|
149
|
+
|
|
129
150
|
img.save(str(final_path), "JPEG", quality=quality)
|
|
130
151
|
|
|
131
152
|
# 第6步:删除临时 PNG
|
|
@@ -380,10 +380,12 @@ class MobileClient:
|
|
|
380
380
|
break
|
|
381
381
|
|
|
382
382
|
if not found:
|
|
383
|
-
# 🎯
|
|
384
|
-
|
|
383
|
+
# 🎯 定位失败,提示用户
|
|
384
|
+
# 注意:CursorVisionHelper 是实验性功能,当前版本建议使用 MCP 方式
|
|
385
|
+
print(f" ⚠️ 元素'{ref}'未找到", file=sys.stderr)
|
|
385
386
|
try:
|
|
386
387
|
from .locator.cursor_vision_helper import CursorVisionHelper
|
|
388
|
+
print(f" 🔍 尝试使用Cursor AI视觉识别...", file=sys.stderr)
|
|
387
389
|
cursor_helper = CursorVisionHelper(self)
|
|
388
390
|
# 🎯 传递 auto_analyze=True,自动创建请求文件并等待结果
|
|
389
391
|
cursor_result = await cursor_helper.analyze_with_cursor(element, auto_analyze=True)
|
|
@@ -415,12 +417,17 @@ class MobileClient:
|
|
|
415
417
|
# 其他情况,抛出异常
|
|
416
418
|
screenshot_path = cursor_result.get('screenshot_path', 'unknown') if cursor_result else 'unknown'
|
|
417
419
|
raise ValueError(f"Cursor AI分析失败: {screenshot_path}")
|
|
420
|
+
except ImportError:
|
|
421
|
+
# CursorVisionHelper 模块不存在,跳过视觉识别
|
|
422
|
+
print(f" 💡 提示:建议使用 MCP 方式调用,Cursor AI 会自动进行视觉识别", file=sys.stderr)
|
|
418
423
|
except ValueError as ve:
|
|
419
424
|
if "Cursor AI" in str(ve):
|
|
420
425
|
raise ve
|
|
421
426
|
print(f" ⚠️ Cursor视觉识别失败: {ve}", file=sys.stderr)
|
|
427
|
+
except Exception as e:
|
|
428
|
+
print(f" ⚠️ 视觉识别异常: {e}", file=sys.stderr)
|
|
422
429
|
|
|
423
|
-
raise ValueError(f"无法找到元素: {ref}
|
|
430
|
+
raise ValueError(f"无法找到元素: {ref}(建议使用 MCP 方式,Cursor AI 会自动进行视觉识别)")
|
|
424
431
|
|
|
425
432
|
# 验证点击(可选)
|
|
426
433
|
page_changed = False
|
|
@@ -25,7 +25,7 @@ if requirements_file.exists():
|
|
|
25
25
|
|
|
26
26
|
setup(
|
|
27
27
|
name="mobile-mcp-ai",
|
|
28
|
-
version="2.3.
|
|
28
|
+
version="2.3.2", # 修复 CursorVisionHelper 模块不存在时的异常处理
|
|
29
29
|
author="douzi",
|
|
30
30
|
author_email="1492994674@qq.com",
|
|
31
31
|
description="移动端自动化 MCP Server - 支持 Android/iOS,AI 功能可选(基础工具不需要 AI)",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|