@leeguoo/zentao-mcp 0.3.1 → 0.3.3
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 -1
- package/package.json +2 -1
- package/src/index.js +24 -7
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ The MCP server provides four tools that can be triggered by natural language in
|
|
|
97
97
|
- **`zentao_products_list`** - List all products
|
|
98
98
|
- **`zentao_bugs_list`** - List bugs for a specific product
|
|
99
99
|
- **`zentao_bugs_stats`** - Get bug statistics across products
|
|
100
|
-
- **`zentao_bugs_mine`** - List my bugs by assignment or creator
|
|
100
|
+
- **`zentao_bugs_mine`** - List my bugs by assignment or creator (status filter supported)
|
|
101
101
|
|
|
102
102
|
### Usage Examples
|
|
103
103
|
|
|
@@ -157,6 +157,7 @@ The AI will automatically:
|
|
|
157
157
|
**zentao_bugs_mine:**
|
|
158
158
|
```json
|
|
159
159
|
{
|
|
160
|
+
"status": "active",
|
|
160
161
|
"scope": "assigned",
|
|
161
162
|
"includeZero": false,
|
|
162
163
|
"includeDetails": true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leeguoo/zentao-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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
|
}
|
|
@@ -259,6 +258,7 @@ class ZentaoClient {
|
|
|
259
258
|
async bugsMine({
|
|
260
259
|
account,
|
|
261
260
|
scope,
|
|
261
|
+
status,
|
|
262
262
|
productIds,
|
|
263
263
|
includeZero,
|
|
264
264
|
perPage,
|
|
@@ -267,6 +267,14 @@ class ZentaoClient {
|
|
|
267
267
|
}) {
|
|
268
268
|
const matchAccount = normalizeAccountValue(account || this.account);
|
|
269
269
|
const targetScope = (scope || "assigned").toLowerCase();
|
|
270
|
+
const rawStatus = status ?? "active";
|
|
271
|
+
const statusList = Array.isArray(rawStatus)
|
|
272
|
+
? rawStatus
|
|
273
|
+
: String(rawStatus).split(/[|,]/);
|
|
274
|
+
const statusSet = new Set(
|
|
275
|
+
statusList.map((item) => String(item).trim().toLowerCase()).filter(Boolean)
|
|
276
|
+
);
|
|
277
|
+
const allowAllStatus = statusSet.has("all") || statusSet.size === 0;
|
|
270
278
|
|
|
271
279
|
const productsResponse = await this.listProducts({ page: 1, limit: 1000 });
|
|
272
280
|
if (productsResponse.status !== 1) return productsResponse;
|
|
@@ -289,6 +297,10 @@ class ZentaoClient {
|
|
|
289
297
|
});
|
|
290
298
|
|
|
291
299
|
const matches = productBugs.filter((bug) => {
|
|
300
|
+
if (!allowAllStatus) {
|
|
301
|
+
const bugStatus = String(bug.status || "").trim().toLowerCase();
|
|
302
|
+
if (!statusSet.has(bugStatus)) return false;
|
|
303
|
+
}
|
|
292
304
|
const assigned = matchesAccount(bug.assignedTo, matchAccount);
|
|
293
305
|
const opened = matchesAccount(bug.openedBy, matchAccount);
|
|
294
306
|
const resolved = matchesAccount(bug.resolvedBy, matchAccount);
|
|
@@ -330,6 +342,7 @@ class ZentaoClient {
|
|
|
330
342
|
return normalizeResult({
|
|
331
343
|
account: matchAccount,
|
|
332
344
|
scope: targetScope,
|
|
345
|
+
status: allowAllStatus ? "all" : Array.from(statusSet),
|
|
333
346
|
total: totalMatches,
|
|
334
347
|
products: rows,
|
|
335
348
|
bugs: includeDetails ? bugs : [],
|
|
@@ -358,7 +371,7 @@ function getClient() {
|
|
|
358
371
|
const server = new Server(
|
|
359
372
|
{
|
|
360
373
|
name: "zentao-mcp",
|
|
361
|
-
version: "0.3.
|
|
374
|
+
version: "0.3.3",
|
|
362
375
|
},
|
|
363
376
|
{
|
|
364
377
|
capabilities: {
|
|
@@ -417,6 +430,10 @@ const tools = [
|
|
|
417
430
|
type: "string",
|
|
418
431
|
description: "Filter scope: assigned|opened|resolved|all (default assigned).",
|
|
419
432
|
},
|
|
433
|
+
status: {
|
|
434
|
+
type: ["string", "array"],
|
|
435
|
+
description: "Status filter: active|resolved|closed|all (default active).",
|
|
436
|
+
},
|
|
420
437
|
productIds: {
|
|
421
438
|
type: "array",
|
|
422
439
|
items: { type: "integer" },
|