mobile-mcp-ai 2.5.1__tar.gz → 2.5.3__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.1 → mobile_mcp_ai-2.5.3}/MANIFEST.in +1 -0
- {mobile_mcp_ai-2.5.1/mobile_mcp_ai.egg-info → mobile_mcp_ai-2.5.3}/PKG-INFO +1 -1
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/template_matcher.py +14 -3
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mcp_tools/mcp_server.py +18 -2
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/mobile_mcp_ai.egg-info}/PKG-INFO +1 -1
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mobile_mcp_ai.egg-info/SOURCES.txt +12 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/setup.py +5 -12
- mobile_mcp_ai-2.5.3/templates/close_buttons/auto_x_0112_151217.png +0 -0
- mobile_mcp_ai-2.5.3/templates/close_buttons/auto_x_0112_152037.png +0 -0
- mobile_mcp_ai-2.5.3/templates/close_buttons/auto_x_0112_152840.png +0 -0
- mobile_mcp_ai-2.5.3/templates/close_buttons/auto_x_0112_153256.png +0 -0
- mobile_mcp_ai-2.5.3/templates/close_buttons/auto_x_0112_154847.png +0 -0
- mobile_mcp_ai-2.5.3/templates/close_buttons/gray_x_stock_ad.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/LICENSE +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/README.md +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/__init__.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/config.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/__init__.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/basic_tools_lite.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/device_manager.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/dynamic_config.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/ios_client_wda.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/ios_device_manager_wda.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/mobile_client.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_151217.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_152037.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_152840.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_153256.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_154847.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/gray_x_stock_ad.png +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/utils/__init__.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/utils/logger.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/utils/operation_history_manager.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/core/utils/smart_wait.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/docs/iOS_SETUP_GUIDE.md +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mcp_tools/__init__.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mobile_mcp_ai.egg-info/dependency_links.txt +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mobile_mcp_ai.egg-info/entry_points.txt +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mobile_mcp_ai.egg-info/not-zip-safe +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mobile_mcp_ai.egg-info/requires.txt +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/mobile_mcp_ai.egg-info/top_level.txt +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/requirements.txt +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/setup.cfg +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_mind_cloud_my_space.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_mind_correct.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_mind_improved.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_mind_optimized.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_open_mind.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_priority_demo.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_simple.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/tests/test_/344/270/276/346/212/245.py" +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/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.1 → mobile_mcp_ai-2.5.3}/tests/test_/346/265/213/350/257/225.py" +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/utils/__init__.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/utils/logger.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/utils/xml_formatter.py +0 -0
- {mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3}/utils/xml_parser.py +0 -0
|
@@ -24,9 +24,20 @@ class TemplateMatcher:
|
|
|
24
24
|
template_dir: 模板目录路径,默认为 templates/close_buttons/
|
|
25
25
|
"""
|
|
26
26
|
if template_dir is None:
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
# 默认模板目录:优先使用包内目录,其次使用项目根目录
|
|
28
|
+
core_dir = Path(__file__).parent
|
|
29
|
+
# 1. 包内目录 (pip 安装后)
|
|
30
|
+
pkg_template_dir = core_dir / "templates" / "close_buttons"
|
|
31
|
+
# 2. 项目根目录 (开发时)
|
|
32
|
+
root_template_dir = core_dir.parent / "templates" / "close_buttons"
|
|
33
|
+
|
|
34
|
+
if pkg_template_dir.exists():
|
|
35
|
+
self.template_dir = pkg_template_dir
|
|
36
|
+
elif root_template_dir.exists():
|
|
37
|
+
self.template_dir = root_template_dir
|
|
38
|
+
else:
|
|
39
|
+
# 默认创建包内目录
|
|
40
|
+
self.template_dir = pkg_template_dir
|
|
30
41
|
else:
|
|
31
42
|
self.template_dir = Path(template_dir)
|
|
32
43
|
|
|
@@ -89,6 +89,7 @@ class MobileMCPServer:
|
|
|
89
89
|
self.client = None
|
|
90
90
|
self.tools = None
|
|
91
91
|
self._initialized = False
|
|
92
|
+
self._last_error = None # 保存最后一次连接失败的错误
|
|
92
93
|
|
|
93
94
|
@staticmethod
|
|
94
95
|
def format_response(result) -> str:
|
|
@@ -114,9 +115,11 @@ class MobileMCPServer:
|
|
|
114
115
|
self._initialized = True # 只在成功时标记
|
|
115
116
|
print(f"📱 已连接到 {platform.upper()} 设备", file=sys.stderr)
|
|
116
117
|
except Exception as e:
|
|
117
|
-
|
|
118
|
+
error_msg = str(e)
|
|
119
|
+
print(f"⚠️ 设备连接失败: {error_msg},下次调用时将重试", file=sys.stderr)
|
|
118
120
|
self.client = None
|
|
119
121
|
self.tools = None
|
|
122
|
+
self._last_error = error_msg # 保存错误信息
|
|
120
123
|
# 不设置 _initialized = True,下次调用会重试
|
|
121
124
|
|
|
122
125
|
def _detect_platform(self) -> str:
|
|
@@ -722,7 +725,20 @@ class MobileMCPServer:
|
|
|
722
725
|
await self.initialize()
|
|
723
726
|
|
|
724
727
|
if not self.tools:
|
|
725
|
-
|
|
728
|
+
# 提供详细的错误信息和解决方案
|
|
729
|
+
error_detail = self._last_error or "未知错误"
|
|
730
|
+
help_msg = (
|
|
731
|
+
f"❌ 设备连接失败\n\n"
|
|
732
|
+
f"错误详情: {error_detail}\n\n"
|
|
733
|
+
f"🔧 解决方案:\n"
|
|
734
|
+
f"1. 检查 USB 连接: adb devices\n"
|
|
735
|
+
f"2. 重启 adb: adb kill-server && adb start-server\n"
|
|
736
|
+
f"3. 初始化 uiautomator2: python -m uiautomator2 init\n"
|
|
737
|
+
f"4. 手机上允许 USB 调试授权\n"
|
|
738
|
+
f"5. 确保手机已解锁\n\n"
|
|
739
|
+
f"完成后请重试操作。"
|
|
740
|
+
)
|
|
741
|
+
return [TextContent(type="text", text=help_msg)]
|
|
726
742
|
|
|
727
743
|
try:
|
|
728
744
|
# 截图
|
|
@@ -15,6 +15,12 @@ setup.py
|
|
|
15
15
|
./core/ios_device_manager_wda.py
|
|
16
16
|
./core/mobile_client.py
|
|
17
17
|
./core/template_matcher.py
|
|
18
|
+
./core/templates/close_buttons/auto_x_0112_151217.png
|
|
19
|
+
./core/templates/close_buttons/auto_x_0112_152037.png
|
|
20
|
+
./core/templates/close_buttons/auto_x_0112_152840.png
|
|
21
|
+
./core/templates/close_buttons/auto_x_0112_153256.png
|
|
22
|
+
./core/templates/close_buttons/auto_x_0112_154847.png
|
|
23
|
+
./core/templates/close_buttons/gray_x_stock_ad.png
|
|
18
24
|
./core/utils/__init__.py
|
|
19
25
|
./core/utils/logger.py
|
|
20
26
|
./core/utils/operation_history_manager.py
|
|
@@ -33,6 +39,12 @@ core/ios_client_wda.py
|
|
|
33
39
|
core/ios_device_manager_wda.py
|
|
34
40
|
core/mobile_client.py
|
|
35
41
|
core/template_matcher.py
|
|
42
|
+
core/templates/close_buttons/auto_x_0112_151217.png
|
|
43
|
+
core/templates/close_buttons/auto_x_0112_152037.png
|
|
44
|
+
core/templates/close_buttons/auto_x_0112_152840.png
|
|
45
|
+
core/templates/close_buttons/auto_x_0112_153256.png
|
|
46
|
+
core/templates/close_buttons/auto_x_0112_154847.png
|
|
47
|
+
core/templates/close_buttons/gray_x_stock_ad.png
|
|
36
48
|
core/utils/__init__.py
|
|
37
49
|
core/utils/logger.py
|
|
38
50
|
core/utils/operation_history_manager.py
|
|
@@ -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.3", # 修复:设备连接失败时显示详细错误和解决方案
|
|
29
29
|
author="douzi",
|
|
30
30
|
author_email="1492994674@qq.com",
|
|
31
31
|
description="移动端自动化 MCP Server - 支持 Android/iOS,AI 功能可选(基础工具不需要 AI)",
|
|
@@ -128,17 +128,10 @@ setup(
|
|
|
128
128
|
],
|
|
129
129
|
include_package_data=True,
|
|
130
130
|
zip_safe=False,
|
|
131
|
-
#
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
'templates/close_buttons/auto_x_0112_151217.png',
|
|
136
|
-
'templates/close_buttons/auto_x_0112_152037.png',
|
|
137
|
-
'templates/close_buttons/auto_x_0112_152840.png',
|
|
138
|
-
'templates/close_buttons/auto_x_0112_153256.png',
|
|
139
|
-
'templates/close_buttons/auto_x_0112_154847.png',
|
|
140
|
-
]),
|
|
141
|
-
],
|
|
131
|
+
# 包含模板图片到包内
|
|
132
|
+
package_data={
|
|
133
|
+
'mobile_mcp.core': ['templates/close_buttons/*.png'],
|
|
134
|
+
},
|
|
142
135
|
)
|
|
143
136
|
|
|
144
137
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
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.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_151217.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_152037.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_152840.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_153256.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/core}/templates/close_buttons/auto_x_0112_154847.png
RENAMED
|
File without changes
|
{mobile_mcp_ai-2.5.1 → mobile_mcp_ai-2.5.3/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
|