@baocang/zentao-cli 0.4.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,78 +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
- * ✅ 使用现代的 bun 与 TypeScript 开发,具备类型安全
15
- * ✅ 提供完善的测试覆盖,保障代码质量
16
-
17
- 待实现特性:
18
-
19
- * [ ] 支持工作区管理,支持记住用户上次访问的产品、项目和执行信息
20
- * [ ] 支持批量创建和更新操作
21
- * [ ] 对象预设 pick 列表
22
- * [ ] Markdown 输出渲染,提供适合人阅读的终端渲染模式,为 Markdown 内容应用多彩格式,代码块支持高亮
23
- * [ ] 支持适合开发者手动使用的极客版,有友好的 TUI 界面,支持在一个界面提供交互式操作
24
- * [ ] 一键安装脚本,支持自动根据用户环境选择安装方式
25
- * [ ] 国际化支持,支持多语言
26
- * [ ] 多级别日志功能
27
-
28
- ## 快速使用
29
-
30
- ```bash
31
- # 全局安装 zentao-cli 工具
32
- 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
33
18
 
34
- # 其他安装与运行方式
35
- # bun install -g @baocang/zentao-cli # ← 使用 bun 安装
36
- # npx @baocang/zentao-cli # ← 通过 npx 免安装运行
37
- # pnpm dlx @baocang/zentao-cli # ← 通过 pnpm 免安装运行
19
+ ## 环境要求
38
20
 
39
- # 首次使用需要进行登录
40
- zentao login -s https://zentao.example.com -u admin -p 123456
21
+ * Node.js 18 或更高版本
22
+ * 禅道开源版 22.0、企业版 biz13.0、旗舰版 max8.0 或 IPD 版 ipd5.0 及以上
41
23
 
42
- # 直接执行获取可用命令帮助
43
- zentao
24
+ 部分操作要求更高的禅道版本,CLI 会在发送请求前检查并提示。详见 [API 覆盖与版本兼容](docs/cli-usage.md#api-覆盖与版本兼容)。
44
25
 
45
- # 查看禅道产品
46
- zentao product
26
+ ## 快速开始
47
27
 
48
- # 查看指定 ID 的产品
49
- zentao product 1
28
+ 以下示例适用于 0.4.4 及以上版本;0.4.3 及更早版本请以本机 `--help` 为准。
50
29
 
51
- # 更新禅道产品 #1
52
- zentao product update --id=1 --name=产品1
30
+ ```bash
31
+ # 全局安装
32
+ npm install -g zentao-cli
53
33
 
54
- # 更多功能可通过 help 查看
55
- zentao help
34
+ # 也可以使用 bun 安装,或免安装运行
35
+ # bun install -g zentao-cli
36
+ # npx zentao-cli
37
+ # pnpm dlx zentao-cli
56
38
 
57
- # 查看禅道产品帮助
58
- zentao product help
39
+ # 登录:自动打开浏览器,输入禅道地址、用户名和密码
40
+ zentao login
59
41
 
60
- # 安装 zentao-cli 技能
61
- zentao add-skill
42
+ # 查看产品列表
43
+ zentao product list
62
44
  ```
63
45
 
64
- ## 核心命令
46
+ 没有图形界面的终端可使用 `zentao login --no-browser` 交互登录。环境变量登录、多账号切换和退出登录见 [用户验证](docs/cli-usage.md#用户验证)。
47
+
48
+ ## 常用命令
65
49
 
66
- zentao-cli 的命令格式简单直观:`zentao <模块名> [操作] [参数]`。下面通过常见场景快速上手。
50
+ 命令格式为 `zentao <模块名> <操作> [目标] [选项]`。使用 `list` 查看列表、`get` 查看详情;省略操作时显示帮助。
67
51
 
68
- ### 查看与管理产品
52
+ ### 产品
69
53
 
70
54
  ```bash
71
55
  # 查看产品列表
72
- zentao product
56
+ zentao product list
73
57
 
74
58
  # 查看产品详情
75
- zentao product 1
59
+ zentao product get 1
76
60
 
77
61
  # 创建产品
78
62
  zentao product create --name=新产品
@@ -84,46 +68,49 @@ zentao product update 1 --name=产品新名称
84
68
  zentao product delete 1
85
69
  ```
86
70
 
87
- ### 查看与处理 Bug
71
+ ### Bug
88
72
 
89
73
  ```bash
