@baocang/zentao-cli 0.5.0 → 0.5.1-enh.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/README.en.md ADDED
@@ -0,0 +1,245 @@
1
+ # Zentao CLI
2
+
3
+ ![npm](https://img.shields.io/npm/v/zentao-cli) ![Node.js](https://img.shields.io/node/v/zentao-cli) ![License](https://img.shields.io/npm/l/zentao-cli)
4
+
5
+ [简体中文](README.md) | English
6
+
7
+ A command-line tool for ZenTao that lets you access and manage ZenTao data from your favorite terminal, with support for AI agents.
8
+
9
+ ## Features
10
+
11
+ * Built on ZenTao RESTful API 2.0, covering more than 40 modules and 300 API operations, with version compatibility checks before each request
12
+ * Run without installation using `npx zentao-cli`
13
+ * Log in through your browser, store only tokens instead of passwords, and switch between multiple accounts
14
+ * Select fields, filter and sort data, and explicitly convert HTML to Markdown
15
+ * Built for AI agents, with comprehensive help and Markdown and JSON output
16
+ * Install skills into AI agents with `zentao skill install`
17
+ * Run a local stdio or remote HTTP MCP service, with each client using its own ZenTao token
18
+
19
+ ## Requirements
20
+
21
+ * Node.js 18 or later
22
+ * ZenTao Open Source `22.0`, Biz `biz13.0`, Max `max8.0`, or IPD `ipd5.0` or later
23
+
24
+ Some operations require a newer ZenTao version. The CLI checks compatibility and reports any requirements before sending a request. See [API coverage and version compatibility](docs/cli-usage.md#api-覆盖与版本兼容).
25
+
26
+ ## Quick start
27
+
28
+ The examples below apply to version 0.4.4 and later. For version 0.4.3 or earlier, follow the local `--help` output.
29
+
30
+ ```bash
31
+ # Install globally
32
+ npm install -g zentao-cli
33
+
34
+ # Alternatively, install with Bun or run without installation
35
+ # bun install -g zentao-cli
36
+ # npx zentao-cli
37
+ # pnpm dlx zentao-cli
38
+
39
+ # Log in: a browser opens for you to enter your ZenTao URL, username, and password
40
+ zentao login
41
+
42
+ # List products
43
+ zentao product list
44
+ ```
45
+
46
+ In a terminal without a graphical environment, use `zentao login --no-browser` for interactive login. For environment variables, account switching, and logout, see [Authentication](docs/cli-usage.md#用户验证).
47
+
48
+ ## Common commands
49
+
50
+ Commands follow the format `zentao <module> <action> [target] [options]`. Use `list` for lists and `get` for details; omitting the action displays help.
51
+
52
+ ### Products
53
+
54
+ ```bash
55
+ # List products
56
+ zentao product list
57
+
58
+ # View product details
59
+ zentao product get 1
60
+
61
+ # Create a product
62
+ zentao product create --name="New product"
63
+
64
+ # Update a product's name
65
+ zentao product update 1 --name="Updated product name"
66
+
67
+ # Delete a product
68
+ zentao product delete 1
69
+ ```
70
+
71
+ ### Bugs
72
+
73
+ ```bash
74
+ # List bugs for product #1
75
+ zentao bug list --product=1
76
+
77
+ # View bug details
78
+ zentao bug get 329
79
+
80
+ # Get the ZenTao page URL for this bug
81
+ zentao link create bug view --var bugID=329
82
+
83
+ # Resolve a bug
84
+ zentao bug resolve 329 --resolution=fixed
85
+ ```
86
+
87
+ ### Stories and tasks
88
+
89
+ ```bash
90
+ # List stories for product #1
91
+ zentao story list --product=1
92
+
93
+ # Create a task in execution #10
94
+ zentao task create --name="Implement login" --execution-id=10
95
+ ```
96
+
97
+ ### Filtering and output formats
98
+
99
+ ```bash
100
+ # Show only the selected fields
101
+ zentao product list --fields=id,name
102
+
103
+ # Filter by a condition
104
+ zentao bug list --product=1 --filter 'status=active'
105
+
106
+ # Fuzzy search
107
+ zentao story list --product=1 --search=login --search-fields=title
108
+
109
+ # Sort by a field
110
+ zentao bug list --product=1 --sort=id:desc
111
+
112
+ # Output JSON for use in scripts
113
+ zentao product list --format=json
114
+ ```
115
+
116
+ ### Help
117
+
118
+ ```bash
119
+ # Show all commands
120
+ zentao help
121
+
122
+ # Show a module's available actions and parameters
123
+ zentao bug --help
124
+
125
+ # Show an action's parameters and minimum ZenTao version
126
+ zentao bug resolve --help
127
+ ```
128
+
129
+ ### Get a token
130
+
131
+ Use `zentao token` when you need a token for a script or MCP configuration:
132
+
133
+ ```bash
134
+ # Read the saved token for the current account or a specific account
135
+ zentao token
136
+ zentao token 'admin@https://zentao.example.com'
137
+
138
+ # Obtain a new token without saving it to the CLI configuration
139
+ zentao token --server https://zentao.example.com --user admin --password '<password>'
140
+ ```
141
+
142
+ By default, the command outputs only the token on a single line. Reading a saved token does not validate it over the network, modify the configuration, or switch accounts. See [Get a token](docs/cli-usage.md#获取-token).
143
+
144
+ For more features, including piped input, batch operations, pagination, and configuration management, see the [CLI guide](docs/cli-usage.md).
145
+
146
+ The CLI sends a versioned operation marker by default; MCP markers distinguish stdio from HTTP. Use `--assistant 'AI <codex>'` to replace the marker for one invocation, `--assistant ''` to disable it once, or `zentao config set autoAssistant false` to disable automatic markers for the current profile. MCP tools accept a top-level `assistant` string for per-call overrides. See [Operation markers](docs/cli-usage.md#操作来源标记).
147
+
148
+ ## Use with AI agents
149
+
150
+ There are three ways to use ZenTao with AI agents:
151
+
152
+ | Method | Use case | CLI installation required |
153
+ | --- | --- | --- |
154
+ | Skill | Personal use; the agent runs CLI commands in a terminal | Yes |
155
+ | Local MCP | Personal use; the agent accesses the CLI through MCP tools | Yes |
156
+ | Remote MCP | A shared company deployment; users connect with their own tokens | No |
157
+
158
+ For full instructions, see [Use ZenTao with agents](docs/use-zentao-in-agents.md).
159
+
160
+ ### Use skills
161
+
162
+ ```bash
163
+ # Install, log in, and install skills (choose the target agent interactively)
164
+ npm install -g zentao-cli && zentao login && zentao skill install
165
+
166
+ # Specify the target agent directly; all installs into every supported agent
167
+ zentao skill install claude-code
168
+ zentao skill install all
169
+
170
+ # Export all built-in skills to a directory
171
+ zentao skill export ./skills
172
+ ```
173
+
174
+ Supported agents include Claude Code, Cursor, Cherry Studio, Codex, OpenCode, VS Code, Antigravity, and Gemini. After installation, ask your agent questions in natural language:
175
+
176
+ ```txt
177
+ What products are available in ZenTao?
178
+
179
+ Which stories are under development for product xxx?
180
+
181
+ What risks are associated with story xxx?
182
+ ```
183
+
184
+ When an agent starts the login flow, it should use `zentao login --web` and keep the process running until the user finishes authentication in the browser. In CI or containers, you can inject credentials through environment variables or mount a configuration file. The agent can first run `zentao auth status --format=json` to confirm which account is in use; the output contains no token or password. See [Credentials for agents, CI, and containers](docs/use-zentao-in-agents.md#agentci-与容器中的凭据).
185
+
186
+ ### Use local MCP
187
+
188
+ ```bash
189
+ # Install, log in, and configure local stdio MCP (choose the target agent interactively)
190
+ npm install -g zentao-cli && zentao login && zentao add-mcp
191
+ ```
192
+
193
+ `zentao add-mcp` reuses the current account's token and does not write your ZenTao password to the agent configuration. Add startup options to `args` in the MCP configuration to limit access:
194
+
195
+ ```bash
196
+ # Allow only read operations and restrict the available modules
197
+ zentao mcp --read-only --modules product,story,task,bug
198
+
199
+ # Split each module into separate read and write tools for separate client permissions
200
+ zentao mcp --split-tools --modules product,story,task,bug
201
+ ```
202
+
203
+ For the generated configuration format and all startup options, see [MCP service](docs/cli-usage.md#mcp-服务).
204
+
205
+ ### Use remote MCP
206
+
207
+ `zentao mcp-server` is designed for a shared deployment managed by a company administrator. Users need only the service URL and their own ZenTao tokens, without installing zentao-cli. ZenTao handles requests according to each account's permissions.
208
+
209
+ ```bash
210
+ # On the server, start the service with a fixed ZenTao site URL
211
+ zentao mcp-server https://zentao.example.com
212
+ ```
213
+
214
+ After startup, open `http://127.0.0.1:9090/start`. Users can obtain their personal tokens on this page and copy the connection instructions for an agent to help with setup. Administrators must expose both `/start` and `/mcp` through an HTTPS reverse proxy.
215
+
216
+ * For administrators: [ZenTao MCP deployment guide](docs/mcp-server.md)
217
+ * For users: [Connect an agent to the ZenTao MCP service](docs/mcp-user-guide.md)
218
+
219
+ ## Documentation
220
+
221
+ The linked guides and changelog are currently in Chinese.
222
+
223
+ | Document | Description |
224
+ | --- | --- |
225
+ | [Interactive command reference (HTML)](docs/command-reference.html) | Open in a browser to search commands and parameters, and filter by module and action type |
226
+ | [Command, parameter, and usage reference](docs/command-reference.md) | All built-in commands, module actions, parameter types, required fields, allowed values, and usage examples |
227
+ | [CLI guide](docs/cli-usage.md) | Authentication, data access and operations, data processing, output formats, configuration, and more |
228
+ | [Use ZenTao with agents](docs/use-zentao-in-agents.md) | Use ZenTao in AI agents through skills or MCP |
229
+ | [ZenTao MCP deployment guide](docs/mcp-server.md) | Deploy a shared remote MCP service, configure an HTTPS reverse proxy, and make it available to users |
230
+ | [Connect an agent to the ZenTao MCP service](docs/mcp-user-guide.md) | Obtain a personal ZenTao token and configure remote MCP in an agent |
231
+ | [Development guide](docs/development.md) | Technology stack, project structure, testing, and builds |
232
+ | [Technical design and implementation](docs/implementation.md) | Internal API calling rules, authentication, and persistent configuration |
233
+ | [Troubleshooting and error reference](docs/errors.md) | Error code reference (Exxxx) |
234
+ | [Roadmap](docs/roadmap.md) | Planned features and improvements |
235
+ | [Changelog](CHANGES.md) | Changes in each release |
236
+
237
+ <!-- repository-only:start -->
238
+ ## Contributing
239
+
240
+ Issues and pull requests are welcome. For development setup, project structure, testing, and builds, see the [Development guide](docs/development.md).
241
+ <!-- repository-only:end -->
242
+
243
+ ## License
244
+
245
+ [MIT](LICENSE)
package/README.md CHANGED
@@ -1,80 +1,62 @@
1
1
  # Zentao CLI
2
2
 
3
+ ![npm](https://img.shields.io/npm/v/zentao-cli) ![Node.js](https://img.shields.io/node/v/zentao-cli) ![License](https://img.shields.io/npm/l/zentao-cli)
4
+
5
+ 简体中文 | [English](README.en.md)
6
+
3
7
  禅道命令行工具,支持在你喜爱的终端里访问和操作禅道数据,对 AI Agents 友好。
4
8
 
5
9
  ## 主要特性
6
10
 
7
- * ✅ 基于最新的禅道 RESTful API 2.0 实现
8
- * ✅ 使用便捷,可通过 `npx @baocang/zentao-cli` 立即运行
9
- * ✅ 安全的用户认证管理,支持多用户切换
10
- * ✅ 支持对数据进行摘取、过滤、排序等处理,并自动将 HTML 转换为 Markdown
11
- * ✅ 对 AI Agents 友好,帮助信息完善,支持输出 Markdown
12
- * ✅ 支持以 AI 技能的方式使用,支持通过 `zentao add-skill` 一键安装技能到 AI Agent
13
- * ✅ 支持 MCP 服务,使用 `npx @baocang/zentao-cli mcp` 启动 MCP 服务
14
- * ✅ 支持附件上传、下载、重命名和删除,可直接挂载到 Bug、任务、需求等业务对象
15
- * ✅ Token 失效时可通过密码自动重连,并识别 HTTP 200 登录页响应
16
- * ✅ 支持工作区管理,记住常用的产品、项目和执行上下文
17
- * ✅ 使用现代的 bun 与 TypeScript 开发,具备类型安全
18
- * ✅ 提供完善的测试覆盖,保障代码质量
19
-
20
- 待实现特性:
21
-
22
- * [ ] 支持批量创建和更新操作
23
- * [ ] 对象预设 pick 列表
24
- * [ ] Markdown 输出渲染,提供适合人阅读的终端渲染模式,为 Markdown 内容应用多彩格式,代码块支持高亮
25
- * [ ] 支持适合开发者手动使用的极客版,有友好的 TUI 界面,支持在一个界面提供交互式操作
26
- * [ ] 一键安装脚本,支持自动根据用户环境选择安装方式
27
- * [ ] 国际化支持,支持多语言
28
- * [ ] 多级别日志功能
29
-
30
- ## 快速使用
31
-
32
- ```bash
33
- # 全局安装 zentao-cli 工具
34
- npm install -g @baocang/zentao-cli
11
+ * 基于禅道 RESTful API 2.0,覆盖 40 多个模块、300 多个 API 操作,调用前按禅道版本检查接口兼容性
12
+ * 可通过 `npx zentao-cli` 免安装运行
13
+ * 通过浏览器登录,只保存 Token、不保存密码,支持多账号切换
14
+ * 支持对数据进行摘取、过滤、排序,可显式将 HTML 转换为 Markdown
15
+ * 对 AI Agents 友好:帮助信息完善,支持 Markdown 与 JSON 输出
16
+ * 通过 `zentao skill install` 一键安装技能到 AI Agent
17
+ * 提供本地 stdio 与远程 HTTP MCP 服务,多个客户端可使用各自的禅道 Token
35
18
 
36
- # 其他安装与运行方式
37
- # bun install -g @baocang/zentao-cli # ← 使用 bun 安装
38
- # npx @baocang/zentao-cli # ← 通过 npx 免安装运行
39
- # pnpm dlx @baocang/zentao-cli # ← 通过 pnpm 免安装运行
19
+ ## 环境要求
40
20
 
41
- # 首次使用需要进行登录
42
- zentao login -s https://zentao.example.com -u admin -p '<password>'
21
+ * Node.js 18 或更高版本
22
+ * 禅道开源版 22.0、企业版 biz13.0、旗舰版 max8.0 或 IPD 版 ipd5.0 及以上
43
23
 
44
- # 直接执行获取可用命令帮助
45
- zentao
24
+ 部分操作要求更高的禅道版本,CLI 会在发送请求前检查并提示。详见 [API 覆盖与版本兼容](docs/cli-usage.md#api-覆盖与版本兼容)。
46
25
 
47
- # 查看禅道产品
48
- zentao product
26
+ ## 快速开始
49
27
 
50
- # 查看指定 ID 的产品
51
- zentao product 1
28
+ 以下示例适用于 0.4.4 及以上版本;0.4.3 及更早版本请以本机 `--help` 为准。
52
29
 
53
- # 更新禅道产品 #1
54
- zentao product update --id=1 --name=产品1
30
+ ```bash
31
+ # 全局安装
32
+ npm install -g zentao-cli
55
33
 
56
- # 更多功能可通过 help 查看
57
- zentao help
34
+ # 也可以使用 bun 安装,或免安装运行
35
+ # bun install -g zentao-cli
36
+ # npx zentao-cli
37
+ # pnpm dlx zentao-cli
58
38
 
59
- # 查看禅道产品帮助
60
- zentao product help
39
+ # 登录:自动打开浏览器,输入禅道地址、用户名和密码
40
+ zentao login
61
41
 
62
- # 安装 zentao-cli 技能
63
- zentao add-skill
42
+ # 查看产品列表
43
+ zentao product list
64
44
  ```
65
45
 
66
- ## 核心命令
46
+ 没有图形界面的终端可使用 `zentao login --no-browser` 交互登录。环境变量登录、多账号切换和退出登录见 [用户验证](docs/cli-usage.md#用户验证)。
47
+
48
+ ## 常用命令
67
49
 
68
- zentao-cli 的命令格式简单直观:`zentao <模块名> [操作] [参数]`。下面通过常见场景快速上手。
50
+ 命令格式为 `zentao <模块名> <操作> [目标] [选项]`。使用 `list` 查看列表、`get` 查看详情;省略操作时显示帮助。
69
51
 
70
- ### 查看与管理产品
52
+ ### 产品
71
53
 
72
54
  ```bash
73
55
  # 查看产品列表
74
- zentao product
56
+ zentao product list
75
57
 
76
58
  # 查看产品详情
77
- zentao product 1
59
+ zentao product get 1
78
60
 
79
61
  # 创建产品
80
62
  zentao product create --name=新产品
@@ -86,46 +68,49 @@ zentao product update 1 --name=产品新名称
86
68
  zentao product delete 1
87
69
  ```
88
70
 
89
- ### 查看与处理 Bug
71
+ ### Bug
90
72
 
91
73
  ```bash
92
- # 查看 Bug 列表
93
- zentao bug
74
+ # 查看产品 #1 的 Bug 列表
75
+ zentao bug list --product=1
94
76
 
95
77
  # 查看 Bug 详情
96
- zentao bug 329
78
+ zentao bug get 329
97
79
 
98
- # 解决 Bug(执行操作)
80
+ # 生成此 Bug 的禅道页面链接
81
+ zentao link create bug view --var bugID=329
82
+
83
+ # 解决 Bug
99
84
  zentao bug resolve 329 --resolution=fixed
100
85
  ```
101
86
 
102
87
  ### 需求与任务
103
88
 
104
89
  ```bash
105
- # 查看需求列表
106
- zentao story
90
+ # 查看产品 #1 的需求列表
91
+ zentao story list --product=1
107
92
 
108
- # 创建任务
109
- zentao task create --name=实现登录功能 --execution=10
93
+ # 在执行 #10 中创建任务
94
+ zentao task create --name=实现登录功能 --execution-id=10
110
95
  ```
111
96
 
112
- ### 数据筛选与搜索
97
+ ### 筛选与输出格式
113
98
 
114
99
  ```bash
115
100
  # 只显示指定字段
116
- zentao product --pick=id,name
101
+ zentao product list --fields=id,name
117
102
 
118
103
  # 按条件过滤
119
- zentao bug --filter 'status:active'
104
+ zentao bug list --product=1 --filter 'status=active'
120
105
 
121
106
  # 模糊搜索
122
- zentao story --search=登录 --search-fields=title
107
+ zentao story list --product=1 --search=登录 --search-fields=title
123
108
 
124
109
  # 按字段排序
125
- zentao bug --sort=id_desc
110
+ zentao bug list --product=1 --sort=id:desc
126
111
 
127
- # JSON 格式输出(适合程序处理)
128
- zentao product --format=json
112
+ # JSON 格式输出,适合程序处理
113
+ zentao product list --format=json
129
114
  ```
130
115
 
131
116
  ### 查看帮助
@@ -134,48 +119,59 @@ zentao product --format=json
134
119
  # 查看所有命令
135
120
  zentao help
136
121
 
137
- # 查看指定模块的帮助(可用操作与参数)
138
- zentao bug help
122
+ # 查看模块的可用操作与参数
123
+ zentao bug --help
124
+
125
+ # 查看操作的参数和最低禅道版本
126
+ zentao bug resolve --help
127
+ ```
128
+
129
+ ### 获取 Token
130
+
131
+ 脚本或 MCP 配置需要 Token 时,可用 `zentao token` 读取:
132
+
133
+ ```bash
134
+ # 读取当前账号或指定账号已保存的 Token
135
+ zentao token
136
+ zentao token 'admin@https://zentao.example.com'
137
+
138
+ # 临时获取新 Token,不保存到 CLI 配置
139
+ zentao token --server https://zentao.example.com --user admin --password '<password>'
139
140
  ```
140
141
 
141
- 更多功能(环境变量、账户切换、批量操作、管道输入、分页控制等)请参考 [CLI 核心功能详解](docs/cli-usage.md)。
142
+ 默认只输出一行 Token。读取已保存的 Token 不会联网验证,也不会修改配置或切换账号。详见 [获取 Token](docs/cli-usage.md#获取-token)。
143
+
144
+ 管道输入、批量操作、分页控制和配置管理等更多功能见 [CLI 核心功能详解](docs/cli-usage.md)。
145
+
146
+ CLI 默认发送带版本的操作来源标记,MCP 自动区分 stdio/HTTP。用 `--assistant 'AI <codex>'` 自定义本次标记,`--assistant ''` 本次关闭,或 `zentao config set autoAssistant false` 关闭当前 profile 的自动标记。MCP 工具可用顶层 `assistant` 参数逐次覆盖。详见[操作来源标记](docs/cli-usage.md#操作来源标记)。
142
147
 
143
148
  ## 在 AI Agents 中使用
144
149
 
145
- ### 通过 Zentao CLI 技能使用
150
+ 可以通过以下三种方式在 AI Agents 中使用禅道:
146
151
 
147
- 支持通过 `zentao-cli` 技能访问和操作禅道数据。安装技能可以通过 `zentao add-skill` 一键安装技能到 AI Agent,目前支持 Claude Code、Cursor、Cherry Studio、Codex、OpenCode、VS Code 等 AI Agent。
152
+ | 方式 | 适用场景 | 是否需要安装 CLI |
153
+ | --- | --- | --- |
154
+ | 技能(Skill) | 个人使用,Agent 在终端中调用 CLI | 需要 |
155
+ | 本地 MCP | 个人使用,Agent 通过 MCP 工具调用 CLI | 需要 |
156
+ | 远程 MCP | 公司统一部署,用户用个人 Token 接入 | 不需要 |
148
157
 
149
- 详细使用可以参考:[在 Agents 中使用禅道](docs/use-zentao-in-agents.md),下面简单介绍。
158
+ 完整说明见 [在 Agents 中使用禅道](docs/use-zentao-in-agents.md)。
159
+
160
+ ### 通过技能使用
150
161
 
151
162
  ```bash
152
- # 安装 zentao-cli 技能
153
- $ zentao add-skill
154
-
155
- 请选择要安装的 AI Agent:
156
- 1) Claude Code
157
- 2) Cursor
158
- 3) Cherry Studio
159
- 4) Codex
160
- 5) OpenCode
161
- 6) VS Code
162
- 7) Antigravity
163
- 8) Gemini
164
- 9) 全部安装
165
- 请输入编号 (1-9):9
166
-
167
- # 安装技能到 Claude Code
168
- $ zentao add-skill claude-code
169
- ```
163
+ # 一键安装、登录并安装技能(交互选择目标 Agent)
164
+ npm install -g zentao-cli && zentao login && zentao skill install
170
165
 
171
- 如果还未安装 zentao-cli,可以通过下面的命令,一键安装、登录和配置 Skill:
166
+ # 直接指定目标 Agent,all 表示全部安装
167
+ zentao skill install claude-code
168
+ zentao skill install all
172
169
 
173
- ```bash
174
- # 一键安装、登录和配置 Skill
175
- $ pnpm install -g @baocang/zentao-cli && zentao login && zentao add-skill all
170
+ # 将所有内置技能导出到指定目录
171
+ zentao skill export ./skills
176
172
  ```
177
173
 
178
- 安装技能后即可在对应 Agent 工具中使用禅道 CLI 技能。
174
+ 支持 Claude Code、Cursor、Cherry Studio、Codex、OpenCode、VS Code、Antigravity 和 Gemini。安装后即可在 Agent 中用自然语言提问:
179
175
 
180
176
  ```txt
181
177
  禅道中有哪些产品?
@@ -185,69 +181,63 @@ $ pnpm install -g @baocang/zentao-cli && zentao login && zentao add-skill all
185
181
  需求 xxx 有哪些风险?
186
182
  ```
187
183
 
188
- ### 通过 MCP 服务使用
184
+ 由 Agent 发起登录时,使用 `zentao login --web` 并保持进程运行,等用户在浏览器中完成验证后再继续。在 CI 或容器中,可以注入环境凭据或挂载配置文件;Agent 可先执行 `zentao auth status --format=json` 确认实际使用的账号,输出不包含 Token 或密码。详见 [Agent、CI 与容器中的凭据](docs/use-zentao-in-agents.md#agentci-与容器中的凭据)。
189
185
 
190
- Zentao CLI 支持一键配置 MCP 服务,只需要执行 `zentao add-mcp` 命令,然后按照提示输入禅道 URL、用户名和密码即可。
186
+ ### 通过本地 MCP 使用
191
187
 
192
188
  ```bash
193
- # 一键配置 MCP 服务
194
- $ zentao add-mcp
195
-
196
- 请输入禅道 URL: https://zentao.example.com
197
- 请输入用户名: admin
198
- 请输入密码: <password>
199
-
200
- 请选择要配置的 AI Agent:
201
- 1) Cursor
202
- 2) Claude Desktop
203
- 3) Claude Code
204
- 4) Windsurf
205
- 5) Cline
206
- 6) Trae
207
- 7) VS Code
208
- 8) Cherry Studio
209
- 9) OpenCode
210
- 10) Codex
211
- 11) 全部配置
212
- 请输入编号 (1-11): 7
189
+ # 一键安装、登录并配置本地 stdio MCP(交互选择目标 Agent)
190
+ npm install -g zentao-cli && zentao login && zentao add-mcp
213
191
  ```
214
192
 
215
- 如果还未安装 zentao-cli,可以通过下面的命令,一键安装、登录和配置 MCP 服务:
193
+ `zentao add-mcp` 会复用当前账号的 Token,不会将禅道密码写入 Agent 配置。可在 MCP 配置的 `args` 中追加启动选项来限制开放范围:
216
194
 
217
195
  ```bash
218
- # 一键安装、登录和配置 MCP 服务
219
- $ pnpm install -g @baocang/zentao-cli && zentao login && zentao add-mcp
196
+ # 只开放查询,并限定业务模块
197
+ zentao mcp --read-only --modules product,story,task,bug
198
+
199
+ # 将每个模块拆分为查询和写入两个工具,方便客户端分别授权
200
+ zentao mcp --split-tools --modules product,story,task,bug
220
201
  ```
221
202
 
222
- 统一支持通过 `npx -y @baocang/zentao-cli mcp` 手动启动 MCP 服务,然后通过 MCP 客户端访问和操作禅道数据。目前各大 Agents 工具无需提前安装 zentao-cli 本身,只需要在 MCP 服务配置中增加如下配置即可:
223
-
224
- ```json
225
- {
226
- "mcpServers": {
227
- "zentao-cli": {
228
- "command": "npx",
229
- "args": ["-y", "@baocang/zentao-cli", "mcp"],
230
- "env": {
231
- "ZENTAO_URL": "https://zentao.example.com",
232
- "ZENTAO_ACCOUNT": "admin",
233
- "ZENTAO_PASSWORD": "<password>",
234
- "ZENTAO_MCP_UPLOAD_ROOT": "/path/to/allowed/files"
235
- }
236
- }
237
- }
238
- }
203
+ 生成的配置格式和全部启动选项见 [MCP 服务](docs/cli-usage.md#mcp-服务)。
204
+
205
+ ### 通过远程 MCP 使用
206
+
207
+ `zentao mcp-server` 适合由公司管理员统一部署。用户只需服务地址和自己的禅道 Token,无需安装 zentao-cli;禅道按各自账号的权限处理请求。
208
+
209
+ ```bash
210
+ # 管理员在服务器上启动服务,固定连接一个禅道站点
211
+ zentao mcp-server https://zentao.example.com
239
212
  ```
240
213
 
241
- `ZENTAO_MCP_UPLOAD_ROOT` 可选。MCP 本地文件上传默认禁用;设置后仅允许上传该目录内不超过 50 MiB 的普通文件。
214
+ 启动后打开 `http://127.0.0.1:9090/start`,用户可在页面上获取个人 Token,并复制接入说明让 Agent 协助配置。管理员需通过 HTTPS 反向代理同时提供 `/start` 和 `/mcp`。
215
+
216
+ * 管理员部署:[禅道 MCP 服务部署指南](docs/mcp-server.md)
217
+ * 用户接入:[在 Agent 中接入禅道 MCP 服务](docs/mcp-user-guide.md)
242
218
 
243
219
  ## 文档
244
220
 
245
221
  | 文档 | 说明 |
246
222
  | --- | --- |
223
+ | [交互式命令参考(HTML)](docs/command-reference.html) | 浏览器直接打开,搜索命令与参数,按模块和操作类型筛选 |
224
+ | [命令、参数与用法参考](docs/command-reference.md) | 全部内置命令、业务操作、参数类型、必填项、可选值和用法 |
247
225
  | [CLI 核心功能详解](docs/cli-usage.md) | 用户验证、数据访问与操作、数据处理、输出格式、配置管理等 |
248
226
  | [在 Agents 中使用禅道](docs/use-zentao-in-agents.md) | 通过技能或 MCP 在 AI Agents 中使用禅道 |
249
- | [开发指引](docs/development.md) | 技术栈、项目结构、测试 |
227
+ | [禅道 MCP 服务部署指南](docs/mcp-server.md) | 管理员统一部署远程 MCP 服务、配置 HTTPS 反向代理并向用户发布 |
228
+ | [在 Agent 中接入禅道 MCP 服务](docs/mcp-user-guide.md) | 禅道用户获取个人 Token,并在 Agent 中配置远程 MCP |
229
+ | [开发指引](docs/development.md) | 技术栈、项目结构、测试与构建 |
250
230
  | [技术方案与实现细节](docs/implementation.md) | 内部接口调用规则、验证机制与持久化配置 |
251
231
  | [常见错误排查与参考手册](docs/errors.md) | 错误代码(Exxxx)查阅 |
252
232
  | [后续计划](docs/roadmap.md) | 待实现的功能和改进计划 |
253
233
  | [更新日志](CHANGES.md) | 每个版本的变更内容 |
234
+
235
+ <!-- repository-only:start -->
236
+ ## 参与贡献
237
+
238
+ 欢迎提交 Issue 和 Pull Request。开发环境、项目结构、测试和构建方法见 [开发指引](docs/development.md)。
239
+ <!-- repository-only:end -->
240
+
241
+ ## 许可证
242
+
243
+ [MIT](LICENSE)