@leeguoo/zentao-mcp 0.3.3 → 0.4.1
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 +6 -7
- package/package.json +1 -1
- package/src/index.js +19 -35
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ The MCP server provides four tools that can be triggered by natural language in
|
|
|
96
96
|
|
|
97
97
|
- **`zentao_products_list`** - List all products
|
|
98
98
|
- **`zentao_bugs_list`** - List bugs for a specific product
|
|
99
|
-
- **`
|
|
99
|
+
- **`zentao_bug_get`** - Get bug details by ID
|
|
100
100
|
- **`zentao_bugs_mine`** - List my bugs by assignment or creator (status filter supported)
|
|
101
101
|
|
|
102
102
|
### Usage Examples
|
|
@@ -106,8 +106,8 @@ After configuring the MCP server in Cursor, you can use natural language to inte
|
|
|
106
106
|
**English:**
|
|
107
107
|
- "Show me all products"
|
|
108
108
|
- "List bugs for product 1"
|
|
109
|
+
- "Show bug 123"
|
|
109
110
|
- "Show me bugs"
|
|
110
|
-
- "What's the bug statistics?"
|
|
111
111
|
- "Show my bugs"
|
|
112
112
|
- "List bugs assigned to me"
|
|
113
113
|
- "View bugs in product 2"
|
|
@@ -115,7 +115,7 @@ After configuring the MCP server in Cursor, you can use natural language to inte
|
|
|
115
115
|
**Chinese (中文):**
|
|
116
116
|
- "看bug" / "查看bug" / "显示bug"
|
|
117
117
|
- "产品1的bug列表"
|
|
118
|
-
- "bug
|
|
118
|
+
- "查看bug 123"
|
|
119
119
|
- "显示所有产品"
|
|
120
120
|
- "查看产品2的问题"
|
|
121
121
|
- "我的bug"
|
|
@@ -124,7 +124,7 @@ After configuring the MCP server in Cursor, you can use natural language to inte
|
|
|
124
124
|
The AI will automatically:
|
|
125
125
|
1. Use `zentao_products_list` to get product IDs when needed
|
|
126
126
|
2. Use `zentao_bugs_list` when you ask to see bugs
|
|
127
|
-
3. Use `
|
|
127
|
+
3. Use `zentao_bug_get` when you ask for bug details
|
|
128
128
|
4. Use `zentao_bugs_mine` when you ask for your own bugs
|
|
129
129
|
|
|
130
130
|
### Tool Parameters
|
|
@@ -146,11 +146,10 @@ The AI will automatically:
|
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
**
|
|
149
|
+
**zentao_bug_get:**
|
|
150
150
|
```json
|
|
151
151
|
{
|
|
152
|
-
"
|
|
153
|
-
"limit": 1000
|
|
152
|
+
"id": 123
|
|
154
153
|
}
|
|
155
154
|
```
|
|
156
155
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -184,6 +184,18 @@ class ZentaoClient {
|
|
|
184
184
|
return normalizeResult(payload);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
async getBug({ id }) {
|
|
188
|
+
if (!id) throw new Error("id is required");
|
|
189
|
+
|
|
190
|
+
const payload = await this.request({
|
|
191
|
+
method: "GET",
|
|
192
|
+
path: `/api.php/v1/bugs/${id}`,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
if (payload.error) return normalizeError(payload.error, payload);
|
|
196
|
+
return normalizeResult(payload);
|
|
197
|
+
}
|
|
198
|
+
|
|
187
199
|
async fetchAllBugsForProduct({ product, perPage, maxItems }) {
|
|
188
200
|
const bugs = [];
|
|
189
201
|
let page = 1;
|
|
@@ -227,34 +239,6 @@ class ZentaoClient {
|
|
|
227
239
|
return { bugs, total };
|
|
228
240
|
}
|
|
229
241
|
|
|
230
|
-
async bugStats({ includeZero, limit }) {
|
|
231
|
-
const productsResponse = await this.listProducts({ page: 1, limit: toInt(limit, 1000) });
|
|
232
|
-
if (productsResponse.status !== 1) return productsResponse;
|
|
233
|
-
|
|
234
|
-
const products = productsResponse.result.products || [];
|
|
235
|
-
const rows = [];
|
|
236
|
-
let total = 0;
|
|
237
|
-
|
|
238
|
-
products.forEach((product) => {
|
|
239
|
-
const totalBugs = toInt(product.totalBugs, 0);
|
|
240
|
-
if (!includeZero && totalBugs === 0) return;
|
|
241
|
-
total += totalBugs;
|
|
242
|
-
rows.push({
|
|
243
|
-
id: product.id,
|
|
244
|
-
name: product.name,
|
|
245
|
-
totalBugs,
|
|
246
|
-
unresolvedBugs: toInt(product.unresolvedBugs, 0),
|
|
247
|
-
closedBugs: toInt(product.closedBugs, 0),
|
|
248
|
-
fixedBugs: toInt(product.fixedBugs, 0),
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return normalizeResult({
|
|
253
|
-
total,
|
|
254
|
-
products: rows,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
|
|
258
242
|
async bugsMine({
|
|
259
243
|
account,
|
|
260
244
|
scope,
|
|
@@ -371,7 +355,7 @@ function getClient() {
|
|
|
371
355
|
const server = new Server(
|
|
372
356
|
{
|
|
373
357
|
name: "zentao-mcp",
|
|
374
|
-
version: "0.
|
|
358
|
+
version: "0.4.1",
|
|
375
359
|
},
|
|
376
360
|
{
|
|
377
361
|
capabilities: {
|
|
@@ -408,14 +392,14 @@ const tools = [
|
|
|
408
392
|
},
|
|
409
393
|
},
|
|
410
394
|
{
|
|
411
|
-
name: "
|
|
412
|
-
description: "Get bug
|
|
395
|
+
name: "zentao_bug_get",
|
|
396
|
+
description: "Get bug details (获取Bug详情) by bug ID.",
|
|
413
397
|
inputSchema: {
|
|
414
398
|
type: "object",
|
|
415
399
|
properties: {
|
|
416
|
-
|
|
417
|
-
limit: { type: "integer", description: "Max products to fetch (default 1000)." },
|
|
400
|
+
id: { type: "integer", description: "Bug ID (required)." },
|
|
418
401
|
},
|
|
402
|
+
required: ["id"],
|
|
419
403
|
additionalProperties: false,
|
|
420
404
|
},
|
|
421
405
|
},
|
|
@@ -463,8 +447,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
463
447
|
case "zentao_bugs_list":
|
|
464
448
|
result = await api.listBugs(args);
|
|
465
449
|
break;
|
|
466
|
-
case "
|
|
467
|
-
result = await api.
|
|
450
|
+
case "zentao_bug_get":
|
|
451
|
+
result = await api.getBug(args);
|
|
468
452
|
break;
|
|
469
453
|
case "zentao_bugs_mine":
|
|
470
454
|
result = await api.bugsMine(args);
|