py-mcpdock-cli 1.0.13__py3-none-any.whl → 1.0.18__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.
- cli/commands/install.py +78 -81
- cli/commands/query_pid.py +36 -0
- cli/commands/run.py +9 -11
- cli/main.py +6 -2
- cli/runners/stdio_runner.py +112 -320
- cli/utils/config.py +120 -21
- cli/utils/logger.py +4 -4
- cli/utils/mcp_utils.py +314 -0
- cli/utils/process_utils.py +656 -0
- cli/utils/run_query_pid_by_packagename.py +62 -0
- {py_mcpdock_cli-1.0.13.dist-info → py_mcpdock_cli-1.0.18.dist-info}/METADATA +3 -1
- {py_mcpdock_cli-1.0.13.dist-info → py_mcpdock_cli-1.0.18.dist-info}/RECORD +15 -11
- {py_mcpdock_cli-1.0.13.dist-info → py_mcpdock_cli-1.0.18.dist-info}/WHEEL +1 -1
- py_mcpdock_cli-1.0.18.dist-info/entry_points.txt +2 -0
- py_mcpdock_cli-1.0.13.dist-info/entry_points.txt +0 -2
- {py_mcpdock_cli-1.0.13.dist-info → py_mcpdock_cli-1.0.18.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
"""
|
2
|
+
Utility to query if a process with a specific package name is running by checking its PID.
|
3
|
+
"""
|
4
|
+
import os
|
5
|
+
|
6
|
+
from cli.utils.logger import verbose
|
7
|
+
from ..utils.process_utils import read_pid_file
|
8
|
+
|
9
|
+
|
10
|
+
def query_pid_by_packagename(package_names: list) -> dict:
|
11
|
+
"""
|
12
|
+
检查指定包名的进程是否存在于PID文件中。
|
13
|
+
|
14
|
+
参数:
|
15
|
+
package_names (list): 要查询的包名列表。
|
16
|
+
|
17
|
+
返回:
|
18
|
+
dict: 包含每个包名的运行状态的字典,格式为 {package_name: is_running}。
|
19
|
+
"""
|
20
|
+
try:
|
21
|
+
# 如果输入的是字符串,转换为列表以保持向后兼容
|
22
|
+
if isinstance(package_names, str):
|
23
|
+
package_names = [package_names]
|
24
|
+
|
25
|
+
results = {}
|
26
|
+
pid_data = read_pid_file()
|
27
|
+
|
28
|
+
if not pid_data:
|
29
|
+
verbose(f"未找到任何 PID 文件记录")
|
30
|
+
# 如果PID文件不存在,所有包名均返回False
|
31
|
+
for package_name in package_names:
|
32
|
+
results[package_name] = False
|
33
|
+
return results
|
34
|
+
|
35
|
+
# 检查每个包名的状态
|
36
|
+
for package_name in package_names:
|
37
|
+
is_running = False
|
38
|
+
|
39
|
+
# 直接检查包名是否存在于 PID 数据中
|
40
|
+
if package_name in pid_data and pid_data[package_name]:
|
41
|
+
verbose(f"包名 '{package_name}' 的进程存在于PID文件中")
|
42
|
+
is_running = True
|
43
|
+
else:
|
44
|
+
# 尝试部分匹配
|
45
|
+
for server_name, entries in pid_data.items():
|
46
|
+
if package_name in server_name and entries:
|
47
|
+
verbose(f"包名 '{package_name}' 匹配服务器 '{server_name}' 存在于PID文件中")
|
48
|
+
is_running = True
|
49
|
+
break
|
50
|
+
|
51
|
+
if not is_running:
|
52
|
+
verbose(f"未找到包名 '{package_name}' 的进程")
|
53
|
+
|
54
|
+
# 存储该包名的运行状态
|
55
|
+
results[package_name] = is_running
|
56
|
+
|
57
|
+
return results
|
58
|
+
except Exception as e:
|
59
|
+
package_names_str = "', '".join(package_names)
|
60
|
+
verbose(f"查询包名 '{package_names_str}' 的进程时出错: {e}")
|
61
|
+
# 发生异常时,所有包名均返回False
|
62
|
+
return {package_name: False for package_name in package_names}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: py-mcpdock-cli
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.18
|
4
4
|
Summary: Python CLI for managing MCP servers
|
5
5
|
Author-email: dw <qindongwoxin@gmail.com>
|
6
6
|
Project-URL: Homepage, https://github.com/yourusername/py-mcpdock-cli
|
@@ -21,6 +21,8 @@ Requires-Dist: asyncio>=3.4.3
|
|
21
21
|
Requires-Dist: python-dotenv>=1.0.0
|
22
22
|
Requires-Dist: mcp
|
23
23
|
Requires-Dist: aiohttp>=3.8.0
|
24
|
+
Requires-Dist: psutil>=5.9.0
|
25
|
+
Requires-Dist: filelock>=3.18.0
|
24
26
|
|
25
27
|
# MCP CLI Python Implementation
|
26
28
|
|
@@ -1,27 +1,31 @@
|
|
1
1
|
cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
cli/main.py,sha256=
|
2
|
+
cli/main.py,sha256=dN7mX49NmWRV8eB-5RI2TgMpOi1ahv8rsny0Pxf-CgU,390
|
3
3
|
cli/mock_servers.json,sha256=12t6b6xlVL25G5nc1CIUxJRCBGWBqhqq6wpWfRYkfq4,6154
|
4
4
|
cli/registry.py,sha256=4-kXmj_NJNgErGvnes0L9H1UcS0F36fW-odVBzQqlos,4479
|
5
5
|
cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
cli/commands/install.py,sha256=
|
7
|
-
cli/commands/
|
6
|
+
cli/commands/install.py,sha256=nTO75kx4FnLmw0OLTRhxVK1IfB_aUkfh43_eC1AZ930,7057
|
7
|
+
cli/commands/query_pid.py,sha256=LH1Mq6FjOh7hViEbAtjjWKzA4VYoPxNuJxe6mU3uesU,1453
|
8
|
+
cli/commands/run.py,sha256=H3KmmKcTX-CO1Jb4c3CoPrhPXliXf2uNMyXh17Cw7ng,5423
|
8
9
|
cli/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
10
|
cli/config/app_config.py,sha256=nvAkTEX9qgNx1QIK8ITskAmYtBX32Ihdb-d5bDr8MQQ,253
|
10
11
|
cli/config/client_config.py,sha256=ct_BGjbKyBSvHKE5iTICKR7NmJDp4g44_o7h3koyngs,10473
|
11
12
|
cli/runners/__init__.py,sha256=wyvNbZA3TnWv10gM5dmVFPs8FZgAJhi7z9i1mNSOXAQ,734
|
12
13
|
cli/runners/command_runner.py,sha256=J5f7qaHtbOr1tOwo_QAQYMEp_nQUl6_ex6mCzpLFNpk,5119
|
13
|
-
cli/runners/stdio_runner.py,sha256=
|
14
|
+
cli/runners/stdio_runner.py,sha256=PV93P0IABqcBVue8O4BBLH_1aQoxiyOvqG71DzdwlFo,12972
|
14
15
|
cli/runners/stream_http_runner.py,sha256=rf3rMcMqgqcIz0YaC91g6KnQKL1DqkvX-T3eRP_DCWQ,5998
|
15
16
|
cli/runners/ws_runner.py,sha256=2hePDQGFThkihYZR6_Zo0B1COL1Geymevy6GrdcQRpA,1393
|
16
17
|
cli/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
18
|
cli/types/registry.py,sha256=ivIpSTAKsT_vj3eQBn7rBeQvonUQcCMEZXB0-uBZ-No,2024
|
18
19
|
cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
20
|
cli/utils/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
cli/utils/config.py,sha256=
|
21
|
-
cli/utils/logger.py,sha256=
|
21
|
+
cli/utils/config.py,sha256=nJLNXe2D4gTUI9hOTZ0-W7YAynesv6y0AgcxfGAfUl0,19538
|
22
|
+
cli/utils/logger.py,sha256=QGt2VJ8iCfpoGMDtf1D_P3dUGCSWPI7UuPG48kI4s5o,2288
|
23
|
+
cli/utils/mcp_utils.py,sha256=kNu0uKbG1EAHzz721ArDvwHl_Dnm1Y2UPHSTEy75Hj8,11361
|
24
|
+
cli/utils/process_utils.py,sha256=isYxR6b4i4BMAlmKU2XWciCBmtqCVNKF3iLW2TbvDyQ,27123
|
25
|
+
cli/utils/run_query_pid_by_packagename.py,sha256=0VdbaWyLo8U9gDdIFXQg917ZEXjJaREpt0nJ1jAa-RY,2265
|
22
26
|
cli/utils/runtime.py,sha256=m5_8leYccmSJeNb9XI__951HnrHZNo0Bn40rFAbHtgU,7829
|
23
|
-
py_mcpdock_cli-1.0.
|
24
|
-
py_mcpdock_cli-1.0.
|
25
|
-
py_mcpdock_cli-1.0.
|
26
|
-
py_mcpdock_cli-1.0.
|
27
|
-
py_mcpdock_cli-1.0.
|
27
|
+
py_mcpdock_cli-1.0.18.dist-info/METADATA,sha256=gBf2RnqR2ypZKXtTf2ezWy-D3ou24N5iFUJWA97QU_E,1096
|
28
|
+
py_mcpdock_cli-1.0.18.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
29
|
+
py_mcpdock_cli-1.0.18.dist-info/entry_points.txt,sha256=oXwmShEeKPFMdow2Wvf1hdhKsSZK7pvCwENgrNxIngs,41
|
30
|
+
py_mcpdock_cli-1.0.18.dist-info/top_level.txt,sha256=2ImG917oaVHlm0nP9oJE-Qrgs-fq_fGWgba2H1f8fpE,4
|
31
|
+
py_mcpdock_cli-1.0.18.dist-info/RECORD,,
|
File without changes
|