90
- # 查看 Bug 列表
91
- zentao bug
74
+ # 查看产品 #1 的 Bug 列表
75
+ zentao bug list --product=1
92
76
 
93
77
  # 查看 Bug 详情
94
- zentao bug 329
78
+ zentao bug get 329
95
79
 
96
- # 解决 Bug(执行操作)
80
+ # 生成此 Bug 的禅道页面链接
81
+ zentao link create bug view --var bugID=329
82
+
83
+ # 解决 Bug
97
84
  zentao bug resolve 329 --resolution=fixed
98
85
  ```
99
86
 
100
87
  ### 需求与任务
101
88
 
102
89
  ```bash
103
- # 查看需求列表
104
- zentao story
90
+ # 查看产品 #1 的需求列表
91
+ zentao story list --product=1
105
92
 
106
- # 创建任务
107
- zentao task create --name=实现登录功能 --execution=10
93
+ # 在执行 #10 中创建任务
94
+ zentao task create --name=实现登录功能 --execution-id=10
108
95
  ```
109
96
 
110
- ### 数据筛选与搜索
97
+ ### 筛选与输出格式
111
98
 
112
99
  ```bash
113
100
  # 只显示指定字段
114
- zentao product --pick=id,name
101
+ zentao product list --fields=id,name
115
102
 
116
103
  # 按条件过滤
117
- zentao bug --filter 'status:active'
104
+ zentao bug list --product=1 --filter 'status=active'
118
105
 
119
106
  # 模糊搜索
120
- zentao story --search=登录 --search-fields=title
107
+ zentao story list --product=1 --search=登录 --search-fields=title
121
108
 
122
109
  # 按字段排序
123
- zentao bug --sort=id_desc
110
+ zentao bug list --product=1 --sort=id:desc
124
111
 
125
- # JSON 格式输出(适合程序处理)
126
- zentao product --format=json
112
+ # JSON 格式输出,适合程序处理
113
+ zentao product list --format=json
127
114
  ```
128
115
 
129
116
  ### 查看帮助
@@ -132,48 +119,59 @@ zentao product --format=json
132
119
  # 查看所有命令
133
120
  zentao help
134
121
 
135
- # 查看指定模块的帮助(可用操作与参数)
136
- 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>'
137
140
  ```
138
141
 
139
- 更多功能(环境变量、账户切换、批量操作、管道输入、分页控制等)请参考 [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#操作来源标记)。
140
147
 
141
148
  ## 在 AI Agents 中使用
142
149
 
143
- ### 通过 Zentao CLI 技能使用
150
+ 可以通过以下三种方式在 AI Agents 中使用禅道:
144
151
 
145
- 支持通过 `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 接入 | 不需要 |
146
157
 
147
- 详细使用可以参考:[在 Agents 中使用禅道](docs/use-zentao-in-agents.md),下面简单介绍。
158
+ 完整说明见 [在 Agents 中使用禅道](docs/use-zentao-in-agents.md)。
159
+
160
+ ### 通过技能使用
148
161
 
149
162
  ```bash
150
- # 安装 zentao-cli 技能
151
- $ zentao add-skill
152
-
153
- 请选择要安装的 AI Agent:
154
- 1) Claude Code
155
- 2) Cursor
156
- 3) Cherry Studio
157
- 4) Codex
158
- 5) OpenCode
159
- 6) VS Code
160
- 7) Antigravity
161
- 8) Gemini
162
- 9) 全部安装
163
- 请输入编号 (1-9):9
164
-
165
- # 安装技能到 Claude Code
166
- $ zentao add-skill claude-code
167
- ```
163
+ # 一键安装、登录并安装技能(交互选择目标 Agent)
164
+ npm install -g zentao-cli && zentao login && zentao skill install
168
165
 
169
- 如果还未安装 zentao-cli,可以通过下面的命令,一键安装、登录和配置 Skill:
166
+ # 直接指定目标 Agent,all 表示全部安装
167
+ zentao skill install claude-code
168
+ zentao skill install all
170
169
 
171
- ```bash
172
- # 一键安装、登录和配置 Skill
173
- $ pnpm install -g @baocang/zentao-cli && zentao login && zentao add-skill all
170
+ # 将所有内置技能导出到指定目录
171
+ zentao skill export ./skills
174
172
  ```
175
173
 
176
- 安装技能后即可在对应 Agent 工具中使用禅道 CLI 技能。
174
+ 支持 Claude Code、Cursor、Cherry Studio、Codex、OpenCode、VS Code、Antigravity 和 Gemini。安装后即可在 Agent 中用自然语言提问:
177
175
 
178
176
  ```txt
