@maxenlin/mcp-zentao-11-3 1.0.0-patch.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 maxenlin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # @maxenlin/mcp-zentao-11-3
2
+
3
+ 禅道 11.3 Legacy 版 MCP 服务器,专为 Cursor IDE 设计,只支持旧版 Session API。
4
+
5
+ ## ✨ 特性
6
+
7
+ - ✅ **纯 Legacy API** - 只支持禅道 11.x 版本的 Session API
8
+ - ✅ **功能完整** - 支持任务、Bug、需求、测试用例等完整功能
9
+ - ✅ **AI 编程优化** - 提供完整开发上下文、格式化输出、智能摘要等功能
10
+ - ✅ **开箱即用** - 配置简单,专注核心功能
11
+
12
+ ## 📋 系统要求
13
+
14
+ - **Node.js**: >= 18.0.0(推荐使用 LTS 版本)
15
+
16
+ ## 📦 安装
17
+
18
+ ### 方法 1:使用 npx(推荐)
19
+
20
+ 在 Cursor IDE 配置文件中添加:
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "zentao-11-3": {
26
+ "command": "npx",
27
+ "args": ["-y", "@maxenlin/mcp-zentao-11-3"],
28
+ "env": {
29
+ "ZENTAO_URL": "http://your-zentao-url/zentao",
30
+ "ZENTAO_USERNAME": "your-username",
31
+ "ZENTAO_PASSWORD": "your-password"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### 方法 2:本地安装
39
+
40
+ ```bash
41
+ npm install -g @maxenlin/mcp-zentao-11-3
42
+ ```
43
+
44
+ 然后在 Cursor IDE 配置文件中添加:
45
+
46
+ ```json
47
+ {
48
+ "mcpServers": {
49
+ "zentao-11-3": {
50
+ "command": "mcp-zentao-11-3",
51
+ "args": [],
52
+ "env": {
53
+ "ZENTAO_URL": "http://your-zentao-url/zentao",
54
+ "ZENTAO_USERNAME": "your-username",
55
+ "ZENTAO_PASSWORD": "your-password"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ## ⚙️ 配置
63
+
64
+ ### 方法 1:在 Cursor 配置中直接设置(推荐)
65
+
66
+ 在 Cursor IDE 的 MCP 配置文件中,直接在 `env` 字段中填入配置:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "zentao-11-3": {
72
+ "command": "mcp-zentao-11-3",
73
+ "args": [],
74
+ "env": {
75
+ "ZENTAO_URL": "http://your-zentao-url/zentao",
76
+ "ZENTAO_USERNAME": "your-username",
77
+ "ZENTAO_PASSWORD": "your-password"
78
+ }
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ **配置说明:**
85
+ - `ZENTAO_URL`: 禅道服务器地址(必须包含 `/zentao` 路径)
86
+ - `ZENTAO_USERNAME`: 禅道用户名
87
+ - `ZENTAO_PASSWORD`: 禅道密码
88
+
89
+ ### 方法 2:使用配置文件(备选)
90
+
91
+ 如果不想在 Cursor 配置中直接填写密码,可以创建配置文件:
92
+
93
+ **Windows:**
94
+ ```
95
+ C:\Users\你的用户名\.zentao\config.json
96
+ ```
97
+
98
+ **macOS/Linux:**
99
+ ```
100
+ ~/.zentao/config.json
101
+ ```
102
+
103
+ 配置文件内容:
104
+
105
+ ```json
106
+ {
107
+ "url": "http://your-zentao-url/zentao",
108
+ "username": "your-username",
109
+ "password": "your-password",
110
+ "apiVersion": "legacy"
111
+ }
112
+ ```
113
+
114
+ **注意:** 环境变量配置优先于配置文件。如果同时设置了环境变量和配置文件,将使用环境变量中的配置。
115
+
116
+ ## 🚀 使用
117
+
118
+ 配置完成后,重启 Cursor IDE 即可使用。
119
+
120
+ ### 基础功能
121
+
122
+ ```
123
+ 获取我的任务
124
+ 获取我的Bug
125
+ 获取所有产品列表
126
+ 获取产品230的需求列表
127
+ 查看需求2508的详情
128
+ ```
129
+
130
+ ### 关联关系查询
131
+
132
+ ```
133
+ 获取需求2508关联的所有Bug
134
+ 查看Bug 20692关联的需求
135
+ ```
136
+
137
+ ### 批量操作
138
+
139
+ ```
140
+ 批量更新任务状态为进行中
141
+ 批量解决Bug,标记为已修复
142
+ ```
143
+
144
+ ### 数据统计
145
+
146
+ ```
147
+ 查看我的任务统计
148
+ 查看我的Bug统计
149
+ ```
150
+
151
+ ### AI 编程辅助
152
+
153
+ ```
154
+ 获取需求2508的完整开发上下文(包含关联的Bug和测试用例)
155
+ 生成需求2508的Markdown摘要
156
+ 生成Bug 20692的Markdown摘要
157
+ 格式化任务123为Markdown
158
+ ```
159
+
160
+ ### 智能分析
161
+
162
+ ```
163
+ 分析需求2508的复杂度
164
+ 分析Bug 20692的优先级
165
+ 分析任务123的工作量
166
+ ```
167
+
168
+ ### 代码生成提示
169
+
170
+ ```
171
+ 根据需求2508生成代码框架提示
172
+ 根据Bug 20692生成测试用例提示
173
+ 生成需求2508的代码审查检查清单
174
+ ```
175
+
176
+ ## 📋 可用工具
177
+
178
+ ### 配置管理
179
+ - `initZentao` - 初始化禅道连接
180
+ - `getConfig` - 查看配置信息
181
+
182
+ ### 任务管理
183
+ - `getMyTasks` - 获取我的任务列表
184
+ - `getTaskDetail` - 获取任务详情
185
+ - `updateTask` - 更新任务
186
+ - `finishTask` - 完成任务
187
+
188
+ ### Bug 管理
189
+ - `getMyBugs` - 获取我的Bug列表
190
+ - `getBugDetail` - 获取Bug详情
191
+ - `resolveBug` - 解决Bug
192
+
193
+ ### 产品管理
194
+ - `getProducts` - 获取产品列表
195
+
196
+ ### 需求管理
197
+ - `getProductStories` - 获取产品的需求列表
198
+ - `getStoryDetail` - 获取需求详情
199
+ - `searchStories` - 搜索需求
200
+ - `searchStoriesByProductName` - 按产品名称搜索需求
201
+
202
+ ### 测试用例管理
203
+ - `getProductTestCases` - 获取产品的测试用例
204
+ - `getTestCaseDetail` - 获取测试用例详情
205
+ - `createTestCase` - 创建测试用例
206
+ - `getStoryTestCases` - 获取需求的测试用例
207
+
208
+ ### 测试单管理
209
+ - `getTestTasks` - 获取测试单列表
210
+ - `getTestTaskDetail` - 获取测试单详情
211
+ - `getTestTaskResults` - 获取测试单的测试结果
212
+ - `runTestCase` - 执行测试用例
213
+
214
+ ### 关联关系查询
215
+ - `getStoryRelatedBugs` - 获取需求关联的 Bug 列表
216
+ - `getBugRelatedStory` - 获取 Bug 关联的需求
217
+
218
+ ### 批量操作
219
+ - `batchUpdateTasks` - 批量更新任务
220
+ - `batchResolveBugs` - 批量解决 Bug
221
+
222
+ ### 数据统计
223
+ - `getMyTaskStatistics` - 获取我的任务统计信息
224
+ - `getMyBugStatistics` - 获取我的 Bug 统计信息
225
+
226
+ ### AI 编程辅助功能
227
+ - `getDevelopmentContext` - 获取需求/Bug 的完整开发上下文(包含关联信息)
228
+ - `generateStorySummary` - 生成需求摘要(支持 JSON/Markdown/文本格式)
229
+ - `generateBugSummary` - 生成 Bug 摘要(支持 JSON/Markdown/文本格式)
230
+ - `formatTaskAsMarkdown` - 将任务格式化为 Markdown
231
+
232
+ ### 智能分析功能
233
+ - `analyzeStoryComplexity` - 分析需求复杂度(评分、工时估算、优先级建议)
234
+ - `analyzeBugPriority` - 分析 Bug 优先级(评分、优先级建议)
235
+ - `analyzeTaskWorkload` - 分析任务工作量(工时估算、难度评估)
236
+
237
+ ### 代码生成提示
238
+ - `generateCodePromptFromStory` - 根据需求生成代码框架提示
239
+ - `generateTestPromptFromBug` - 根据 Bug 生成测试用例提示
240
+ - `generateCodeReviewChecklist` - 生成代码审查检查清单
241
+
242
+ ### 根据需求/Bug创建任务
243
+ - `createTaskFromStory` - 根据需求创建任务(提供手动操作指南)
244
+ - `createTaskFromBug` - 根据Bug创建修复任务(提供手动操作指南)
245
+
246
+ ## 📝 许可证
247
+
248
+ MIT
249
+
250
+ ## 🔗 相关链接
251
+
252
+ - [禅道开源版 GitHub](https://github.com/easysoft/zentaopms) - 禅道官方 GitHub 仓库
253
+ - [禅道官网](https://www.zentao.net/)
254
+
@@ -0,0 +1,9 @@
1
+ export interface ZentaoConfig {
2
+ url: string;
3
+ username: string;
4
+ password: string;
5
+ apiVersion: 'legacy';
6
+ }
7
+ export declare function saveConfig(config: ZentaoConfig): void;
8
+ export declare function loadConfig(): ZentaoConfig | null;
9
+ export declare function isConfigured(): boolean;
package/dist/config.js ADDED
@@ -0,0 +1,54 @@
1
+ import fs from 'fs';
2
+ import os from 'os';
3
+ import path from 'path';
4
+ // 定义配置文件路径
5
+ const CONFIG_DIR = path.join(os.homedir(), '.zentao');
6
+ const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
7
+ // 保存配置
8
+ export function saveConfig(config) {
9
+ // 确保配置目录存在
10
+ if (!fs.existsSync(CONFIG_DIR)) {
11
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
12
+ }
13
+ // 强制设置为 legacy
14
+ const legacyConfig = {
15
+ ...config,
16
+ apiVersion: 'legacy'
17
+ };
18
+ // 写入配置文件
19
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(legacyConfig, null, 2));
20
+ }
21
+ // 读取配置(优先从环境变量读取,其次从配置文件)
22
+ export function loadConfig() {
23
+ // 优先从环境变量读取配置
24
+ const envUrl = process.env.ZENTAO_URL;
25
+ const envUsername = process.env.ZENTAO_USERNAME;
26
+ const envPassword = process.env.ZENTAO_PASSWORD;
27
+ if (envUrl && envUsername && envPassword) {
28
+ return {
29
+ url: envUrl,
30
+ username: envUsername,
31
+ password: envPassword,
32
+ apiVersion: 'legacy'
33
+ };
34
+ }
35
+ // 如果环境变量不存在,从配置文件读取
36
+ try {
37
+ if (fs.existsSync(CONFIG_FILE)) {
38
+ const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf-8'));
39
+ // 强制设置为 legacy
40
+ return {
41
+ ...config,
42
+ apiVersion: 'legacy'
43
+ };
44
+ }
45
+ }
46
+ catch (error) {
47
+ console.error('读取配置文件失败:', error);
48
+ }
49
+ return null;
50
+ }
51
+ // 检查是否已配置
52
+ export function isConfigured() {
53
+ return fs.existsSync(CONFIG_FILE);
54
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 自定义错误类型
3
+ */
4
+ export declare enum ErrorCode {
5
+ AUTH_FAILED = "AUTH_FAILED",
6
+ NETWORK_ERROR = "NETWORK_ERROR",
7
+ NOT_FOUND = "NOT_FOUND",
8
+ INVALID_PARAMS = "INVALID_PARAMS",
9
+ API_ERROR = "API_ERROR",
10
+ CONFIG_ERROR = "CONFIG_ERROR",
11
+ SESSION_EXPIRED = "SESSION_EXPIRED"
12
+ }
13
+ export declare class ZentaoError extends Error {
14
+ code: ErrorCode;
15
+ statusCode?: number | undefined;
16
+ originalError?: any | undefined;
17
+ constructor(code: ErrorCode, message: string, statusCode?: number | undefined, originalError?: any | undefined);
18
+ /**
19
+ * 转换为用户友好的错误消息
20
+ */
21
+ toUserFriendlyMessage(): string;
22
+ /**
23
+ * 转换为 JSON
24
+ */
25
+ toJSON(): {
26
+ code: ErrorCode;
27
+ message: string;
28
+ userFriendlyMessage: string;
29
+ statusCode: number | undefined;
30
+ name: string;
31
+ };
32
+ }
33
+ /**
34
+ * 创建错误对象
35
+ */
36
+ export declare function createError(code: ErrorCode, message: string, statusCode?: number, originalError?: any): ZentaoError;
package/dist/errors.js ADDED
@@ -0,0 +1,56 @@
1
+ /**
2
+ * 自定义错误类型
3
+ */
4
+ export var ErrorCode;
5
+ (function (ErrorCode) {
6
+ ErrorCode["AUTH_FAILED"] = "AUTH_FAILED";
7
+ ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
8
+ ErrorCode["NOT_FOUND"] = "NOT_FOUND";
9
+ ErrorCode["INVALID_PARAMS"] = "INVALID_PARAMS";
10
+ ErrorCode["API_ERROR"] = "API_ERROR";
11
+ ErrorCode["CONFIG_ERROR"] = "CONFIG_ERROR";
12
+ ErrorCode["SESSION_EXPIRED"] = "SESSION_EXPIRED";
13
+ })(ErrorCode || (ErrorCode = {}));
14
+ export class ZentaoError extends Error {
15
+ constructor(code, message, statusCode, originalError) {
16
+ super(message);
17
+ this.code = code;
18
+ this.statusCode = statusCode;
19
+ this.originalError = originalError;
20
+ this.name = 'ZentaoError';
21
+ Object.setPrototypeOf(this, ZentaoError.prototype);
22
+ }
23
+ /**
24
+ * 转换为用户友好的错误消息
25
+ */
26
+ toUserFriendlyMessage() {
27
+ const messages = {
28
+ [ErrorCode.AUTH_FAILED]: '认证失败,请检查用户名和密码',
29
+ [ErrorCode.NETWORK_ERROR]: '网络连接失败,请检查网络或服务器地址',
30
+ [ErrorCode.NOT_FOUND]: '未找到请求的资源',
31
+ [ErrorCode.INVALID_PARAMS]: '参数错误,请检查输入参数',
32
+ [ErrorCode.API_ERROR]: '禅道 API 返回错误',
33
+ [ErrorCode.CONFIG_ERROR]: '配置错误,请检查配置信息',
34
+ [ErrorCode.SESSION_EXPIRED]: 'Session 已过期,请重新初始化连接'
35
+ };
36
+ return messages[this.code] || this.message;
37
+ }
38
+ /**
39
+ * 转换为 JSON
40
+ */
41
+ toJSON() {
42
+ return {
43
+ code: this.code,
44
+ message: this.message,
45
+ userFriendlyMessage: this.toUserFriendlyMessage(),
46
+ statusCode: this.statusCode,
47
+ name: this.name
48
+ };
49
+ }
50
+ }
51
+ /**
52
+ * 创建错误对象
53
+ */
54
+ export function createError(code, message, statusCode, originalError) {
55
+ return new ZentaoError(code, message, statusCode, originalError);
56
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};