@zzp123/mcp-zentao 1.8.7 → 1.8.8

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/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.8.8] - 2025-11-06
9
+
10
+ ### Fixed
11
+ - **修复 getMyBugs 工具返回Bug数量为0的问题**
12
+ - 移除了硬编码的 `assignedTo` 过滤条件
13
+ - 默认获取所有Bug,不再只获取分配给当前用户的Bug
14
+ - 添加 `onlyAssignedToMe` 参数,让用户可以选择是否只获取分配给自己的Bug
15
+
16
+ ### Changed
17
+ - **优化默认产品选择逻辑**
18
+ - 当未指定 productId 时,默认使用第二个产品(如果存在)
19
+ - 如果只有一个产品,则使用第一个产品
20
+
21
+ ### Improved
22
+ - 为 getMyBugs 工具添加更清晰的描述:"获取Bug列表 - 默认获取所有Bug,可选择只获取分配给我的Bug"
23
+ - 增强了工具的灵活性,满足不同使用场景
24
+
8
25
  ## [1.8.7] - 2025-11-06
9
26
 
10
27
  ### Fixed
@@ -9,7 +9,7 @@ export declare class ZentaoAPI {
9
9
  getMyTasks(status?: TaskStatus): Promise<Task[]>;
10
10
  getTaskDetail(taskId: number): Promise<Task>;
11
11
  getProducts(): Promise<Product[]>;
12
- getMyBugs(status?: BugStatus, productId?: number, page?: number, limit?: number): Promise<{
12
+ getMyBugs(status?: BugStatus, productId?: number, page?: number, limit?: number, onlyAssignedToMe?: boolean): Promise<{
13
13
  page: number;
14
14
  total: number;
15
15
  limit: number;
@@ -111,26 +111,30 @@ export class ZentaoAPI {
111
111
  throw error;
112
112
  }
113
113
  }
114
- async getMyBugs(status, productId, page, limit) {
114
+ async getMyBugs(status, productId, page, limit, onlyAssignedToMe = false) {
115
115
  if (!productId) {
116
- // 如果没有提供产品ID,获取第一个可用的产品
116
+ // 如果没有提供产品ID,获取第二个可用的产品(索引为1)
117
117
  const products = await this.getProducts();
118
118
  if (products.length === 0) {
119
119
  throw new Error('没有可用的产品');
120
120
  }
121
- productId = products[0].id;
122
- console.log(`使用第一个可用的产品ID: ${productId}`);
121
+ // 使用第二个产品(如果存在),否则使用第一个
122
+ productId = products.length > 1 ? products[1].id : products[0].id;
123
+ console.log(`使用产品ID: ${productId} (${products.length > 1 ? '第二个' : '第一个'})`);
123
124
  }
124
125
  // 默认每页20条,最多100条
125
126
  const finalLimit = limit ? Math.min(limit, 100) : 20;
126
127
  const finalPage = page || 1;
127
128
  const params = {
128
- assignedTo: this.config.username,
129
129
  status: status || 'all',
130
130
  product: productId,
131
131
  page: finalPage,
132
132
  limit: finalLimit
133
133
  };
134
+ // 只有当明确指定时才过滤 assignedTo
135
+ if (onlyAssignedToMe) {
136
+ params.assignedTo = this.config.username;
137
+ }
134
138
  try {
135
139
  console.log(`正在获取Bug列表 (page=${finalPage}, limit=${finalLimit}),参数:`, params);
136
140
  const response = await this.request('GET', '/bugs', params);
package/dist/index.js CHANGED
@@ -87,15 +87,16 @@ server.tool("getProducts", {}, async () => {
87
87
  };
88
88
  });
89
89
  // Add getMyBugs tool
90
- server.tool("getMyBugs", {
90
+ server.tool("getMyBugs", "获取Bug列表 - 默认获取所有Bug,可选择只获取分配给我的Bug", {
91
91
  status: z.enum(['active', 'resolved', 'closed', 'all']).optional(),
92
92
  productId: z.number().optional(),
93
93
  page: z.number().optional().describe("页码,从1开始,默认为1"),
94
- limit: z.number().optional().describe("每页数量,默认20,最大100")
95
- }, async ({ status, productId, page, limit }) => {
94
+ limit: z.number().optional().describe("每页数量,默认20,最大100"),
95
+ onlyAssignedToMe: z.boolean().optional().describe("是否只获取分配给我的Bug,默认false(获取所有Bug)")
96
+ }, async ({ status, productId, page, limit, onlyAssignedToMe }) => {
96
97
  if (!zentaoApi)
97
98
  throw new Error("Please initialize Zentao API first");
98
- const result = await zentaoApi.getMyBugs(status, productId, page, limit);
99
+ const result = await zentaoApi.getMyBugs(status, productId, page, limit, onlyAssignedToMe || false);
99
100
  // 返回分页信息和数据
100
101
  const summary = {
101
102
  summary: `当前第 ${result.page} 页,共 ${result.total} 个Bug,本页显示 ${result.bugs.length} 个`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.8.7",
3
+ "version": "1.8.8",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",