mobile-mcp-ai 2.5.9__tar.gz → 2.5.11__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.5.9/mobile_mcp_ai.egg-info → mobile_mcp_ai-2.5.11}/PKG-INFO +1 -1
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/basic_tools_lite.py +40 -3
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mcp_tools/mcp_server.py +22 -17
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11/mobile_mcp_ai.egg-info}/PKG-INFO +1 -1
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/setup.py +1 -1
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/LICENSE +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/MANIFEST.in +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/README.md +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/__init__.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/config.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/__init__.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/device_manager.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/dynamic_config.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/ios_client_wda.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/ios_device_manager_wda.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/mobile_client.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/template_matcher.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_151217.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_152037.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_152840.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_153256.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_154847.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/gray_x_stock_ad.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/utils/__init__.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/utils/logger.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/utils/operation_history_manager.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/utils/smart_wait.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/docs/iOS_SETUP_GUIDE.md +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mcp_tools/__init__.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mobile_mcp_ai.egg-info/SOURCES.txt +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mobile_mcp_ai.egg-info/dependency_links.txt +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mobile_mcp_ai.egg-info/entry_points.txt +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mobile_mcp_ai.egg-info/not-zip-safe +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mobile_mcp_ai.egg-info/requires.txt +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/mobile_mcp_ai.egg-info/top_level.txt +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/requirements.txt +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/setup.cfg +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/templates/close_buttons/auto_x_0112_151217.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/templates/close_buttons/auto_x_0112_152037.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/templates/close_buttons/auto_x_0112_152840.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/templates/close_buttons/auto_x_0112_153256.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/templates/close_buttons/auto_x_0112_154847.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/templates/close_buttons/gray_x_stock_ad.png +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_mind_cloud_my_space.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_mind_correct.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_mind_improved.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_mind_optimized.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_open_mind.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_priority_demo.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_simple.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_/344/270/276/346/212/245.py" +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_/345/210/207/346/215/242/350/257/255/350/250/200/345/210/260English.py" +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/tests/test_/346/265/213/350/257/225.py" +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/utils/__init__.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/utils/logger.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/utils/xml_formatter.py +0 -0
- {mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/utils/xml_parser.py +0 -0
|
@@ -1906,6 +1906,7 @@ class BasicMobileToolsLite:
|
|
|
1906
1906
|
for elem in root.iter():
|
|
1907
1907
|
text = elem.attrib.get('text', '')
|
|
1908
1908
|
content_desc = elem.attrib.get('content-desc', '')
|
|
1909
|
+
resource_id = elem.attrib.get('resource-id', '')
|
|
1909
1910
|
bounds_str = elem.attrib.get('bounds', '')
|
|
1910
1911
|
class_name = elem.attrib.get('class', '')
|
|
1911
1912
|
clickable = elem.attrib.get('clickable', 'false') == 'true'
|
|
@@ -1940,6 +1941,13 @@ class BasicMobileToolsLite:
|
|
|
1940
1941
|
score = 90
|
|
1941
1942
|
reason = f"描述='{content_desc}'"
|
|
1942
1943
|
|
|
1944
|
+
# 策略2.5:resource-id 包含关闭关键词(如 close_icon, ad_close 等)
|
|
1945
|
+
elif resource_id and any(kw in resource_id.lower() for kw in ['close', 'dismiss', 'skip', 'cancel']):
|
|
1946
|
+
score = 95
|
|
1947
|
+
# 提取简短的 id 名
|
|
1948
|
+
short_id = resource_id.split('/')[-1] if '/' in resource_id else resource_id
|
|
1949
|
+
reason = f"resource-id='{short_id}'"
|
|
1950
|
+
|
|
1943
1951
|
# 策略3:小尺寸的 clickable 元素(可能是 X 图标)
|
|
1944
1952
|
elif clickable:
|
|
1945
1953
|
min_size = max(20, int(screen_width * 0.03))
|
|
@@ -1974,7 +1982,9 @@ class BasicMobileToolsLite:
|
|
|
1974
1982
|
'center_y': center_y,
|
|
1975
1983
|
'x_percent': x_percent,
|
|
1976
1984
|
'y_percent': y_percent,
|
|
1977
|
-
'size': f"{width}x{height}"
|
|
1985
|
+
'size': f"{width}x{height}",
|
|
1986
|
+
'resource_id': resource_id,
|
|
1987
|
+
'text': text
|
|
1978
1988
|
})
|
|
1979
1989
|
|
|
1980
1990
|
if not candidates:
|
|
@@ -2000,7 +2010,16 @@ class BasicMobileToolsLite:
|
|
|
2000
2010
|
candidates.sort(key=lambda x: x['score'], reverse=True)
|
|
2001
2011
|
best = candidates[0]
|
|
2002
2012
|
|
|
2003
|
-
|
|
2013
|
+
# 生成推荐的点击命令(优先使用 resource-id)
|
|
2014
|
+
if best.get('resource_id'):
|
|
2015
|
+
short_id = best['resource_id'].split('/')[-1] if '/' in best['resource_id'] else best['resource_id']
|
|
2016
|
+
click_cmd = f"mobile_click_by_id('{best['resource_id']}')"
|
|
2017
|
+
elif best.get('text') and best['text'] in ['×', 'X', 'x', '关闭', '取消', '跳过', '知道了']:
|
|
2018
|
+
click_cmd = f"mobile_click_by_text('{best['text']}')"
|
|
2019
|
+
else:
|
|
2020
|
+
click_cmd = f"mobile_click_by_percent({best['x_percent']}, {best['y_percent']})"
|
|
2021
|
+
|
|
2022
|
+
result = {
|
|
2004
2023
|
"success": True,
|
|
2005
2024
|
"message": f"✅ 找到可能的关闭按钮",
|
|
2006
2025
|
"best_candidate": {
|
|
@@ -2011,7 +2030,7 @@ class BasicMobileToolsLite:
|
|
|
2011
2030
|
"size": best['size'],
|
|
2012
2031
|
"score": best['score']
|
|
2013
2032
|
},
|
|
2014
|
-
"click_command":
|
|
2033
|
+
"click_command": click_cmd,
|
|
2015
2034
|
"other_candidates": [
|
|
2016
2035
|
{"reason": c['reason'], "percent": f"({c['x_percent']}%, {c['y_percent']}%)", "score": c['score']}
|
|
2017
2036
|
for c in candidates[1:4]
|
|
@@ -2019,6 +2038,14 @@ class BasicMobileToolsLite:
|
|
|
2019
2038
|
"screen_size": {"width": screen_width, "height": screen_height}
|
|
2020
2039
|
}
|
|
2021
2040
|
|
|
2041
|
+
# 如果有 resource-id,额外提供
|
|
2042
|
+
if best.get('resource_id'):
|
|
2043
|
+
result["best_candidate"]["resource_id"] = best['resource_id']
|
|
2044
|
+
if best.get('text'):
|
|
2045
|
+
result["best_candidate"]["text"] = best['text']
|
|
2046
|
+
|
|
2047
|
+
return result
|
|
2048
|
+
|
|
2022
2049
|
except Exception as e:
|
|
2023
2050
|
return {"success": False, "message": f"❌ 查找关闭按钮失败: {e}"}
|
|
2024
2051
|
|
|
@@ -2959,6 +2986,16 @@ class BasicMobileToolsLite:
|
|
|
2959
2986
|
reason = f"文本含'{kw}'"
|
|
2960
2987
|
break
|
|
2961
2988
|
|
|
2989
|
+
# resource-id 匹配(如 close_icon, ad_close 等)
|
|
2990
|
+
if resource_id:
|
|
2991
|
+
res_id_lower = resource_id.lower()
|
|
2992
|
+
for kw in ['close', 'dismiss', 'skip', 'cancel']:
|
|
2993
|
+
if kw in res_id_lower:
|
|
2994
|
+
score += 9
|
|
2995
|
+
short_id = resource_id.split('/')[-1] if '/' in resource_id else resource_id
|
|
2996
|
+
reason = f"resource-id='{short_id}'"
|
|
2997
|
+
break
|
|
2998
|
+
|
|
2962
2999
|
# content-desc 匹配
|
|
2963
3000
|
for kw in close_content_desc:
|
|
2964
3001
|
if kw.lower() in content_desc.lower():
|
|
@@ -610,22 +610,25 @@ class MobileMCPServer:
|
|
|
610
610
|
name="mobile_find_close_button",
|
|
611
611
|
description="""🔍 智能查找关闭按钮(只找不点,返回位置)
|
|
612
612
|
|
|
613
|
-
|
|
613
|
+
⚡ 【推荐首选】遇到弹窗时优先调用此工具!无需先截图。
|
|
614
|
+
|
|
615
|
+
从元素树中找最可能的关闭按钮,返回坐标和推荐的点击命令。
|
|
614
616
|
|
|
615
617
|
🎯 识别策略(优先级):
|
|
616
|
-
1. 文本匹配:×、X、关闭、取消、跳过
|
|
617
|
-
2.
|
|
618
|
-
3.
|
|
618
|
+
1. 文本匹配:×、X、关闭、取消、跳过 等(得分100)
|
|
619
|
+
2. resource-id 匹配:包含 close/dismiss/skip(得分95)
|
|
620
|
+
3. content-desc 匹配:包含 close/关闭(得分90)
|
|
621
|
+
4. 小尺寸 clickable 元素(右上角优先,得分70+)
|
|
619
622
|
|
|
620
623
|
✅ 返回内容:
|
|
621
624
|
- 坐标 (x, y) 和百分比 (x%, y%)
|
|
622
|
-
-
|
|
623
|
-
-
|
|
625
|
+
- resource-id(如果有)
|
|
626
|
+
- 推荐的点击命令(优先 click_by_id,其次 click_by_text,最后 click_by_percent)
|
|
624
627
|
|
|
625
628
|
💡 使用流程:
|
|
626
|
-
1.
|
|
627
|
-
2.
|
|
628
|
-
3.
|
|
629
|
+
1. 直接调用此工具(无需先截图/列元素)
|
|
630
|
+
2. 根据返回的 click_command 执行点击
|
|
631
|
+
3. 如果返回 success=false,才需要截图分析""",
|
|
629
632
|
inputSchema={"type": "object", "properties": {}, "required": []}
|
|
630
633
|
))
|
|
631
634
|
|
|
@@ -711,24 +714,26 @@ class MobileMCPServer:
|
|
|
711
714
|
name="mobile_close_ad",
|
|
712
715
|
description="""🚫 【推荐】智能关闭广告弹窗
|
|
713
716
|
|
|
714
|
-
|
|
717
|
+
⚡ 直接调用即可,无需先截图!会自动按优先级尝试:
|
|
715
718
|
|
|
716
|
-
1️⃣
|
|
717
|
-
- 自动查找
|
|
719
|
+
1️⃣ **控件树查找**(最可靠,优先)
|
|
720
|
+
- 自动查找 resource-id 包含 close/dismiss
|
|
721
|
+
- 查找文本"关闭"、"跳过"、"×"等
|
|
718
722
|
- 找到直接点击,实时可靠
|
|
719
723
|
|
|
720
724
|
2️⃣ **模板匹配**(次优)
|
|
721
725
|
- 用 OpenCV 匹配已保存的 X 按钮模板
|
|
722
|
-
-
|
|
726
|
+
- 模板越多成功率越高
|
|
723
727
|
|
|
724
728
|
3️⃣ **返回截图供 AI 分析**(兜底)
|
|
725
|
-
-
|
|
729
|
+
- 前两步都失败才截图
|
|
726
730
|
- AI 分析后用 mobile_click_by_percent 点击
|
|
727
|
-
- 点击成功后用 mobile_template_add
|
|
731
|
+
- 点击成功后用 mobile_template_add 添加模板
|
|
728
732
|
|
|
729
|
-
💡
|
|
730
|
-
1. 遇到广告弹窗 →
|
|
733
|
+
💡 正确流程:
|
|
734
|
+
1. 遇到广告弹窗 → 直接调用此工具
|
|
731
735
|
2. 如果成功 → 完成
|
|
736
|
+
3. 只有失败时才需要截图分析
|
|
732
737
|
3. 如果失败 → 看截图找 X → 点击 → 添加模板""",
|
|
733
738
|
inputSchema={
|
|
734
739
|
"type": "object",
|
|
@@ -25,7 +25,7 @@ if requirements_file.exists():
|
|
|
25
25
|
|
|
26
26
|
setup(
|
|
27
27
|
name="mobile-mcp-ai",
|
|
28
|
-
version="2.5.
|
|
28
|
+
version="2.5.11", # find_close_button 增加 resource-id 匹配
|
|
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
|
{mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_151217.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_152037.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_152840.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_153256.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/auto_x_0112_154847.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.9 → mobile_mcp_ai-2.5.11}/core/templates/close_buttons/gray_x_stock_ad.png
RENAMED
|
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
|