yuque-mcp 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +29 -175
  2. package/README.zh-CN.md +33 -196
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,148 +1,53 @@
1
1
  # Yuque MCP Server
2
2
 
3
3
  [![CI](https://github.com/chen201724/yuque-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/chen201724/yuque-mcp-server/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/yuque-mcp)](https://www.npmjs.com/package/yuque-mcp)
4
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue.svg)](https://www.typescriptlang.org/)
6
- [![MCP](https://img.shields.io/badge/MCP-1.0-green.svg)](https://modelcontextprotocol.io/)
7
6
 
8
- MCP server for [Yuque (语雀)](https://www.yuque.com/) — expose your Yuque knowledge base to AI assistants through the [Model Context Protocol](https://modelcontextprotocol.io/).
7
+ MCP server for [Yuque (语雀)](https://www.yuque.com/) — expose your knowledge base to AI assistants through the [Model Context Protocol](https://modelcontextprotocol.io/).
9
8
 
10
- [中文文档](./README.zh-CN.md)
11
-
12
- ## Features
13
-
14
- - **25 Tools** — Complete coverage of Yuque API (docs, repos, search, groups, stats, TOC, versions)
15
- - **Stdio Transport** — Works with Claude Desktop, Cursor, Claude Code, Windsurf, and any MCP-compatible client
16
- - **Type-Safe** — Full TypeScript with strict mode + Zod parameter validation
17
- - **AI-Optimized** — Response formatting designed to minimize token usage
18
- - **Well-Tested** — Unit tests with vitest, CI on Node 18/20/22
9
+ 🌐 **[Website](https://chen201724.github.io/yuque-ecosystem/)** · [中文文档](./README.zh-CN.md)
19
10
 
20
11
  ## Quick Start
21
12
 
22
13
  ### 1. Get Your Yuque API Token
23
14
 
24
- Visit [Yuque Developer Settings](https://www.yuque.com/settings/tokens) to generate a personal API token.
15
+ Visit [Yuque Developer Settings](https://www.yuque.com/settings/tokens) to create a personal token.
25
16
 
26
- ### 2. Configure Your MCP Client
17
+ ### 2. Add to Your MCP Client
27
18
 
28
19
  #### Claude Code
29
20
 
30
21
  ```bash
31
- claude mcp add yuque -- npx -y yuque-mcp --token=YOUR_TOKEN
32
- ```
33
-
34
- Or add to `~/.claude/claude_desktop_config.json`:
35
-
36
- ```json
37
- {
38
- "mcpServers": {
39
- "yuque": {
40
- "command": "npx",
41
- "args": ["-y", "yuque-mcp"],
42
- "env": {
43
- "YUQUE_TOKEN": "YOUR_TOKEN"
44
- }
45
- }
46
- }
47
- }
22
+ claude mcp add yuque-mcp -- npx -y yuque-mcp --token=YOUR_TOKEN
48
23
  ```
49
24
 
50
- #### Claude Desktop
51
-
52
- Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
53
-
54
- ```json
55
- {
56
- "mcpServers": {
57
- "yuque": {
58
- "command": "npx",
59
- "args": ["-y", "yuque-mcp"],
60
- "env": {
61
- "YUQUE_TOKEN": "YOUR_TOKEN"
62
- }
63
- }
64
- }
65
- }
66
- ```
67
-
68
- #### Cursor
69
-
70
- Add to `.cursor/mcp.json` in your project root:
71
-
72
- ```json
73
- {
74
- "mcpServers": {
75
- "yuque": {
76
- "command": "npx",
77
- "args": ["-y", "yuque-mcp"],
78
- "env": {
79
- "YUQUE_TOKEN": "YOUR_TOKEN"
80
- }
81
- }
82
- }
83
- }
84
- ```
25
+ ### 3. Done!
85
26
 
86
- #### Global Install (alternative)
27
+ Ask your AI assistant to search your Yuque docs, create documents, or manage repos.
87
28
 
88
- ```bash
89
- npm install -g yuque-mcp
90
- export YUQUE_TOKEN=your_token_here
91
- yuque-mcp
92
- ```
29
+ ## Available Tools (25)
93
30
 
94
- ## Available Tools
95
-
96
- | Category | Tool | Description |
97
- |----------|------|-------------|
98
- | **User** | `yuque_get_user` | Get current user info |
99
- | **User** | `yuque_list_groups` | List user's groups/teams |
100
- | **Search** | `yuque_search` | Search docs, repos, or users |
101
- | **Repos** | `yuque_list_repos` | List repos for user or group |
102
- | **Repos** | `yuque_get_repo` | Get repo details |
103
- | **Repos** | `yuque_create_repo` | Create new repo |
104
- | **Repos** | `yuque_update_repo` | Update repo settings |
105
- | **Repos** | `yuque_delete_repo` | Delete repo |
106
- | **Docs** | `yuque_list_docs` | List documents in repo |
107
- | **Docs** | `yuque_get_doc` | Get document with full content |
108
- | **Docs** | `yuque_create_doc` | Create new document |
109
- | **Docs** | `yuque_update_doc` | Update document |
110
- | **Docs** | `yuque_delete_doc` | Delete document |
111
- | **TOC** | `yuque_get_toc` | Get repo table of contents |
112
- | **TOC** | `yuque_update_toc` | Update repo TOC |
113
- | **Versions** | `yuque_list_doc_versions` | List document versions |
114
- | **Versions** | `yuque_get_doc_version` | Get specific version |
115
- | **Groups** | `yuque_list_group_members` | List group members |
116
- | **Groups** | `yuque_update_group_member` | Update member role |
117
- | **Groups** | `yuque_remove_group_member` | Remove member |
118
- | **Stats** | `yuque_group_stats` | Group statistics |
119
- | **Stats** | `yuque_group_member_stats` | Member statistics |
120
- | **Stats** | `yuque_group_book_stats` | Book statistics |
121
- | **Stats** | `yuque_group_doc_stats` | Document statistics |
122
- | **Utility** | `yuque_hello` | Test API connectivity |
123
-
124
- ## Docker
31
+ | Category | Tools |
32
+ |----------|-------|
33
+ | **User** | `yuque_get_user`, `yuque_list_groups` |
34
+ | **Search** | `yuque_search` |
35
+ | **Repos** | `yuque_list_repos`, `yuque_get_repo`, `yuque_create_repo`, `yuque_update_repo`, `yuque_delete_repo` |
36
+ | **Docs** | `yuque_list_docs`, `yuque_get_doc`, `yuque_create_doc`, `yuque_update_doc`, `yuque_delete_doc` |
37
+ | **TOC** | `yuque_get_toc`, `yuque_update_toc` |
38
+ | **Versions** | `yuque_list_doc_versions`, `yuque_get_doc_version` |
39
+ | **Groups** | `yuque_list_group_members`, `yuque_update_group_member`, `yuque_remove_group_member` |
40
+ | **Stats** | `yuque_group_stats`, `yuque_group_member_stats`, `yuque_group_book_stats`, `yuque_group_doc_stats` |
41
+ | **Utility** | `yuque_hello` |
125
42
 
126
- ```bash
127
- docker build -t yuque-mcp .
128
- docker run --rm -i -e YUQUE_TOKEN=your_token yuque-mcp
129
- ```
43
+ ## Troubleshooting
130
44
 
131
- MCP client config with Docker:
132
-
133
- ```json
134
- {
135
- "mcpServers": {
136
- "yuque": {
137
- "command": "docker",
138
- "args": ["run", "--rm", "-i", "-e", "YUQUE_TOKEN", "yuque-mcp"],
139
- "env": {
140
- "YUQUE_TOKEN": "your_token_here"
141
- }
142
- }
143
- }
144
- }
145
- ```
45
+ | Error | Solution |
46
+ |-------|----------|
47
+ | `YUQUE_TOKEN is required` | Pass `--token=YOUR_TOKEN` or set `YUQUE_TOKEN` env var |
48
+ | `401 Unauthorized` | Token is invalid or expired — regenerate at [Yuque Settings](https://www.yuque.com/settings/tokens) |
49
+ | `429 Rate Limited` | Wait a moment and retry |
50
+ | Tool not found | Update to latest: `npx -y yuque-mcp@latest` |
146
51
 
147
52
  ## Development
148
53
 
@@ -150,66 +55,15 @@ MCP client config with Docker:
150
55
  git clone https://github.com/chen201724/yuque-mcp-server.git
151
56
  cd yuque-mcp-server
152
57
  npm install
153
- npm test # run tests
154
- npm run test:coverage # with coverage
58
+ npm test # run tests (57 tests)
155
59
  npm run build # compile TypeScript
156
60
  npm run dev # dev mode with hot reload
157
- npm run lint # lint
158
- npm run format # format
159
61
  ```
160
62
 
161
- ## Architecture
162
-
163
- ```
164
- src/
165
- ├── cli.ts — CLI entry (stdio transport)
166
- ├── index.ts — HTTP entry (self-hosted, optional)
167
- ├── server.ts — MCP server core
168
- ├── tools/ — Tool implementations (25 tools)
169
- │ ├── user.ts — User & group listing
170
- │ ├── repo.ts — Repository CRUD
171
- │ ├── doc.ts — Document CRUD
172
- │ ├── toc.ts — Table of contents
173
- │ ├── search.ts — Full-text search
174
- │ ├── group.ts — Group member management
175
- │ ├── stats.ts — Analytics & statistics
176
- │ └── version.ts — Document version history
177
- ├── services/
178
- │ ├── yuque-client.ts — Yuque API HTTP client
179
- │ └── types.ts — Type definitions
180
- └── utils/
181
- ├── format.ts — AI-optimized response formatting
182
- └── error.ts — Error handling & user-friendly messages
183
- ```
184
-
185
- ## Troubleshooting
186
-
187
- **"YUQUE_TOKEN is required"**
188
- Set the token via environment variable or `--token` argument. Get yours at [Yuque Settings](https://www.yuque.com/settings/tokens).
189
-
190
- **"Request failed with status 401"**
191
- Your token is invalid or expired. Generate a new one from Yuque settings.
192
-
193
- **"Request failed with status 429"**
194
- Rate limited by Yuque API. Wait a moment and retry.
195
-
196
- **Tool not found**
197
- Make sure you're using the latest version: `npx -y yuque-mcp@latest`
198
-
199
- ## Contributing
200
-
201
- Contributions welcome! Please see [CONTRIBUTING.md](./CONTRIBUTING.md).
202
-
203
- ## Security
204
-
205
- For security issues, see [SECURITY.md](./SECURITY.md).
206
-
207
63
  ## License
208
64
 
209
65
  [MIT](./LICENSE)
210
66
 
211
67
  ## Links
212
68
 
213
- - [Yuque API Documentation](https://www.yuque.com/yuque/developer/api)
214
- - [Model Context Protocol](https://modelcontextprotocol.io/)
215
- - [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
69
+ - [Website](https://chen201724.github.io/yuque-ecosystem/) · [Yuque API Docs](https://www.yuque.com/yuque/developer/api) · [MCP Protocol](https://modelcontextprotocol.io/) · [Contributing](./CONTRIBUTING.md)
package/README.zh-CN.md CHANGED
@@ -1,231 +1,68 @@
1
- # 语雀 MCP 服务器
1
+ # Yuque MCP Server
2
2
 
3
+ [![CI](https://github.com/chen201724/yuque-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/chen201724/yuque-mcp-server/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/yuque-mcp)](https://www.npmjs.com/package/yuque-mcp)
3
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue.svg)](https://www.typescriptlang.org/)
5
- [![MCP](https://img.shields.io/badge/MCP-1.0-green.svg)](https://modelcontextprotocol.io/)
6
6
 
7
- 语雀 API 的官方品质 MCP (Model Context Protocol) 服务器。该服务器通过标准化的 MCP 接口向 AI 助手暴露语雀的知识库能力。
7
+ [语雀](https://www.yuque.com/) MCP Server 通过 [Model Context Protocol](https://modelcontextprotocol.io/) AI 助手访问你的语雀知识库。
8
8
 
9
- [English Documentation](./README.md)
10
-
11
- ## 特性
12
-
13
- - **完整 API 覆盖**:实现了全部 25 个语雀 API 端点
14
- - **双传输模式**:支持 stdio 和 streamable-http 两种传输方式
15
- - **类型安全**:完整的 TypeScript 实现,启用严格模式
16
- - **AI 优化**:响应格式设计旨在最小化 token 使用
17
- - **灵活认证**:支持环境变量或 CLI 参数认证
18
- - **完善测试**:使用 vitest 进行全面测试覆盖
19
- - **生产就绪**:遵循 Ant Design 开源标准
20
-
21
- ## 安装
22
-
23
- ```bash
24
- npm install -g yuque-mcp
25
- ```
26
-
27
- 或直接使用 npx:
28
-
29
- ```bash
30
- npx yuque-mcp --token=YOUR_TOKEN
31
- ```
9
+ 🌐 **[官网](https://chen201724.github.io/yuque-ecosystem/)** · [English](./README.md)
32
10
 
33
11
  ## 快速开始
34
12
 
35
13
  ### 1. 获取语雀 API Token
36
14
 
37
- 访问 [语雀设置](https://www.yuque.com/settings/tokens) 生成你的 API token
38
-
39
- ### 2. 运行服务器
40
-
41
- **Stdio 模式(用于 MCP 客户端):**
42
-
43
- ```bash
44
- export YUQUE_TOKEN=your_token_here
45
- yuque-mcp
46
- ```
47
-
48
- 或使用 CLI 参数:
49
-
50
- ```bash
51
- yuque-mcp --token=your_token_here
52
- ```
53
-
54
- **HTTP 模式(用于测试):**
55
-
56
- ```bash
57
- export YUQUE_TOKEN=your_token_here
58
- npm start
59
- ```
60
-
61
- 服务器默认运行在 `http://localhost:3000`。
62
-
63
- ## 可用工具
64
-
65
- ### 用户与团队 (2 个工具)
66
- - `yuque_get_user` - 获取当前用户信息
67
- - `yuque_list_groups` - 列出用户的团队
68
-
69
- ### 搜索 (1 个工具)
70
- - `yuque_search` - 搜索文档、知识库或用户
15
+ 前往 [语雀开发者设置](https://www.yuque.com/settings/tokens) 创建个人 Token
71
16
 
72
- ### 知识库 (5 个工具)
73
- - `yuque_list_repos` - 列出用户或团队的知识库
74
- - `yuque_get_repo` - 获取知识库详情
75
- - `yuque_create_repo` - 创建新知识库
76
- - `yuque_update_repo` - 更新知识库
77
- - `yuque_delete_repo` - 删除知识库
17
+ ### 2. 添加到 MCP 客户端
78
18
 
79
- ### 文档 (5 个工具)
80
- - `yuque_list_docs` - 列出知识库中的文档
81
- - `yuque_get_doc` - 获取文档完整内容
82
- - `yuque_create_doc` - 创建新文档
83
- - `yuque_update_doc` - 更新文档
84
- - `yuque_delete_doc` - 删除文档
85
-
86
- ### 目录 (2 个工具)
87
- - `yuque_get_toc` - 获取知识库目录
88
- - `yuque_update_toc` - 更新知识库目录
89
-
90
- ### 文档版本 (2 个工具)
91
- - `yuque_list_doc_versions` - 列出文档版本
92
- - `yuque_get_doc_version` - 获取特定版本
93
-
94
- ### 团队管理 (3 个工具)
95
- - `yuque_list_group_members` - 列出团队成员
96
- - `yuque_update_group_member` - 更新成员角色
97
- - `yuque_remove_group_member` - 移除成员
98
-
99
- ### 统计 (4 个工具)
100
- - `yuque_group_stats` - 团队统计
101
- - `yuque_group_member_stats` - 成员统计
102
- - `yuque_group_book_stats` - 知识库统计
103
- - `yuque_group_doc_stats` - 文档统计
104
-
105
- ### 工具 (1 个工具)
106
- - `yuque_hello` - 测试 API 连接
107
-
108
- ## Docker
19
+ #### Claude Code
109
20
 
110
21
  ```bash
111
- # 构建镜像
112
- docker build -t yuque-mcp .
113
-
114
- # 运行(stdio 模式)
115
- docker run --rm -i -e YUQUE_TOKEN=your_token yuque-mcp
22
+ claude mcp add yuque-mcp -- npx -y yuque-mcp --token=YOUR_TOKEN
116
23
  ```
117
24
 
118
- Docker 方式的 MCP 客户端配置:
119
-
120
- ```json
121
- {
122
- "mcpServers": {
123
- "yuque": {
124
- "command": "docker",
125
- "args": ["run", "--rm", "-i", "-e", "YUQUE_TOKEN", "yuque-mcp"],
126
- "env": {
127
- "YUQUE_TOKEN": "your_token_here"
128
- }
129
- }
130
- }
131
- }
132
- ```
133
-
134
- ## 配置
25
+ ### 3. 开始使用!
135
26
 
136
- ### 环境变量
27
+ AI 助手搜索语雀文档、创建文档、管理知识库。
137
28
 
138
- - `YUQUE_TOKEN` - 你的语雀 API token(必需)
139
- - `PORT` - HTTP 服务器端口(默认:3000,仅 HTTP 模式)
29
+ ## 可用工具(25 个)
140
30
 
141
- ### MCP 客户端配置
31
+ | 分类 | 工具 |
32
+ |------|------|
33
+ | **用户** | `yuque_get_user`、`yuque_list_groups` |
34
+ | **搜索** | `yuque_search` |
35
+ | **知识库** | `yuque_list_repos`、`yuque_get_repo`、`yuque_create_repo`、`yuque_update_repo`、`yuque_delete_repo` |
36
+ | **文档** | `yuque_list_docs`、`yuque_get_doc`、`yuque_create_doc`、`yuque_update_doc`、`yuque_delete_doc` |
37
+ | **目录** | `yuque_get_toc`、`yuque_update_toc` |
38
+ | **版本** | `yuque_list_doc_versions`、`yuque_get_doc_version` |
39
+ | **团队** | `yuque_list_group_members`、`yuque_update_group_member`、`yuque_remove_group_member` |
40
+ | **统计** | `yuque_group_stats`、`yuque_group_member_stats`、`yuque_group_book_stats`、`yuque_group_doc_stats` |
41
+ | **工具** | `yuque_hello` |
142
42
 
143
- 添加到你的 MCP 客户端配置(例如 Claude Desktop):
43
+ ## 常见问题
144
44
 
145
- ```json
146
- {
147
- "mcpServers": {
148
- "yuque": {
149
- "command": "yuque-mcp",
150
- "env": {
151
- "YUQUE_TOKEN": "your_token_here"
152
- }
153
- }
154
- }
155
- }
156
- ```
45
+ | 错误 | 解决方案 |
46
+ |------|----------|
47
+ | `YUQUE_TOKEN is required` | 传入 `--token=YOUR_TOKEN` 或设置 `YUQUE_TOKEN` 环境变量 |
48
+ | `401 Unauthorized` | Token 无效或过期 — 到[语雀设置](https://www.yuque.com/settings/tokens)重新生成 |
49
+ | `429 Rate Limited` | 请求过于频繁,等待后重试 |
157
50
 
158
51
  ## 开发
159
52
 
160
53
  ```bash
161
- # 克隆仓库
162
54
  git clone https://github.com/chen201724/yuque-mcp-server.git
163
55
  cd yuque-mcp-server
164
-
165
- # 安装依赖
166
56
  npm install
167
-
168
- # 运行测试
169
- npm test
170
-
171
- # 运行测试覆盖率
172
- npm run test:coverage
173
-
174
- # 构建
175
- npm run build
176
-
177
- # 开发模式(热重载)
178
- npm run dev
179
-
180
- # 代码检查
181
- npm run lint
182
-
183
- # 代码格式化
184
- npm run format
185
- ```
186
-
187
- ## 架构
188
-
189
- ```
190
- src/
191
- ├── index.ts — HTTP 服务器入口
192
- ├── cli.ts — CLI 入口(stdio)
193
- ├── server.ts — MCP 服务器核心
194
- ├── tools/ — 工具实现(按领域划分)
195
- │ ├── user.ts
196
- │ ├── repo.ts
197
- │ ├── doc.ts
198
- │ ├── toc.ts
199
- │ ├── search.ts
200
- │ ├── group.ts
201
- │ ├── stats.ts
202
- │ └── version.ts
203
- ├── services/
204
- │ ├── yuque-client.ts — 语雀 API 客户端
205
- │ └── types.ts — 类型定义
206
- └── utils/
207
- ├── format.ts — 响应格式化
208
- └── error.ts — 错误处理
57
+ npm test # 运行测试(57 个测试用例)
58
+ npm run build # 编译 TypeScript
59
+ npm run dev # 开发模式
209
60
  ```
210
61
 
211
- ## 贡献
212
-
213
- 我们欢迎贡献!详情请参阅 [CONTRIBUTING.md](./CONTRIBUTING.md)。
214
-
215
- ## 安全
216
-
217
- 安全问题请参阅 [SECURITY.md](./SECURITY.md)。
218
-
219
62
  ## 许可证
220
63
 
221
64
  [MIT](./LICENSE)
222
65
 
223
66
  ## 链接
224
67
 
225
- - [语雀 API 文档](https://www.yuque.com/yuque/developer/api)
226
- - [Model Context Protocol](https://modelcontextprotocol.io/)
227
- - [语雀官网](https://www.yuque.com/)
228
-
229
- ## 致谢
230
-
231
- 本项目受 [Notion MCP Server](https://github.com/makenotion/notion-mcp-server) 启发,遵循 Ant Design 开源标准。
68
+ - [官网](https://chen201724.github.io/yuque-ecosystem/) · [语雀 API 文档](https://www.yuque.com/yuque/developer/api) · [MCP 协议](https://modelcontextprotocol.io/) · [贡献指南](./CONTRIBUTING.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuque-mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "MCP server for Yuque (语雀) — expose Yuque knowledge base to AI assistants via Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",