@zzp123/mcp-zentao 1.6.1 → 1.7.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/CHANGELOG.md CHANGED
@@ -5,6 +5,29 @@ 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.7.0] - 2025-11-06
9
+
10
+ ### Added
11
+ - **图片上传自动生成 HTML 格式**
12
+ - `uploadFile` 工具现在返回 `imageHtml` 字段,包含禅道所需的完整 HTML 代码
13
+ - `uploadImageFromClipboard` 工具同样返回 `imageHtml` 字段
14
+ - 新增 `imageUrl` 字段,提供完整的图片访问地址
15
+ - 新增 `fileId` 字段,方便后续引用
16
+ - 新增使用提示 `tip` 字段,帮助用户正确使用
17
+
18
+ ### Changed
19
+ - ZentaoAPI 类新增 `getConfig()` 方法,允许获取配置信息以生成图片 URL
20
+ - 图片上传返回格式优化,Claude Code 现在能自动识别并使用正确的 HTML 格式
21
+
22
+ ### Technical
23
+ - 图片 HTML 格式:`<img onload="setImageSize(this,0)" src="..." alt="..." />`
24
+ - 自动包含 `onload="setImageSize(this,0)"` 以确保图片在禅道中正确显示
25
+
26
+ ### Benefits
27
+ - **提升用户体验**:Claude Code 无需手动构造 HTML 代码
28
+ - **减少错误**:避免手动拼接 HTML 时的格式错误
29
+ - **更直观**:返回结果中直接包含可用的 HTML 代码
30
+
8
31
  ## [1.6.1] - 2025-11-05
9
32
 
10
33
  ### Fixed
@@ -158,4 +158,5 @@ export declare class ZentaoAPI {
158
158
  getModules(type: ModuleType, id: number, fields?: string): Promise<ModulesResponse>;
159
159
  uploadFile(uploadRequest: UploadFileRequest): Promise<FileUploadResponse>;
160
160
  downloadFile(fileId: number): Promise<Buffer>;
161
+ getConfig(): ZentaoConfig;
161
162
  }
@@ -1189,4 +1189,8 @@ export class ZentaoAPI {
1189
1189
  throw error;
1190
1190
  }
1191
1191
  }
1192
+ // 获取配置信息(用于生成图片 URL)
1193
+ getConfig() {
1194
+ return this.config;
1195
+ }
1192
1196
  }
package/dist/index.js CHANGED
@@ -988,8 +988,17 @@ server.tool("uploadFile", {
988
988
  filename: finalFilename,
989
989
  uid
990
990
  });
991
+ // 生成禅道需要的 HTML 格式
992
+ const fileId = result.id;
993
+ const baseUrl = zentaoApi.getConfig().url;
994
+ const imageUrl = `${baseUrl}/zentao/entao/api.php?m=file&f=read&t=png&fileID=${fileId}`;
995
+ const imageHtml = `<img onload="setImageSize(this,0)" src="${imageUrl}" alt="${finalFilename}" />`;
991
996
  const response = {
992
997
  upload: result,
998
+ fileId: fileId,
999
+ imageUrl: imageUrl,
1000
+ imageHtml: imageHtml,
1001
+ tip: `更新 Bug 描述时,请使用 imageHtml 字段中的 HTML 代码`
993
1002
  };
994
1003
  if (savedPath) {
995
1004
  response.savedPath = savedPath;
@@ -1129,13 +1138,22 @@ server.tool("uploadImageFromClipboard", {
1129
1138
  uid
1130
1139
  });
1131
1140
  console.log('[uploadImageFromClipboard] 上传成功,结果:', uploadResult);
1141
+ // 生成禅道需要的 HTML 格式
1142
+ const fileId = uploadResult.id;
1143
+ const baseUrl = zentaoApi.getConfig().url;
1144
+ const imageUrl = `${baseUrl}/zentao/entao/api.php?m=file&f=read&t=png&fileID=${fileId}`;
1145
+ const imageHtml = `<img onload="setImageSize(this,0)" src="${imageUrl}" alt="${finalFilename}" />`;
1132
1146
  const response = {
1133
1147
  success: true,
1134
1148
  upload: uploadResult,
1135
1149
  savedPath: savedPath,
1136
1150
  filename: finalFilename,
1137
1151
  fileSize: fileBuffer.length,
1138
- message: `图片已保存到本地并上传到禅道`
1152
+ fileId: fileId,
1153
+ imageUrl: imageUrl,
1154
+ imageHtml: imageHtml,
1155
+ message: `图片已保存到本地并上传到禅道`,
1156
+ tip: `更新 Bug 描述时,请使用 imageHtml 字段中的 HTML 代码`
1139
1157
  };
1140
1158
  console.log('[uploadImageFromClipboard] 返回结果:', response);
1141
1159
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzp123/mcp-zentao",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "禅道项目管理系统的高级API集成包,提供任务管理、Bug跟踪等功能的完整封装,专为Cursor IDE设计的MCP扩展",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",