Skip to content

Commit e42b8eb

Browse files
authored
Merge pull request #31 from aice030/main
feat(合并文档):mcp和发布准备模块设计文档
2 parents 02d435c + 53aaac9 commit e42b8eb

File tree

30 files changed

+2096
-0
lines changed

30 files changed

+2096
-0
lines changed

docs/mcp设计.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Prometheus MCP Server
2+
3+
## prometheus\_query
4+
5+
**描述:**执行指定的 PromQL 查询语句,并获取对应地区的 Prometheus 监控指标数据
6+
7+
**参数列表:**
8+
9+
{
10+
11+
`"promql"`(string, 必需):PromQL 查询语句
12+
13+
`"regionCode"`(string, 可选):地区代码,用于映射查询的 Prometheus 地址。默认值为 "mock",对应 "localhost"。
14+
15+
}
16+
17+
**返回值格式:**
18+
19+
```json
20+
{
21+
"status": "success",
22+
"data": {
23+
"resultType": "vector",
24+
"result": [
25+
{
26+
"metric": {
27+
"__name__": "process_cpu_seconds_total",
28+
"instance": "localhost:9090",
29+
"job": "prometheus"
30+
},
31+
"value": [1640995200, "0.001234"]
32+
}
33+
]
34+
}
35+
}
36+
```
37+
38+
# ElasticSearch MCP Servier
39+
40+
## elasticsearch\_get\_service
41+
42+
**描述:**;询指定主机在给定时间区间内运行的服务
43+
44+
**参数列表:**
45+
46+
{
47+
48+
` "host_id"`(string, 必需):主机ID
49+
50+
`"start_time"`(string, 必需):查询区间的起始时间,格式为 '2025-08-20T00:00:00Z',工具支持格式转换
51+
52+
`"end_time"`(string, 必需):查询区间的结束时间,格式为 '2025-08-20T00:00:00Z',工具支持格式转换
53+
54+
}
55+
56+
**返回值格式:**
57+
58+
```json
59+
{
60+
"status": "success",
61+
"data": {
62+
"host_id": "server-001",
63+
"service": "storage-service",
64+
"start_time": "2025-08-20T00:00:00Z",
65+
"end_time": "2025-08-20T23:59:59Z"
66+
}
67+
}
68+
```
69+
70+
## elasticsearch\_fetch\_logs
71+
72+
**描述:**根据服务名称和主机 ID,获取指定时间段内的运行日志
73+
74+
**参数列表:**
75+
76+
{
77+
78+
`"service"`(string, 可选, 推荐):服务名称,若未指定,则需额外根据主机查询服务。
79+
80+
`"host_id"`(string, 必需):主机ID
81+
82+
`"start_time"`(string, 必需):查询区间的起始时间,格式为 '2025-08-20T00:00:00Z',工具支持格式转换
83+
84+
`"end_time"`(string, 必需):查询区间的结束时间,格式为 '2025-08-20T00:00:00Z',工具支持格式转换
85+
86+
}
87+
88+
**返回值格式:**
89+
90+
```json
91+
{
92+
"status": "success",
93+
"data": {
94+
"service": "storage-service",
95+
"host_id": "server-001",
96+
"start_time": "2025-08-20T00:00:00Z",
97+
"end_time": "2025-08-20T23:59:59Z",
98+
"index": "mock-storage-service-logs-2025.08.20",
99+
"total_logs": 150,
100+
"logs": [
101+
{
102+
"_index": "mock-storage-service-logs-2025.08.20",
103+
"_source": {
104+
"@timestamp": "2025-08-20T10:30:00Z",
105+
"host_id": "server-001",
106+
"service": "storage-service",
107+
"level": "INFO",
108+
"message": "Request processed successfully"
109+
}
110+
},
111+
......
112+
]
113+
}
114+
}
115+
```
116+
117+
## elasticsearch\_request\_trace
118+
119+
**描述:**;据请求 ID,追踪该请求在指定时间段内经过的所有服务,并获取相关运行日志,构建请求链路
120+
121+
**实现方式:**;具会基于请求ID和起止时间,查询请求在指定时间段内经过的所有服务及其日志记录。随后根据处理顺序对服务进行排序,从而得到该请求的上下游关系。
122+
123+
**参数列表:**
124+
125+
{
126+
127+
`"request_id"`(string, 必需):请求ID
128+
129+
` "start_time"`(string, 必需):查询区间的结束时间,格式为 '2025-08-20T00:00:00Z',工具支持格式转换
130+
131+
`"end_time"`(string, 必需):查询区间的结束时间,格式为 '2025-08-20T00:00:00Z',工具支持格式转换
132+
133+
}
134+
135+
**返回值格式:**
136+
137+
```json
138+
{
139+
"status": "success",
140+
"data": {
141+
"request_id": "req-12345",
142+
"start_time": "2025-08-20T00:00:00Z",
143+
"end_time": "2025-08-20T23:59:59Z",
144+
"index_pattern": "mock-storage-service-logs-2025.08.20",
145+
"total_services": 3,
146+
"services": ["api-gateway", "user-service", "database-service"],
147+
"total_logs": 25,
148+
"logs": [...]
149+
}
150+
}
151+
```
152+
176 KB
Loading

0 commit comments

Comments
 (0)