mm-qa-mcp 0.2.0__py3-none-any.whl → 0.3.0__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.
@@ -878,7 +878,7 @@ API基本描述: {json.dumps(self.api_descriptions, ensure_ascii=False)}
878
878
  # 前置操作文件内容
879
879
  ```
880
880
 
881
- # 测试用例文件(test_{case_name}.py):
881
+ # 测试用例文件(test_link_{case_name}.py):
882
882
  ```python
883
883
  # 测试用例文件内容
884
884
  ```
@@ -1019,7 +1019,7 @@ API基本描述: {json.dumps(self.api_descriptions, ensure_ascii=False)}
1019
1019
  pre_file_path = case_dir / f"pre_{case_name}.py"
1020
1020
  file_result_one["pre_case_dir"] = str(pre_file_path)
1021
1021
  file_result_one['pre_case_result'] = pre_code
1022
- case_file_path = case_dir / f"test_{case_name}.py"
1022
+ case_file_path = case_dir / f"test_link_{case_name}.py"
1023
1023
  file_result_one["case_dir"] = str(case_file_path)
1024
1024
  file_result_one['case_result'] = case_code
1025
1025
 
@@ -16,7 +16,7 @@ class GetFromGrafana:
16
16
  to_formatted_time = datetime.now(timezone(timedelta(hours=8))).isoformat()
17
17
  # 获取一天前的时间
18
18
  # 格式化为 ISO 8601 格式的字符串,包含微秒和时区信息
19
- from_formatted_time = (datetime.now(timezone(timedelta(days=1))) - timedelta(hours=1)).isoformat()
19
+ from_formatted_time = (datetime.now(timezone(timedelta(hours=24))) - timedelta(hours=1)).isoformat()
20
20
 
21
21
  self.to_time = str(to_formatted_time)
22
22
  self.from_time = str(from_formatted_time)
@@ -98,7 +98,8 @@ class GetApiFromGrafana:
98
98
 
99
99
 
100
100
  if __name__ == '__main__':
101
- print("test")
102
- # print(GetFromGrafana("xingye_test").post_grafana())
101
+ msgs = [""]
102
+ # print("test")
103
+ print(GetFromGrafana("hailuo").post_grafana())
103
104
  # print(GetApiFromGrafana("hailuo_video_us_http","").get_need_method())
104
- print(GetApiFromGrafana("xingye_prod", "weaver-account-account").get_need_method())
105
+ # print(GetApiFromGrafana("xingye_prod", "weaver-account-account").get_need_method())
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: mm_qa_mcp
3
+ Version: 0.3.0
4
+ Summary: QA agent service 集合
5
+ Author-email: xingyun <xingyun@minimaxi.com>
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: annotated-types>=0.7.0
15
+ Requires-Dist: anyio>=4.9.0
16
+ Requires-Dist: Authlib>=1.5.2
17
+ Requires-Dist: certifi>=2025.1.31
18
+ Requires-Dist: cffi>=1.17.1
19
+ Requires-Dist: charset-normalizer>=3.4.1
20
+ Requires-Dist: classes>=0.4.1
21
+ Requires-Dist: click>=8.1.8
22
+ Requires-Dist: cryptography>=44.0.2
23
+ Requires-Dist: h11>=0.14.0
24
+ Requires-Dist: httpcore>=1.0.7
25
+ Requires-Dist: httpx>=0.28.1
26
+ Requires-Dist: httpx-sse>=0.4.0
27
+ Requires-Dist: idna>=3.10
28
+ Requires-Dist: jsonpatch>=1.33
29
+ Requires-Dist: jsonpointer>=3.0.0
30
+ Requires-Dist: langchain-core>=0.3.51
31
+ Requires-Dist: langsmith>=0.3.27
32
+ Requires-Dist: mcp>=1.6.0
33
+ Requires-Dist: numpy>=2.2.4
34
+ Requires-Dist: orjson>=3.10.16
35
+ Requires-Dist: packaging>=24.2
36
+ Requires-Dist: pandas>=2.2.3
37
+ Requires-Dist: prettytable>=3.16.0
38
+ Requires-Dist: pycparser>=2.22
39
+ Requires-Dist: pydantic>=2.11.3
40
+ Requires-Dist: pydantic-settings>=2.8.1
41
+ Requires-Dist: pydantic_core>=2.33.1
42
+ Requires-Dist: python-dateutil>=2.9.0.post0
43
+ Requires-Dist: python-dotenv>=1.1.0
44
+ Requires-Dist: pytz>=2025.2
45
+ Requires-Dist: PyYAML>=6.0.2
46
+ Requires-Dist: requests>=2.32.3
47
+ Requires-Dist: requests-toolbelt>=1.0.0
48
+ Requires-Dist: six>=1.17.0
49
+ Requires-Dist: sniffio>=1.3.1
50
+ Requires-Dist: sse-starlette>=2.2.1
51
+ Requires-Dist: starlette>=0.46.1
52
+ Requires-Dist: tabulate>=0.9.0
53
+ Requires-Dist: tenacity>=9.1.2
54
+ Requires-Dist: typing-inspection>=0.4.0
55
+ Requires-Dist: typing_extensions>=4.13.1
56
+ Requires-Dist: tzdata>=2025.2
57
+ Requires-Dist: urllib3>=2.3.0
58
+ Requires-Dist: uvicorn>=0.34.0
59
+ Requires-Dist: validators>=0.34.0
60
+ Requires-Dist: wcwidth>=0.2.13
61
+ Requires-Dist: weaviate>=0.1.2
62
+ Requires-Dist: weaviate-client>=3.26.7
63
+ Requires-Dist: zstandard>=0.23.0
64
+ Provides-Extra: dev
65
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
66
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
67
+ Requires-Dist: black>=23.0.0; extra == "dev"
68
+ Requires-Dist: isort>=5.12.0; extra == "dev"
69
+ Requires-Dist: twine>=4.0.0; extra == "dev"
70
+
71
+ # QA 智能体
72
+
73
+ ## 项目介绍
74
+
75
+ QA智能工具服务是一个集成了多种质量检测和开发辅助功能的服务集合,主要用于支持测试、开发和运维工作。服务通过MCP(Model Control Protocol)接口与各类客户端(Claude/cursor等)集成,提供包括日志检索、代码分析、案例生成和知识库查询等功能。
76
+
77
+ ## 项目结构
78
+
79
+ ```
80
+ minimax_qa_mcp/
81
+ ├── server.py # MCP服务入口与API定义
82
+ ├── src/ # 核心功能模块
83
+ │ ├── grafana/ # 日志检索和API调用分析
84
+ │ ├── gateway_case/ # API流量日志分析
85
+ │ ├── query_segments/# 代码分析与搜索
86
+ │ ├── generator_case/# 自动生成测试用例
87
+ │ ├── get_weaviate_info/ # 知识库检索
88
+ │ └── xmind2markdown/ # XMind转Markdown工具
89
+ ├── conf/ # 配置文件
90
+ ├── utils/ # 工具函数库
91
+ └── logs/ # 日志输出目录
92
+ ```
93
+
94
+ ## 核心功能
95
+
96
+ ### 1. 日志检索与分析
97
+
98
+ - **获取Grafana日志**:支持从多个业务线(星野、Talkie、海螺视频等)的不同环境(测试、生产)获取日志
99
+ - **接口调用分析**:获取服务的接口调用列表及基本信息
100
+ - **HTTP流量日志**:提取API接口的请求与响应日志,支持CSV导出
101
+
102
+ ### 2. 代码分析与搜索
103
+
104
+ - **多模式代码查询**:
105
+ - API查询:获取API的路径、入参、出参和实现逻辑
106
+ - 函数分析:查询函数的调用链关系图谱
107
+ - 代码影响分析:分析代码变更的影响范围
108
+ - 函数详情查看:查询函数的详细实现代码
109
+ - 模糊搜索:搜索相似的代码片段
110
+
111
+ ### 3. 自动生成测试用例
112
+
113
+ - 基于API信息自动生成测试用例
114
+ - 支持生成前置条件和测试案例
115
+ - 与代码仓库集成,自动分析API实现
116
+
117
+ ### 4. 知识库检索
118
+
119
+ - 基于向量数据库的文档搜索
120
+ - 支持语义相似度检索
121
+ - 可与模型集成进行内容总结
122
+
123
+ ## 环境配置与启动
124
+
125
+ ### 依赖安装
126
+
127
+ 项目使用pyproject.toml和setup.py管理依赖。可以通过以下方式安装:
128
+
129
+ ```shell
130
+ pip install -e .
131
+ ```
132
+
133
+ 或通过发布脚本build并安装:
134
+
135
+ ```shell
136
+ bash publish.sh
137
+ pip install dist/*.whl
138
+ ```
139
+
140
+ ### 启动服务
141
+
142
+ 直接启动server.py:
143
+
144
+ ```shell
145
+ python minimax_qa_mcp/server.py
146
+ ```
147
+
148
+
149
+ ### 客户端集成
150
+
151
+ #### Cursor 集成
152
+
153
+ 在Cursor配置文件中添加:
154
+
155
+ ```json
156
+ {
157
+ "agent_name": {
158
+ "command": "uvx",
159
+ "args": [
160
+ "mm_qa_mcp"
161
+ ]
162
+ }
163
+ }
164
+ ```
165
+
166
+ ## API 参考
167
+
168
+ ### 日志服务
169
+
170
+ - `get_grafana_data(scene, psm, msg, from_time, to_time)`:获取业务日志
171
+ - scene: 枚举值,指定业务线和环境(例如:xingye_prod, talkie_test)
172
+ - psm: 服务名称
173
+ - msg: 筛选关键字
174
+ - from_time/to_time: 时间范围
175
+
176
+ - `get_top_methods(scene, psm)`:获取服务接口列表
177
+ - scene: 枚举值,指定业务线和协议(例如:xingye_http, talkie_rpc)
178
+ - psm: 服务名称
179
+
180
+ - `get_http_data(scene, psm, api_path, from_time, to_time)`:获取HTTP接口日志
181
+ - 返回CSV文件访问地址
182
+
183
+ ### 代码分析
184
+
185
+ - `query_code_segments(query, query_type, limit, exact, advanced, depth, direction, output)`
186
+ - query: 查询内容(API路径、函数名等)
187
+ - query_type: 查询类型(API, FUNC, CODE, FUNC_DETAIL, ANY)
188
+ - 其他参数用于精确控制查询行为
189
+
190
+ ### 测试案例生成
191
+
192
+ - `gen_case(input_data, pwd)`:生成测试用例
193
+ - input_data: JSON格式的输入数据
194
+ - pwd: 用户当前目录地址
195
+ - 返回前置条件和测试用例文件路径
196
+
197
+ ### 知识库检索
198
+
199
+ - `get_weaviate_info(input_data)`:从知识库获取业务相关信息
200
+ - input_data: 用户问题
201
+ - 返回相关文档信息
202
+
203
+ ## 打包上传pypi流程
204
+
205
+ ### 1. 创建配置文件
206
+
207
+ ```bash
208
+ vim ~/.pypirc
209
+ ```
210
+
211
+ 添加以下内容(账号密码 联系@星云):
212
+
213
+ ```ini
214
+ [pypi]
215
+ username = xxxxx
216
+ password = xxxxx
217
+ ```
218
+
219
+ ### 2. 打包
220
+
221
+ 执行打包脚本:
222
+
223
+ ```bash
224
+ bash publish.sh
225
+ ```
226
+
227
+
@@ -8,12 +8,12 @@ minimax_qa_mcp/src/demo_langchain/langchain_demo.py,sha256=Nqnn8clbgv-5l0PgxcTOl
8
8
  minimax_qa_mcp/src/gateway_case/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  minimax_qa_mcp/src/gateway_case/get_case.py,sha256=djn77_zn_252Mhmk_qn_9k_uz4NAjadq2bEnKyPi7iw,27116
10
10
  minimax_qa_mcp/src/generator_case/__init__.py,sha256=Sy4ncJFUvzzFAlwlJAC7cQ2YdD4JFXpmovG3jVVboHc,79
11
- minimax_qa_mcp/src/generator_case/generator_case.py,sha256=AO6K-LUrpboW54gDZrx4_mpF3jkhmucrPs2_oCXbnnc,50074
11
+ minimax_qa_mcp/src/generator_case/generator_case.py,sha256=0DyJCW_NDnFFEKGYzz1mJEtnO4kVJOjqIBGDPa2cc6g,50084
12
12
  minimax_qa_mcp/src/generator_case/generator_case_langchain.py,sha256=i0OnLBFEWtQymBVH28iILR1XqfKWXhgpYZzewUNSzl0,43256
13
13
  minimax_qa_mcp/src/get_weaviate_info/__init__.py,sha256=sMKXpobyDsZBnRFR7ozqPfpJEN1x3cIBM7mTTPrv1PE,80
14
14
  minimax_qa_mcp/src/get_weaviate_info/get_weaviate_info.py,sha256=kKjfqDZ0Ka13YuAAT5ru8nB1Twm-JkeJnv1a80lHk8Q,10390
15
15
  minimax_qa_mcp/src/grafana/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- minimax_qa_mcp/src/grafana/service.py,sha256=PwgbB99kgwPhy7g1zafkdzCHqwXW8zfG53mlZfAMYqA,4255
16
+ minimax_qa_mcp/src/grafana/service.py,sha256=GCk4RXuVlj0X4st3ZQPF-TsttmQwQ2DRBe66S0AL0jU,4270
17
17
  minimax_qa_mcp/src/query_segments/__init__.py,sha256=nNfm8AmQKuQMPPVMtimtgiz_f_yYKY70JoUCa-s7TJ0,80
18
18
  minimax_qa_mcp/src/query_segments/query_segments.py,sha256=ZtFEjR9npd1zoCQOVkukvUFXmCub6MaJ_GTy0abLQes,93237
19
19
  minimax_qa_mcp/src/xmind2markdown/__init__.py,sha256=IqnCkza9xw5r-0mEetNQoQrkoX-E8yaMmkcgi4MOoPk,80
@@ -21,8 +21,8 @@ minimax_qa_mcp/src/xmind2markdown/xmind_to_markdown.py,sha256=86WZ4aTf1Y4jDLsoBa
21
21
  minimax_qa_mcp/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  minimax_qa_mcp/utils/logger.py,sha256=R1SyLTra9ngjSu4vKJ21krgl83Or33Q0dRz6-K_OYS8,1089
23
23
  minimax_qa_mcp/utils/utils.py,sha256=Xb9d6lz4p3wVDbLKrctfG3v5_Lx1ge6vFMmtAqZ9qF4,8703
24
- mm_qa_mcp-0.2.0.dist-info/METADATA,sha256=ubINaJAX3AZQRdshpFS6j8VBJO5GiS46IUEe9ngjsjM,4405
25
- mm_qa_mcp-0.2.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
26
- mm_qa_mcp-0.2.0.dist-info/entry_points.txt,sha256=iP2Pl72UfrJCDakHv_Zxg6ci6gtvZipc8cN1SvqueJk,63
27
- mm_qa_mcp-0.2.0.dist-info/top_level.txt,sha256=cXfV8AjI2zW5yK2aw4Z2TMV9oRPx6eU04K9ZxwqAtxw,15
28
- mm_qa_mcp-0.2.0.dist-info/RECORD,,
24
+ mm_qa_mcp-0.3.0.dist-info/METADATA,sha256=Tppiu3ZvyBFDQPvyiZU1NtlokGD8DIdn6d8xliS2rCg,6306
25
+ mm_qa_mcp-0.3.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
26
+ mm_qa_mcp-0.3.0.dist-info/entry_points.txt,sha256=iP2Pl72UfrJCDakHv_Zxg6ci6gtvZipc8cN1SvqueJk,63
27
+ mm_qa_mcp-0.3.0.dist-info/top_level.txt,sha256=cXfV8AjI2zW5yK2aw4Z2TMV9oRPx6eU04K9ZxwqAtxw,15
28
+ mm_qa_mcp-0.3.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,167 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: mm_qa_mcp
3
- Version: 0.2.0
4
- Summary: QA agent service 集合
5
- Author-email: xingyun <xingyun@minimaxi.com>
6
- License-Expression: MIT
7
- Classifier: Development Status :: 4 - Beta
8
- Classifier: Intended Audience :: Developers
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Requires-Python: >=3.10
13
- Description-Content-Type: text/markdown
14
- Requires-Dist: annotated-types>=0.7.0
15
- Requires-Dist: anyio>=4.9.0
16
- Requires-Dist: Authlib>=1.5.2
17
- Requires-Dist: certifi>=2025.1.31
18
- Requires-Dist: cffi>=1.17.1
19
- Requires-Dist: charset-normalizer>=3.4.1
20
- Requires-Dist: classes>=0.4.1
21
- Requires-Dist: click>=8.1.8
22
- Requires-Dist: cryptography>=44.0.2
23
- Requires-Dist: h11>=0.14.0
24
- Requires-Dist: httpcore>=1.0.7
25
- Requires-Dist: httpx>=0.28.1
26
- Requires-Dist: httpx-sse>=0.4.0
27
- Requires-Dist: idna>=3.10
28
- Requires-Dist: jsonpatch>=1.33
29
- Requires-Dist: jsonpointer>=3.0.0
30
- Requires-Dist: langchain-core>=0.3.51
31
- Requires-Dist: langsmith>=0.3.27
32
- Requires-Dist: mcp>=1.6.0
33
- Requires-Dist: numpy>=2.2.4
34
- Requires-Dist: orjson>=3.10.16
35
- Requires-Dist: packaging>=24.2
36
- Requires-Dist: pandas>=2.2.3
37
- Requires-Dist: prettytable>=3.16.0
38
- Requires-Dist: pycparser>=2.22
39
- Requires-Dist: pydantic>=2.11.3
40
- Requires-Dist: pydantic-settings>=2.8.1
41
- Requires-Dist: pydantic_core>=2.33.1
42
- Requires-Dist: python-dateutil>=2.9.0.post0
43
- Requires-Dist: python-dotenv>=1.1.0
44
- Requires-Dist: pytz>=2025.2
45
- Requires-Dist: PyYAML>=6.0.2
46
- Requires-Dist: requests>=2.32.3
47
- Requires-Dist: requests-toolbelt>=1.0.0
48
- Requires-Dist: six>=1.17.0
49
- Requires-Dist: sniffio>=1.3.1
50
- Requires-Dist: sse-starlette>=2.2.1
51
- Requires-Dist: starlette>=0.46.1
52
- Requires-Dist: tabulate>=0.9.0
53
- Requires-Dist: tenacity>=9.1.2
54
- Requires-Dist: typing-inspection>=0.4.0
55
- Requires-Dist: typing_extensions>=4.13.1
56
- Requires-Dist: tzdata>=2025.2
57
- Requires-Dist: urllib3>=2.3.0
58
- Requires-Dist: uvicorn>=0.34.0
59
- Requires-Dist: validators>=0.34.0
60
- Requires-Dist: wcwidth>=0.2.13
61
- Requires-Dist: weaviate>=0.1.2
62
- Requires-Dist: weaviate-client>=3.26.7
63
- Requires-Dist: zstandard>=0.23.0
64
- Provides-Extra: dev
65
- Requires-Dist: pytest>=7.0.0; extra == "dev"
66
- Requires-Dist: mypy>=1.0.0; extra == "dev"
67
- Requires-Dist: black>=23.0.0; extra == "dev"
68
- Requires-Dist: isort>=5.12.0; extra == "dev"
69
- Requires-Dist: twine>=4.0.0; extra == "dev"
70
-
71
- # QA - agent service 集合
72
-
73
- ## 项目结构
74
- - `server.py`: MCP接口定义和服务启动入口
75
- - `src/`: 核心功能模块实现
76
- - `conf/`: 配置文件
77
- - `utils/`: 工具函数
78
- - `logs/`: 日志文件夹
79
-
80
- ## 功能特性
81
- 1. 天气服务(demo):
82
- - 获取美国各州天气警报信息
83
- - 基于经纬度获取天气预报
84
-
85
- 2. 日志检索服务:
86
- - 从Grafana获取各业务服务的日志
87
- - 支持按关键字、时间等条件筛选
88
- - 支持获取服务接口列表
89
-
90
- ## 环境配置与启动
91
-
92
- 项目现在使用ux进行构建和打包,提供了多种安装运行方式。
93
-
94
- ### 1. 从PyPI安装
95
-
96
- ```shell
97
- # 直接从PyPI安装
98
- pip install minimax-qa-mcp
99
-
100
- # 运行服务
101
- minimax-qa-mcp
102
- ```
103
-
104
- ### 2. 开发模式
105
-
106
- ```shell
107
- # 安装依赖
108
- pip install ux
109
- pip install -r requirements.txt
110
-
111
- # 开发模式运行
112
- bash run.sh
113
- # 或
114
- ux run
115
- ```
116
-
117
- ### 3. 构建与发布
118
-
119
- ```shell
120
- # 构建项目
121
- bash build.sh
122
-
123
- # 发布到PyPI
124
- bash publish.sh
125
- ```
126
-
127
- ### 4. 查看启动
128
- ```
129
- 本地生成 log/agent_log.log文件,且打印
130
- INFO: Uvicorn running on http://0.0.0.0:8888 (Press CTRL+C to quit)
131
- ```
132
-
133
- ### 5. 集成到MCP客户端
134
-
135
- #### curl
136
- ```shell
137
- http://0.0.0.0:8888/sse
138
- ```
139
-
140
- #### Python模块方式
141
- ```shell
142
- python -m minimax_qa_mcp.server
143
- ```
144
-
145
- #### Claude Desktop 配置
146
- ```json
147
- {
148
- "agent_name": {
149
- "command": "minimax-qa-mcp",
150
- "args": ["--host", "0.0.0.0", "--port", "8888"]
151
- }
152
- }
153
- ```
154
-
155
- ## API 说明
156
-
157
- ### 天气服务(demo)
158
- - `get_alerts(state)`: 获取指定州的天气警报
159
- - `get_forecast(latitude, longitude)`: 获取指定位置的天气预报
160
-
161
- ### 日志服务
162
- - `get_grafana_data(scene, psm, msg, from_time, to_time)`: 获取业务的grafana日志
163
- - `get_top_methods(scene, psm)`: 获取服务存在调用的接口列表
164
- - `get_http_data(scene, psm, api_path, from_time, to_time)`: 获取业务http接口流量日志
165
- - `query_code_segments(query, query_type, limit, exact, advanced, depth, direction, output)`: 查询代码片段
166
- - `gen_case(input_data, pwd)`: 生成link_case
167
- - `get_weaviate_info(input_data)`: 获取业务相关信息