179
177
  禅道中有哪些产品?
@@ -183,66 +181,63 @@ $ pnpm install -g @baocang/zentao-cli && zentao login && zentao add-skill all
183
181
  需求 xxx 有哪些风险?
184
182
  ```
185
183
 
186
- ### 通过 MCP 服务使用
184
+ 由 Agent 发起登录时,使用 `zentao login --web` 并保持进程运行,等用户在浏览器中完成验证后再继续。在 CI 或容器中,可以注入环境凭据或挂载配置文件;Agent 可先执行 `zentao auth status --format=json` 确认实际使用的账号,输出不包含 Token 或密码。详见 [Agent、CI 与容器中的凭据](docs/use-zentao-in-agents.md#agentci-与容器中的凭据)。
187
185
 
188
- Zentao CLI 支持一键配置 MCP 服务,只需要执行 `zentao add-mcp` 命令,然后按照提示输入禅道 URL、用户名和密码即可。
186
+ ### 通过本地 MCP 使用
189
187
 
190
188
  ```bash
191
- # 一键配置 MCP 服务
192
- $ zentao add-mcp
193
-
194
- 请输入禅道 URL: https://zentao.example.com
195
- 请输入用户名: admin
196
- 请输入密码: 123456
197
-
198
- 请选择要配置的 AI Agent:
199
- 1) Cursor
200
- 2) Claude Desktop
201
- 3) Claude Code
202
- 4) Windsurf
203
- 5) Cline
204
- 6) Trae
205
- 7) VS Code
206
- 8) Cherry Studio
207
- 9) OpenCode
208
- 10) Codex
209
- 11) 全部配置
210
- 请输入编号 (1-11): 7
189
+ # 一键安装、登录并配置本地 stdio MCP(交互选择目标 Agent)
190
+ npm install -g zentao-cli && zentao login && zentao add-mcp
211
191
  ```
212
192
 
213
- 如果还未安装 zentao-cli,可以通过下面的命令,一键安装、登录和配置 MCP 服务:
193
+ `zentao add-mcp` 会复用当前账号的 Token,不会将禅道密码写入 Agent 配置。可在 MCP 配置的 `args` 中追加启动选项来限制开放范围:
214
194
 
215
195
  ```bash
216
- # 一键安装、登录和配置 MCP 服务
217
- $ 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
218
201
  ```
219
202
 
220
- 统一支持通过 `npx -y @baocang/zentao-cli mcp` 手动启动 MCP 服务,然后通过 MCP 客户端访问和操作禅道数据。目前各大 Agents 工具无需提前安装 zentao-cli 本身,只需要在 MCP 服务配置中增加如下配置即可:
221
-
222
- ```json
223
- {
224
- "mcpServers": {
225
- "zentao-cli": {
226
- "command": "npx",
227
- "args": ["-y", "@baocang/zentao-cli", "mcp"],
228
- "env": {
229
- "ZENTAO_URL": "https://zentao.example.com",
230
- "ZENTAO_ACCOUNT": "admin",
231
- "ZENTAO_PASSWORD": "123456"
232
- }
233
- }
234
- }
235
- }
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
236
212
  ```
237
213
 
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)
218
+
238
219
  ## 文档
239
220
 
240
221
  | 文档 | 说明 |
241
222
  | --- | --- |
223
+ | [交互式命令参考(HTML)](docs/command-reference.html) | 浏览器直接打开,搜索命令与参数,按模块和操作类型筛选 |
224
+ | [命令、参数与用法参考](docs/command-reference.md) | 全部内置命令、业务操作、参数类型、必填项、可选值和用法 |
242
225
  | [CLI 核心功能详解](docs/cli-usage.md) | 用户验证、数据访问与操作、数据处理、输出格式、配置管理等 |
243
226
  | [在 Agents 中使用禅道](docs/use-zentao-in-agents.md) | 通过技能或 MCP 在 AI Agents 中使用禅道 |
244
- | [开发指引](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) | 技术栈、项目结构、测试与构建 |
245
230
  | [技术方案与实现细节](docs/implementation.md) | 内部接口调用规则、验证机制与持久化配置 |
246
231
  | [常见错误排查与参考手册](docs/errors.md) | 错误代码(Exxxx)查阅 |
247
232
  | [后续计划](docs/roadmap.md) | 待实现的功能和改进计划 |
248
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)