zentao-mcp-server
This MCP server lets you work with ZenTao bugs end-to-end and call broader ZenTao REST v2/OpenAPI operations within account permissions.
Authenticate and refresh cached ZenTao API tokens.
List projects and query assigned bugs by status, keyword, product, project, or project set; inspect bug details and action history.
Resolve single or batch bugs with required structured root-cause/fix/impact notes, assign recipients, close bugs, and verify pass/fail.
Add or edit ordinary/HTML comments and structured Bug remarks.
Upload bug attachments and download attachments to local disk.
Discover and call 368 ZenTao 22.7 OpenAPI operations covering products, projects, executions, stories, tasks, tests, builds, releases, users, my work, create/update actions, and more where version and permissions allow.
Run in read-only mode to hide/reject write tools and non-GET API calls.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@zentao-mcp-server list my active bugs and show the details of the most recent one"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@znmin/zentao-mcp-server
你自己维护的禅道 MCP Server,支持 npx 启动、账号密码自动换取 Token,以及完整 Bug 工作流。
基于 @aipper/zentao-mcp-server@0.1.26 的 MIT 代码维护,保留原有 14 个工具和环境变量。
1.2.0 默认提供 49 个工具,并可发现和调用禅道 22.7 官方 OpenAPI 清单中的 368 项接口。
实际可用性取决于部署版本、开源/商业版功能和账号权限,不代表这 368 项接口都已在你的实例逐项实测。
快速接入
需要 Node.js 20 或以上。MCP 客户端配置:
{
"mcpServers": {
"zentao": {
"command": "npx",
"args": ["-y", "@znmin/zentao-mcp-server@1.2.0"],
"env": {
"ZENTAO_BASE_URL": "https://zentao.example.com",
"ZENTAO_ACCOUNT": "your-account",
"ZENTAO_PASSWORD": "your-password"
}
}
}
}如果使用内网 HTTP,另外设置 ZENTAO_ALLOW_INSECURE_HTTP=true。
Windows 客户端无法直接找到 npx 时,使用 command: "cmd",
args: ["/d", "/c", "npx", "-y", "@znmin/zentao-mcp-server@1.2.0"]。
Related MCP server: ZenTao MCP Server
模块树与完整 API
查询产品 Bug 模块树:
{"productId":1,"type":"bug"}调用工具 get_module_tree。支持 bug、story、testcase、task、doc 五种类型:
Bug / 需求 / 用例使用
productId,省略时使用ZENTAO_PRODUCT_ID;没有预设时 AI 可先用list_products获取产品 ID。任务使用
executionId,可先通过list_executions查询。文档使用
libId和scope:my/team另传spaceId;product传productId;project传projectId。keyword可按模块名称搜索,并保留匹配模块的祖先。
返回 total、returned、嵌套 tree 和扁平 modules;模块包含 id、parent、name、fullName,
便于 AI 直接使用模块 ID。孤立节点或循环父子关系会返回 warnings,不会无限递归。
常用直接工具
类别 | 工具 |
产品 / 项目集 |
|
项目 / 执行 |
|
需求 / 任务 |
|
Bug / 测试 |
|
版本 / 发布 / 人员 |
|
我的工作 |
|
创建 / 编辑 |
|
这些 REST v2 工具统一使用 pathParams、query、body,具体字段都在工具 schema 中。
例如 list_stories({"pathParams":{"productID":1},"query":{"recPerPage":20,"pageID":1}})。
编辑接口按传入 body 发送,不自动填充未提供字段;先读取对象并遵循服务端字段要求。
解决、关闭和验证 Bug 应继续使用原来的专用工作流工具,而不是用 update_bug 代替状态动作。
其余接口由 AI 自动发现
list_api_operations({"keyword":"模块"}):搜索 368 项接口;支持 group、method、offset、limit。get_api_operation({"operationId":"get_products_by_productid_bug_modules"}):读取准确的参数 schema、默认范围与可调用状态。call_api_operation({"operationId":"get_products_by_productid_bug_modules","pathParams":{"productID":1}}):执行固定目录中的接口。
覆盖 40 类接口,包括产品、项目、执行、需求、任务、Bug、测试用例、测试单、版本、发布、 人员、待办、反馈、工单、问题、风险、会议、文档、流程、质量、交付物、基线、项目变更、关联、日历、周报、数据库查询及 AI 知识库等。 清单中包含商业版和附加功能;服务端缺少功能或账号无权限时仍会返回错误,不会伪造成功。
无需给 AI 每次补接口地址或手册参数。它可以通过上面三个工具获取定义,地址与凭证仍只配置一次。
call_api_operation 不接受任意 URL、HTTP 方法或自定义鉴权头;路径和方法只能来自固定清单。
如客户端要求每个接口都出现在工具列表,可设置 ZENTAO_API_TOOL_MODE=all,
总计暴露 416 个工具(含原有工具和常用别名)。默认 compact 保持 49 个工具,完整接口仍可经目录调用。
ZENTAO_READ_ONLY=true 会隐藏所有直接写工具,并在统一调用入口拒绝非 GET 接口,直接调用隐藏工具也会拒绝。
目录中的 POST 型查询同样受此限制,包括数据库 SQL 查询;只读模式不执行这些 POST 请求。
附件和认证
清单中的 post_files 使用 multipart,body.file 为 Runtime 电脑上的绝对文件路径,
支持 objectType 为 bug/story/task/testcase 和对应 objectID;上传前检查对象访问,上传后回读关联。
无法确认关联时返回 ok:false、文件 ID 和 doNotRetryUpload:true。Bug 附件也可继续使用原来的 upload_attachment。
认证接口由 get_token 和配置账号处理,不允许统一调用入口切换账号或回传完整 Token。
22.7 兼容行为与验证范围
无产品/项目/项目集范围时,get_my_bugs 优先读取 REST v2 /my/bugs,可跨产品查询当前账号的 Bug。
不再需要为了查询而默认限定 ZENTAO_PRODUCT_ID=1;显式配置范围时仍保留原有范围语义。
旧服务缺少该 v2 路由(404/405/501)时保留原有 v1 发现逻辑。
返回 total 为服务端分页总数,matched 为当前返回页经过本地条件过滤的数量。
在实测的 22.7 实例中,项目版本列表的 v2 路由返回 403,同账号的 v1 路由可用。
list_builds / 对应目录操作在 403/404/405 时使用这一已核对的 v1 只读回退,并返回
apiVersion:"v1"、fallbackFrom:"v2"、fallbackStatus。其他接口和写操作不使用此回退。
该回退只处理普通分页列表;传入高级筛选、排序或非 all 浏览范围时保留 v2 原始错误,避免静默丢失查询条件。
新增接口没有写请求自动重试。写请求发出后发生异常,会返回 writeSubmitted:true 和 doNotRetryWrite:true;
这表示请求已尝试发送,不能据此确定服务器是否保存成功,应先回读对象。
自动测试使用本地模拟服务;真实 22.7 联调只读取模块树、工作列表、对象详情等,不创建/编辑/删除业务记录。
既有四段解决说明、默认接收人、备注回读和附件验证行为保留。
从上游迁移:只需将启动包名从 @aipper/zentao-mcp-server 改为本包,保留现有 ZENTAO_* 配置。
服务端和 CLI 不需要安装到禅道服务器上;MCP 运行在 Agent Runtime 所在电脑,附件路径也是该电脑上的路径。
本包使用 stdio,不是远程 HTTP MCP 服务。
附件修复与支持范围
Bug 查询和处理使用 REST v1(禅道 16.5+)。附件上传采用禅道 22.0+ REST v2 官方接口:
POST /api.php/v2/files
multipart/form-data:
file = 文件
objectType = bug
objectID = Bug ID这避免了上游 ${baseUrl}index.php 缺少斜杠的问题,也不再依赖网页上传和额外的 /bugs/{id}/files 关联接口。
支持根目录和子目录部署,例如 https://example.com/zentao;保留部署路径前缀。
上传前先读取 Bug 确认访问权限,上传后再回读 Bug 的 files 确认文件 ID 已关联。
结果包含 fileId、uploaded、linked 和 verified;只有回读确认后才返回 verified: true。
如果上传已成功但关联未确认,会返回 MCP isError: true,同时保留文件 ID 和 doNotRetryUpload: true。
请人工检查附件列表,不要盲目重传。超时也不自动重试,避免重复附件。
对于低于 22.0 的禅道版本,本包不自动尝试未经验证的网页上传方式。
如企业版或定制版调整了上传入口,可设置 ZENTAO_UPLOAD_PATH,但该接口必须接受相同的 REST v2 字段并直接关联对象。
工具
工具 | 用途 |
| 获取或刷新认证 Token,返回脱敏摘要 |
| 项目列表 |
| 指派给当前账号的 Bug,支持状态、关键字和范围筛选 |
| Bug 详情、激活摘要、图片及附件 ID/名称/大小 |
| Bug 动作历史和激活说明 |
| 解决一个 Bug |
| 批量解决当前账号的 Bug |
| 关闭 Bug |
| 验证通过关闭,失败激活 |
| 普通文本/HTML 或结构化备注 |
| 新增普通备注,无需四段模板 |
| 编辑本 Bug 的既有备注动作 |
| 上传文件并验证 Bug 附件关联 |
| 通过文件 ID 下载到 Runtime 本地路径 |
upload_attachment 参数:bugId(正整数)、filePath(运行电脑上的绝对路径),可选 fileName。
get_bug_detail / get_bug_actions 参数:id。
download_attachment 参数:fileId、savePath。
解决和备注沿用上游的结构化说明:solutionModules 包含 rootCause(根因)、fixApproach(修复思路)、
logicChange(改动逻辑)、impact(影响范围)。resolve_bug 默认解决版本为 trunk,可通过参数或环境变量覆盖。
解决 Bug 是写操作;请只在用户授权完成对应工作时执行。
环境变量
变量 | 默认值 | 说明 |
| 必填 | 禅道部署地址,包含子目录时保留子目录,不包含 API 路径 |
| 必填 | 账号 |
| 必填 | 密码 |
|
| 显式允许内网 HTTP |
|
| Bug API 路径,相对部署地址 |
|
| 新增接口路径,相对部署地址 |
|
| compact:常用工具+完整目录;all:额外注册每个可调用接口的独立工具 |
|
| REST v2 响应上限,默认 8 MiB,最大 64 MiB |
| 无 | 默认执行范围,供任务模块树及对应路径使用 |
|
| 认证路径,相对部署地址 |
|
| 接受 REST v2 multipart 字段的上传路径 |
|
| 单个附件最大字节数,默认 50 MiB |
|
| 单请求超时,1–300000 毫秒 |
|
| Token 缓存时长,毫秒 |
|
| 隐藏并拒绝原有写工具和所有新增非 GET API;允许读取和本地下载 |
| 无 | 默认产品范围 |
| 无 | 默认项目范围 |
| 无 | 默认项目集范围 |
| 无 | 解决 Bug 的默认接收账号;未配置时转回创建人,工具 assignedTo 参数优先 |
|
| 默认解决版本 |
| 自动 | 自定义“我的 Bug”路径 |
| 自动 | 逗号分隔的候选列表路径 |
| 自动 | 项目集路径模板,支持 |
|
| 向 stderr 输出诊断信息 |
程序读取 MCP 客户端传入的环境变量,不自动加载 .env。密码、Token 不要提交到仓库。
读写能力还取决于禅道账号本身的产品、项目及操作权限;只读开关不会提升账号权限。
开发与发布
npm ci --ignore-scripts
npm run lint
npm test
npm pack --dry-run测试覆盖真实 MCP stdio 工具调用、权限过滤、Token 缓存、根目录/子目录、 multipart 字段和文件名、文件大小、HTTP/JSON 错误、超时、拒绝重定向、上传后关联回读、下载和结构化解决说明。 所有自动测试使用本地模拟服务,不接触真实禅道,也不需要凭证。 GitHub CI 在 Windows / Ubuntu 和 Node.js 20 / 24 上运行。
发布新版本:修改版本和 CHANGELOG,测试通过后执行 npm publish --access public,再推送同版本 Git 标签。
发布包只包含运行代码、文档和许可证;测试文件、配置和登录凭证不会随包分发。
来源与许可证
MIT。上游版权保留于 LICENSE,详见 THIRD_PARTY_NOTICES.md。
官方接口:附件上传说明。
22.7 API 目录来源和许可证见 THIRD_PARTY_NOTICES.md。
更新目录:下载该文件中固定 revision 的 OpenAPI JSON,运行 node scripts/generate-api-catalog.mjs <文件路径>,
再执行测试。不要直接把新版禅道清单当作旧版的兼容保证。
1.1.0 转交人员与备注
resolve_bug 和 batch_resolve_my_bugs 支持 assignedTo(禅道账号,不是中文显示名)。
优先级:工具参数 > ZENTAO_DEFAULT_ASSIGNED_TO > 该 Bug 的创建人 openedBy。
无法确定有效接收人时拒绝提交解决操作;解决后回读指派人,未确认时返回明确警告,不自动重复解决。
批量操作未指定统一账号时,每条 Bug 分别回到自己的创建人。
禅道是否能 @到该人还取决于其手机号、通知绑定和 Webhook 设置,本 MCP 不直接发送企业微信消息。
禅道 22.0 API 通知链接丢域名的问题仍需要在禅道服务端修复,本次不会修改服务端。
普通备注:add_bug_comment({"id":7,"comment":"这里填写普通备注或富文本"})。
原 comment_bug 也支持普通 comment;若提供非空 solutionModules 则优先格式化它。
备注编辑:edit_bug_comment({"id":7,"actionId":101,"comment":"修改后的备注"})。
actionId 来自 get_bug_actions 或新增备注的返回值;只能编辑属于该 Bug 的 commented 动作,不能编辑解决、指派等系统动作。
备注操作使用同一账号的独立页面登录会话:先访问 index.php?m=api&f=getSessionID&t=json,
再 POST 用户登录,随后调用 action.comment / action.editComment。密码仅放在 POST 请求体,
会话仅通过 Cookie 发送,不把凭证放在 URL 中。所有请求限定在配置的部署地址,拒绝重定向。
服务端权限、登录策略或验证码可能使页面接口不可用;此时返回错误,不会改用 Bug 字段编辑来冒充备注。
页面接口有时返回 reload 脚本,本 MCP 不执行该脚本,仅通过 Bug 动作历史确认写入结果。
提交后回读失败时保留不确定状态并提示先检查历史,不自动重试写入,避免重复备注。
解决 Bug 不再自动追加一条重复备注,四段说明保存在解决动作中。
Available Tools
14 toolsadd_bug_commentA
Add an ordinary free-text/HTML Bug remark and verify it in action history. Does not resolve, reassign or edit Bug fields.
Inputs: id (required), comment (required).
batch_resolve_my_bugsA
Batch resolve my bugs via the real resolve API (default status=active, resolution=fixed). REQUIRES shared non-empty solutionModules {rootCause, fixApproach, logicChange, impact} — without it the batch will REJECT with an error. Plain comment/solution is no longer accepted. Requires resolvedBuild or ZENTAO_DEFAULT_RESOLVED_BUILD on instances that validate 解决版本. Prefer projectSetId or /my/bug for project-set scope.
Inputs: page, path, limit, status, +12 more.
close_bugC
Close one bug by ID.
Inputs: id (required), comment.
comment_bugA
Add a Bug comment without changing its fields or state. Accepts free text/HTML in comment or optional structured solutionModules. Uses the authenticated page action API and verifies the saved action.
Inputs: id (required), comment, solutionModules.
download_attachmentA
Download a file/attachment from ZenTao by fileID and save to local disk. Uses API Token auth. Returns saved path and file size.
Inputs: fileId (required), savePath (required).
edit_bug_commentA
Edit an existing comment action belonging to this Bug. Get actionId from get_bug_actions first; cannot edit resolve/close/assign actions. Server permissions still apply.
Inputs: id (required), comment (required), actionId (required).
get_bug_actionsA
Get bug action history by ID (activations/resolutions/comments with field-level changes). Same endpoint as get_bug_detail (/bugs/{id}) but returns the actions array instead of bug fields. Use when a bug was reactivated and you need the activation comment, or any action history. Returns {id, found, actions:[{id,actor,action,date,comment,history:[{field,old,new}]}], activation:{count,lastActor,lastDate,lastComment}|null, count}.
Inputs: id (required).
get_bug_detailA
Get bug detail by ID.
Inputs: id (required).
get_my_bugsA
List bugs assigned to me (supports status/keyword/limit/page filter). For project-set scope, prefer projectSetId or /my/bug instead of relying on list_my_projects.
Inputs: page, path, limit, status, +4 more.
get_tokenB
Get or refresh ZenTao API token (cached).
Inputs: force.
list_my_projectsC
List projects I participate in (heuristic filtering). Not reliable for project-set-only bugs when the project set has no concrete projects.
Inputs: keyword.
resolve_bugA
Resolve one bug by ID via POST /bugs/{id}/resolve. REQUIREs non-empty solutionModules {rootCause, fixApproach, logicChange, impact} — without it the resolve call will REJECT with an error. Plain comment/solution is no longer accepted. Many instances require resolvedBuild (解决版本); pass it or set ZENTAO_DEFAULT_RESOLVED_BUILD (e.g. trunk). Do NOT use raw HTTP PUT/edit as a resolve substitute — it only flips status without writing solution text.
Inputs: id (required), comment, solution, assignedTo, +3 more.
upload_attachmentA
Upload a file (screenshot, log) and attach to a bug as visual evidence. Use after bug fix to provide screenshot proof.
Inputs: bugId (required), filePath (required), fileName.
verify_bugA
Verify bug result: pass -> close, fail -> activate.
Inputs: id (required), result, comment.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
add_bug_comment and comment_bug are functionally near-identical (both add a plain comment without changing state), forcing the agent to guess; verify_bug also overlaps with close_bug since verify-pass closes the bug. get_bug_detail and get_bug_actions hit the same endpoint and require reading long descriptions to tell apart.
Almost all tools follow verb_noun snake_case (get_bug_detail, resolve_bug, upload_attachment, batch_resolve_my_bugs). The lone deviation is comment_bug, which lacks a noun and breaks the pattern, contributing to its confusion with add_bug_comment.
14 tools is a reasonable size for a bug-workflow server. However, a slot is wasted on a redundant comment tool, and the batch_resolve variant could arguably be a parameter rather than a separate tool.
The surface covers read, comment, resolve, verify, close and attachments, but there is no create_bug at all and no way to edit bug fields or reassign ownership, so an agent cannot originate or triage work. Scope is also limited to 'my' bugs/projects with no general search.
Maintenance
Related MCP Connectors
Task and bug tracker for AI coding agents: 75 tools to file, triage and update work.
Task management for people and AI agents, with scoped OAuth access to issues, projects, and docs.
Task management for people and AI agents, with scoped OAuth access to issues, projects, and docs.
Let AI agents list, read and resolve Bugsly error-tracking issues and check monitors.
Related MCP Servers
- FlicenseBqualityNot gradedmaintenanceEnables interaction with ZenTao project management system through RESTful API v1. Supports bug tracking, project/product management, and automated token authentication for seamless integration.102-
- FlicenseAqualityBmaintenanceEnables interaction with ZenTao project management system through RESTful APIs. Supports listing products, managing bugs, viewing statistics, and filtering personal bug assignments through natural language.449 npm16-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Zentao bugs, requirements, and test cases through natural language interactions. It supports querying, creating, and updating various Zentao data entities including products, projects, and executions.12MIT
- AlicenseBqualityDmaintenanceEnables interaction with ZenTao project management software through its REST API. Supports bug tracking, product management, and issue resolution with secure authentication for streamlined development workflows.724 npm1ISC