@leeguoo/zentao-mcp 0.3.2 → 0.4.0
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.
- package/README.md +2 -14
- package/package.json +2 -1
- package/src/index.js +6 -50
package/README.md
CHANGED
|
@@ -92,11 +92,10 @@ If you prefer to use environment variables instead of CLI args, you can configur
|
|
|
92
92
|
|
|
93
93
|
## Tools
|
|
94
94
|
|
|
95
|
-
The MCP server provides
|
|
95
|
+
The MCP server provides three tools that can be triggered by natural language in Cursor:
|
|
96
96
|
|
|
97
97
|
- **`zentao_products_list`** - List all products
|
|
98
98
|
- **`zentao_bugs_list`** - List bugs for a specific product
|
|
99
|
-
- **`zentao_bugs_stats`** - Get bug statistics across products
|
|
100
99
|
- **`zentao_bugs_mine`** - List my bugs by assignment or creator (status filter supported)
|
|
101
100
|
|
|
102
101
|
### Usage Examples
|
|
@@ -107,7 +106,6 @@ After configuring the MCP server in Cursor, you can use natural language to inte
|
|
|
107
106
|
- "Show me all products"
|
|
108
107
|
- "List bugs for product 1"
|
|
109
108
|
- "Show me bugs"
|
|
110
|
-
- "What's the bug statistics?"
|
|
111
109
|
- "Show my bugs"
|
|
112
110
|
- "List bugs assigned to me"
|
|
113
111
|
- "View bugs in product 2"
|
|
@@ -115,7 +113,6 @@ After configuring the MCP server in Cursor, you can use natural language to inte
|
|
|
115
113
|
**Chinese (中文):**
|
|
116
114
|
- "看bug" / "查看bug" / "显示bug"
|
|
117
115
|
- "产品1的bug列表"
|
|
118
|
-
- "bug统计"
|
|
119
116
|
- "显示所有产品"
|
|
120
117
|
- "查看产品2的问题"
|
|
121
118
|
- "我的bug"
|
|
@@ -124,8 +121,7 @@ After configuring the MCP server in Cursor, you can use natural language to inte
|
|
|
124
121
|
The AI will automatically:
|
|
125
122
|
1. Use `zentao_products_list` to get product IDs when needed
|
|
126
123
|
2. Use `zentao_bugs_list` when you ask to see bugs
|
|
127
|
-
3. Use `
|
|
128
|
-
4. Use `zentao_bugs_mine` when you ask for your own bugs
|
|
124
|
+
3. Use `zentao_bugs_mine` when you ask for your own bugs
|
|
129
125
|
|
|
130
126
|
### Tool Parameters
|
|
131
127
|
|
|
@@ -146,14 +142,6 @@ The AI will automatically:
|
|
|
146
142
|
}
|
|
147
143
|
```
|
|
148
144
|
|
|
149
|
-
**zentao_bugs_stats:**
|
|
150
|
-
```json
|
|
151
|
-
{
|
|
152
|
-
"includeZero": false,
|
|
153
|
-
"limit": 1000
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
145
|
**zentao_bugs_mine:**
|
|
158
146
|
```json
|
|
159
147
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leeguoo/zentao-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MCP server for ZenTao RESTful APIs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zentao",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"start": "node src/index.js",
|
|
34
|
+
"self-test": "node scripts/self-test.mjs",
|
|
34
35
|
"release": "./scripts/release.sh",
|
|
35
36
|
"release:patch": "./scripts/release.sh patch",
|
|
36
37
|
"release:minor": "./scripts/release.sh minor",
|
package/src/index.js
CHANGED
|
@@ -64,12 +64,11 @@ function extractAccounts(value) {
|
|
|
64
64
|
return value.flatMap((item) => extractAccounts(item));
|
|
65
65
|
}
|
|
66
66
|
if (typeof value === "object") {
|
|
67
|
-
|
|
68
|
-
if (value.
|
|
69
|
-
if (value.
|
|
70
|
-
if (value.
|
|
71
|
-
|
|
72
|
-
return candidates.filter(Boolean);
|
|
67
|
+
if (value.account) return extractAccounts(value.account);
|
|
68
|
+
if (value.user) return extractAccounts(value.user);
|
|
69
|
+
if (value.name) return extractAccounts(value.name);
|
|
70
|
+
if (value.realname) return extractAccounts(value.realname);
|
|
71
|
+
return [];
|
|
73
72
|
}
|
|
74
73
|
return [];
|
|
75
74
|
}
|
|
@@ -228,34 +227,6 @@ class ZentaoClient {
|
|
|
228
227
|
return { bugs, total };
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
async bugStats({ includeZero, limit }) {
|
|
232
|
-
const productsResponse = await this.listProducts({ page: 1, limit: toInt(limit, 1000) });
|
|
233
|
-
if (productsResponse.status !== 1) return productsResponse;
|
|
234
|
-
|
|
235
|
-
const products = productsResponse.result.products || [];
|
|
236
|
-
const rows = [];
|
|
237
|
-
let total = 0;
|
|
238
|
-
|
|
239
|
-
products.forEach((product) => {
|
|
240
|
-
const totalBugs = toInt(product.totalBugs, 0);
|
|
241
|
-
if (!includeZero && totalBugs === 0) return;
|
|
242
|
-
total += totalBugs;
|
|
243
|
-
rows.push({
|
|
244
|
-
id: product.id,
|
|
245
|
-
name: product.name,
|
|
246
|
-
totalBugs,
|
|
247
|
-
unresolvedBugs: toInt(product.unresolvedBugs, 0),
|
|
248
|
-
closedBugs: toInt(product.closedBugs, 0),
|
|
249
|
-
fixedBugs: toInt(product.fixedBugs, 0),
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
return normalizeResult({
|
|
254
|
-
total,
|
|
255
|
-
products: rows,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
230
|
async bugsMine({
|
|
260
231
|
account,
|
|
261
232
|
scope,
|
|
@@ -372,7 +343,7 @@ function getClient() {
|
|
|
372
343
|
const server = new Server(
|
|
373
344
|
{
|
|
374
345
|
name: "zentao-mcp",
|
|
375
|
-
version: "0.
|
|
346
|
+
version: "0.4.0",
|
|
376
347
|
},
|
|
377
348
|
{
|
|
378
349
|
capabilities: {
|
|
@@ -408,18 +379,6 @@ const tools = [
|
|
|
408
379
|
additionalProperties: false,
|
|
409
380
|
},
|
|
410
381
|
},
|
|
411
|
-
{
|
|
412
|
-
name: "zentao_bugs_stats",
|
|
413
|
-
description: "Get bug statistics (bug统计) across all products. Shows total bugs, unresolved bugs, closed bugs, and fixed bugs per product. Use when user asks for bug summary, statistics, overview, or 'bug统计'.",
|
|
414
|
-
inputSchema: {
|
|
415
|
-
type: "object",
|
|
416
|
-
properties: {
|
|
417
|
-
includeZero: { type: "boolean", description: "Include products with zero bugs (default false)." },
|
|
418
|
-
limit: { type: "integer", description: "Max products to fetch (default 1000)." },
|
|
419
|
-
},
|
|
420
|
-
additionalProperties: false,
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
382
|
{
|
|
424
383
|
name: "zentao_bugs_mine",
|
|
425
384
|
description: "List my bugs (我的Bug) by assignment or creator. Default scope is assigned. Use when user asks for 'my bugs', '我的bug', '分配给我', or personal bug list.",
|
|
@@ -464,9 +423,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
464
423
|
case "zentao_bugs_list":
|
|
465
424
|
result = await api.listBugs(args);
|
|
466
425
|
break;
|
|
467
|
-
case "zentao_bugs_stats":
|
|
468
|
-
result = await api.bugStats(args);
|
|
469
|
-
break;
|
|
470
426
|
case "zentao_bugs_mine":
|
|
471
427
|
result = await api.bugsMine(args);
|
|
472
428
|
break;
|