dingtalk-wiki 1.1.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/LICENSE +21 -0
- package/README.md +339 -0
- package/README.zh-CN.md +331 -0
- package/docs/clients/generic-mcp-client.md +20 -0
- package/docs/clients/mcporter.md +32 -0
- package/docs/clients/openclaw.md +31 -0
- package/docs/skill-reference.md +108 -0
- package/index.js +944 -0
- package/package.json +45 -0
- package/skill/SKILL.md +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ianen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
# dingtalk-wiki-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ianen/dingtalk-wiki-mcp/releases)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://github.com/ianen/dingtalk-wiki-mcp)
|
|
6
|
+
[](./package.json)
|
|
7
|
+
|
|
8
|
+
**DingTalk Wiki / Docs read-write MCP server that fills the gap left by DingTalk official MCP.**
|
|
9
|
+
|
|
10
|
+
[中文文档 / Chinese docs](./README.zh-CN.md)
|
|
11
|
+
|
|
12
|
+
> DingTalk's official MCP does **not** provide Wiki / Docs read-write capability.
|
|
13
|
+
> This project is an open-source complement that makes AI agents and MCP clients actually able to **read, browse, and create DingTalk Wiki / Docs content**.
|
|
14
|
+
|
|
15
|
+
## Repository Highlights
|
|
16
|
+
|
|
17
|
+
- **Official MCP gap**: Wiki / Docs read-write is not covered
|
|
18
|
+
- **This project adds it**: workspace browsing, node browsing, and document creation
|
|
19
|
+
- **MCP-compatible**: works with stdio-based MCP clients
|
|
20
|
+
- **Agent-ready**: includes `SKILL.md` for OpenClaw-style skill workflows
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## MCP 使用方法 / MCP Usage
|
|
25
|
+
|
|
26
|
+
This server runs over **stdio** and works with any MCP-compatible client (OpenClaw, mcporter, Claude Desktop, VS Code extensions, etc.).
|
|
27
|
+
|
|
28
|
+
### Option A: Configure in MCP client (recommended)
|
|
29
|
+
|
|
30
|
+
All config goes into one JSON block — no local files needed:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"dingtalk-wiki": {
|
|
36
|
+
"command": "node",
|
|
37
|
+
"args": ["/path/to/dingtalk-wiki-mcp/index.js"],
|
|
38
|
+
"env": {
|
|
39
|
+
"DINGTALK_APP_KEY": "your-app-key",
|
|
40
|
+
"DINGTALK_APP_SECRET": "your-app-secret",
|
|
41
|
+
"DINGTALK_WIKI_CONFIG": {
|
|
42
|
+
"defaultUser": "me",
|
|
43
|
+
"users": {
|
|
44
|
+
"me": { "name": "Your Name", "userId": "your-user-id" }
|
|
45
|
+
},
|
|
46
|
+
"workspaces": {
|
|
47
|
+
"My Workspace": {
|
|
48
|
+
"id": "your_workspace_id",
|
|
49
|
+
"url": "https://alidocs.dingtalk.com/i/spaces/.../overview",
|
|
50
|
+
"type": "TEAM"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
> `DINGTALK_WIKI_CONFIG` 支持两种写法:
|
|
61
|
+
> - **JSON 对象**(如上)— MCP 客户端自动处理,**推荐**
|
|
62
|
+
> - **JSON 字符串** — shell export 时必须用,如 `"{\"defaultUser\":\"me\",...}"`
|
|
63
|
+
|
|
64
|
+
| env var | 说明 |
|
|
65
|
+
|---------|------|
|
|
66
|
+
| `DINGTALK_APP_KEY` | 钉钉应用 AppKey |
|
|
67
|
+
| `DINGTALK_APP_SECRET` | 钉钉应用 AppSecret |
|
|
68
|
+
| `DINGTALK_WIKI_CONFIG` | 用户/知识库配置(JSON),必填 |
|
|
69
|
+
|
|
70
|
+
首次调用时程序自动通过 `userId` 获取 `unionId` 并缓存到 `~/.cache/dingtalk-wiki-mcp/`,后续启动不再重复请求。
|
|
71
|
+
|
|
72
|
+
Then call tools as `dingtalk-wiki.list_wiki_workspaces` (namespaced).
|
|
73
|
+
|
|
74
|
+
### Option B: Direct stdio mode (mcporter)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
mcporter call --stdio "node /path/to/index.js" list_wiki_workspaces
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Option C: Run standalone
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node index.js
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Then your MCP client connects via stdio.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Quick Start
|
|
91
|
+
|
|
92
|
+
### 1) Install
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm install
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2) Configure environment
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cp .env.example .env
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Required:
|
|
105
|
+
|
|
106
|
+
```env
|
|
107
|
+
DINGTALK_APP_KEY=your-app-key
|
|
108
|
+
DINGTALK_APP_SECRET=your-app-secret
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`index.js` now auto-loads `.env` from the current working directory (or the repo directory) if those variables are not already present in the environment.
|
|
112
|
+
|
|
113
|
+
### 3) Run
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pnpm start
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Or:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
node index.js
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
> `npx dingtalk-wiki-mcp` is a future-friendly path after npm publishing.
|
|
126
|
+
> This repository already includes the correct CLI entry (`bin`), but npm distribution is not part of the current release yet.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## DingTalk official MCP vs this project
|
|
131
|
+
|
|
132
|
+
| Capability | DingTalk official MCP | dingtalk-wiki-mcp |
|
|
133
|
+
| ------------------------------ | ----------------------------: | ----------------------: |
|
|
134
|
+
| Wiki read | Not covered | ✅ |
|
|
135
|
+
| Wiki write | Not covered | ✅ |
|
|
136
|
+
| Create docs | Not covered | ✅ |
|
|
137
|
+
| Create folders | Not covered | ✅ |
|
|
138
|
+
| Create mind maps | Not covered | ✅ |
|
|
139
|
+
| Browse workspaces | Not covered | ✅ |
|
|
140
|
+
| Browse nodes / folders | Not covered | ✅ |
|
|
141
|
+
| Read Notable / `.able` records | Not covered | ✅ |
|
|
142
|
+
| MCP client compatibility | Partial / official scope only | ✅ stdio MCP-compatible |
|
|
143
|
+
| OpenClaw skill packaging | No | ✅ includes `SKILL.md` |
|
|
144
|
+
|
|
145
|
+
**Positioning principle:** this project does **not** replace the official DingTalk MCP. It **complements** it by filling the Wiki / Docs gap.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Core capabilities
|
|
150
|
+
|
|
151
|
+
### Wiki / Docs
|
|
152
|
+
|
|
153
|
+
- List Wiki workspaces
|
|
154
|
+
- Get workspace details
|
|
155
|
+
- List Wiki nodes (folders / docs)
|
|
156
|
+
- Create:
|
|
157
|
+
- `DOC`
|
|
158
|
+
- `WORKBOOK`
|
|
159
|
+
- `MIND`
|
|
160
|
+
- `FOLDER`
|
|
161
|
+
- Search Wiki by linking to DingTalk search
|
|
162
|
+
- Read Notable / `.able` sheets and records via official API
|
|
163
|
+
|
|
164
|
+
### Organization
|
|
165
|
+
|
|
166
|
+
- List departments
|
|
167
|
+
- List department users
|
|
168
|
+
- Get user info
|
|
169
|
+
|
|
170
|
+
### Operator / Config
|
|
171
|
+
|
|
172
|
+
- Set current operator (`unionId`)
|
|
173
|
+
- Use a default operator from local config
|
|
174
|
+
- Inspect current local config
|
|
175
|
+
|
|
176
|
+
### Skill included
|
|
177
|
+
|
|
178
|
+
This repo is not only an MCP server. It also includes:
|
|
179
|
+
|
|
180
|
+
- `SKILL.md`
|
|
181
|
+
|
|
182
|
+
So it can be reused as a **skill package** in OpenClaw-style agent workflows.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Demo
|
|
187
|
+
|
|
188
|
+
### 1. List Wiki workspaces
|
|
189
|
+
|
|
190
|
+

|
|
191
|
+
|
|
192
|
+
### 2. Browse workspace nodes
|
|
193
|
+
|
|
194
|
+

|
|
195
|
+
|
|
196
|
+
### 3. Create a document
|
|
197
|
+
|
|
198
|
+

|
|
199
|
+
|
|
200
|
+
> These demo images are illustrative documentation assets built from representative command/output flows, with all tenant-specific data removed.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Real use cases
|
|
205
|
+
|
|
206
|
+
### 1) AI automatically creates weekly report docs
|
|
207
|
+
|
|
208
|
+
Your AI agent can create a fresh DingTalk Wiki document every week for sales, product, or ops reporting.
|
|
209
|
+
|
|
210
|
+
### 2) Agent explores Wiki structure before writing
|
|
211
|
+
|
|
212
|
+
Before generating content, an agent can inspect workspaces and folders first, then choose the right target node.
|
|
213
|
+
|
|
214
|
+
### 3) Auto-initialize project knowledge-base structure
|
|
215
|
+
|
|
216
|
+
When a new project starts, automation can create a standard folder tree such as:
|
|
217
|
+
|
|
218
|
+
- Project Overview
|
|
219
|
+
- Weekly Reports
|
|
220
|
+
- Specs
|
|
221
|
+
- Release Notes
|
|
222
|
+
- Retrospectives
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Client integration examples
|
|
227
|
+
|
|
228
|
+
- [OpenClaw example](./docs/clients/openclaw.md)
|
|
229
|
+
- [mcporter example](./docs/clients/mcporter.md)
|
|
230
|
+
- [Generic MCP client example](./docs/clients/generic-mcp-client.md)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Example usage
|
|
235
|
+
|
|
236
|
+
### Registered server mode
|
|
237
|
+
|
|
238
|
+
If you have registered this server in your MCP client config under the name `dingtalk-wiki`:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
mcporter call dingtalk-wiki.show_config
|
|
242
|
+
mcporter call dingtalk-wiki.list_wiki_workspaces
|
|
243
|
+
mcporter call dingtalk-wiki.list_wiki_nodes workspace_id="your_workspace_id"
|
|
244
|
+
mcporter call dingtalk-wiki.create_wiki_doc workspace_id="your_workspace_id" name="Weekly Summary" doc_type="DOC"
|
|
245
|
+
mcporter call dingtalk-wiki.get_user_info userid="your_user_id"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Direct stdio mode
|
|
249
|
+
|
|
250
|
+
If you want to run the server directly without pre-registering it, call the tool names directly:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
mcporter call --stdio "node ./index.js" show_config
|
|
254
|
+
mcporter call --stdio "node ./index.js" list_wiki_workspaces
|
|
255
|
+
mcporter call --stdio "node ./index.js" list_wiki_nodes workspace_id="your_workspace_id"
|
|
256
|
+
mcporter call --stdio "node ./index.js" create_wiki_doc workspace_id="your_workspace_id" name="Weekly Summary" doc_type="DOC"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Available MCP tools
|
|
262
|
+
|
|
263
|
+
- `set_operator`
|
|
264
|
+
- `show_config`
|
|
265
|
+
- `list_wiki_workspaces`
|
|
266
|
+
- `get_wiki_workspace`
|
|
267
|
+
- `list_wiki_nodes`
|
|
268
|
+
- `get_wiki_node`
|
|
269
|
+
- `create_wiki_doc`
|
|
270
|
+
- `search_wiki`
|
|
271
|
+
- `list_departments`
|
|
272
|
+
- `get_department_users`
|
|
273
|
+
- `get_user_info`
|
|
274
|
+
- `list_notable_sheets`
|
|
275
|
+
- `list_notable_records`
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Requirements
|
|
280
|
+
|
|
281
|
+
- Node.js 18+
|
|
282
|
+
- A DingTalk app with the required API permissions
|
|
283
|
+
- A stdio-compatible MCP client, such as:
|
|
284
|
+
- OpenClaw
|
|
285
|
+
- mcporter
|
|
286
|
+
- other MCP hosts / clients
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Permissions
|
|
291
|
+
|
|
292
|
+
Depending on what you use, your DingTalk app may need permissions such as:
|
|
293
|
+
|
|
294
|
+
- `Document.WorkspaceDocument.Write`
|
|
295
|
+
- Wiki read permissions
|
|
296
|
+
- Department read permissions
|
|
297
|
+
- User read permissions
|
|
298
|
+
|
|
299
|
+
Please refer to DingTalk Open Platform documentation for the latest permission names and approval requirements.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Trust materials
|
|
304
|
+
|
|
305
|
+
- [FAQ](./FAQ.md)
|
|
306
|
+
- [Changelog](./CHANGELOG.md)
|
|
307
|
+
- [API test notes](./API_TEST_REPORT.md)
|
|
308
|
+
- [Skill definition](./skill/SKILL.md)
|
|
309
|
+
- [Skill reference (Chinese)](./docs/skill-reference.md)
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Security notes
|
|
314
|
+
|
|
315
|
+
- This repository ignores `.env`
|
|
316
|
+
- inject AppKey / AppSecret via environment variables instead of hardcoding them
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Limitations
|
|
321
|
+
|
|
322
|
+
- This is a community-maintained complement, not an official DingTalk project
|
|
323
|
+
- Some APIs require enterprise approval on the DingTalk side
|
|
324
|
+
- `search_wiki` is currently more of a search-entry helper than a full-text search implementation
|
|
325
|
+
- Reading normal DingTalk document body content via official public API is still not implemented in this project
|
|
326
|
+
- Notable / `.able` support currently covers sheets and records, not arbitrary document-body export
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Related links
|
|
331
|
+
|
|
332
|
+
- [DingTalk Open Platform - Knowledge Base Overview](https://open.dingtalk.com/document/development/knowledge-base-overview)
|
|
333
|
+
- [Create Team Space Document](https://open.dingtalk.com/document/development/create-team-space-document)
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## License
|
|
338
|
+
|
|
339
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# dingtalk-wiki-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ianen/dingtalk-wiki-mcp/releases)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
[](https://github.com/ianen/dingtalk-wiki-mcp)
|
|
6
|
+
[](./package.json)
|
|
7
|
+
|
|
8
|
+
**一个补足钉钉官方 MCP 空白的开源项目:让 AI / MCP 客户端真正读写钉钉 Wiki / Docs。**
|
|
9
|
+
|
|
10
|
+
[English docs](./README.md)
|
|
11
|
+
|
|
12
|
+
> 钉钉官方 MCP 目前**没有提供 Wiki / Docs 读写能力**。
|
|
13
|
+
> 这个项目专门补上这一块,让 AI Agent 和 MCP 客户端可以真正做到:**浏览工作空间、浏览目录节点、创建文档 / 文件夹 / 脑图**。
|
|
14
|
+
|
|
15
|
+
## 仓库要点
|
|
16
|
+
|
|
17
|
+
- **官方 MCP 有空白**:没有覆盖 Wiki / Docs 读写
|
|
18
|
+
- **这个项目补上了**:支持 workspace、node 浏览和文档创建
|
|
19
|
+
- **MCP 兼容**:兼容 stdio 模式的 MCP client
|
|
20
|
+
- **Agent 友好**:自带 `SKILL.md`,可直接作为 skill 复用
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## MCP 使用方法
|
|
25
|
+
|
|
26
|
+
本服务通过 **stdio** 运行,兼容任何 MCP 客户端(OpenClaw、mcporter、Claude Desktop、VS Code 扩展等)。
|
|
27
|
+
|
|
28
|
+
### 方式 A:配置到 MCP 客户端(推荐)
|
|
29
|
+
|
|
30
|
+
所有配置集中在一个 JSON 块中,无需额外本地文件:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"dingtalk-wiki": {
|
|
36
|
+
"command": "node",
|
|
37
|
+
"args": ["/path/to/dingtalk-wiki-mcp/index.js"],
|
|
38
|
+
"env": {
|
|
39
|
+
"DINGTALK_APP_KEY": "your-app-key",
|
|
40
|
+
"DINGTALK_APP_SECRET": "your-app-secret",
|
|
41
|
+
"DINGTALK_WIKI_CONFIG": {
|
|
42
|
+
"defaultUser": "me",
|
|
43
|
+
"users": {
|
|
44
|
+
"me": { "name": "Your Name", "userId": "your-user-id" }
|
|
45
|
+
},
|
|
46
|
+
"workspaces": {
|
|
47
|
+
"My Workspace": {
|
|
48
|
+
"id": "your_workspace_id",
|
|
49
|
+
"url": "https://alidocs.dingtalk.com/i/spaces/.../overview",
|
|
50
|
+
"type": "TEAM"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
> `DINGTALK_WIKI_CONFIG` 支持两种写法:
|
|
61
|
+
> - **JSON 对象**(如上)— MCP 客户端自动处理,**推荐**
|
|
62
|
+
> - **JSON 字符串** — shell export 时必须用,如 `"{\"defaultUser\":\"me\",...}"`
|
|
63
|
+
|
|
64
|
+
| 环境变量 | 说明 |
|
|
65
|
+
|---------|------|
|
|
66
|
+
| `DINGTALK_APP_KEY` | 钉钉应用 AppKey |
|
|
67
|
+
| `DINGTALK_APP_SECRET` | 钉钉应用 AppSecret |
|
|
68
|
+
| `DINGTALK_WIKI_CONFIG` | 用户/知识库配置(JSON),必填 |
|
|
69
|
+
|
|
70
|
+
首次调用时程序自动通过 `userId` 获取 `unionId` 并缓存到 `~/.cache/dingtalk-wiki-mcp/`,后续启动不再重复请求。
|
|
71
|
+
|
|
72
|
+
之后以 `dingtalk-wiki.工具名` 的方式调用(如 `dingtalk-wiki.list_wiki_workspaces`)。
|
|
73
|
+
|
|
74
|
+
### 方式 B:直接 stdio 模式(mcporter)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
mcporter call --stdio "node /path/to/index.js" list_wiki_workspaces
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 方式 C:独立启动
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node index.js
|
|
84
|
+
```
|
|
85
|
+
MCP 客户端通过 stdio 连接即可。
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 快速开始
|
|
90
|
+
|
|
91
|
+
### 1)安装依赖
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm install
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2)配置环境变量
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
cp .env.example .env
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
必填:
|
|
104
|
+
|
|
105
|
+
```env
|
|
106
|
+
DINGTALK_APP_KEY=your-app-key
|
|
107
|
+
DINGTALK_APP_SECRET=your-app-secret
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
现在 `index.js` 会在环境变量未显式设置时,自动加载当前工作目录(或仓库目录)下的 `.env`。
|
|
111
|
+
|
|
112
|
+
### 3)运行
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm start
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
或者:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
node index.js
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
> `npx dingtalk-wiki-mcp` 是后续可扩展的分发路径。
|
|
125
|
+
> 当前仓库已经具备正确的 CLI 入口(`bin`),但 npm 发布不在这次版本范围内。
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 官方 DingTalk MCP vs 本项目
|
|
130
|
+
|
|
131
|
+
| 能力 | 钉钉官方 MCP | dingtalk-wiki-mcp |
|
|
132
|
+
|---|---:|---:|
|
|
133
|
+
| Wiki 读取 | 未覆盖 | ✅ |
|
|
134
|
+
| Wiki 写入 | 未覆盖 | ✅ |
|
|
135
|
+
| 创建 docs | 未覆盖 | ✅ |
|
|
136
|
+
| 创建 folder | 未覆盖 | ✅ |
|
|
137
|
+
| 创建 mind map | 未覆盖 | ✅ |
|
|
138
|
+
| 浏览 workspace | 未覆盖 | ✅ |
|
|
139
|
+
| 浏览 nodes / 目录 | 未覆盖 | ✅ |
|
|
140
|
+
| 读取 Notable / `.able` 记录 | 未覆盖 | ✅ |
|
|
141
|
+
| MCP 客户端兼容性 | 官方范围内 | ✅ stdio 兼容 |
|
|
142
|
+
| OpenClaw skill 化复用 | 无 | ✅ 自带 `SKILL.md` |
|
|
143
|
+
|
|
144
|
+
**定位原则:**本项目不是替代官方 MCP,而是**补足官方没覆盖的 Wiki / Docs 能力**。
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 核心能力
|
|
149
|
+
|
|
150
|
+
### Wiki / Docs
|
|
151
|
+
- 列出 Wiki 工作空间
|
|
152
|
+
- 获取工作空间详情
|
|
153
|
+
- 列出 Wiki 节点(目录 / 文档)
|
|
154
|
+
- 创建:
|
|
155
|
+
- `DOC`
|
|
156
|
+
- `WORKBOOK`
|
|
157
|
+
- `MIND`
|
|
158
|
+
- `FOLDER`
|
|
159
|
+
- 提供跳转式 Wiki 搜索能力
|
|
160
|
+
- 通过官方 API 读取 Notable / `.able` 的数据表和记录
|
|
161
|
+
|
|
162
|
+
### 组织架构
|
|
163
|
+
- 列出部门
|
|
164
|
+
- 列出部门成员
|
|
165
|
+
- 获取用户信息
|
|
166
|
+
|
|
167
|
+
### 操作者 / 配置
|
|
168
|
+
- 设置当前操作者(`unionId`)
|
|
169
|
+
- 使用本地默认操作者
|
|
170
|
+
- 查看当前本地配置
|
|
171
|
+
|
|
172
|
+
### 自带 skill
|
|
173
|
+
这个仓库不仅是 MCP Server,还自带:
|
|
174
|
+
|
|
175
|
+
- `SKILL.md`
|
|
176
|
+
|
|
177
|
+
所以它也可以作为 **OpenClaw 风格 agent 工作流中的 skill 包** 来复用。
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Demo
|
|
182
|
+
|
|
183
|
+
### 1)列出知识库工作空间
|
|
184
|
+
|
|
185
|
+

|
|
186
|
+
|
|
187
|
+
### 2)浏览知识库目录节点
|
|
188
|
+
|
|
189
|
+

|
|
190
|
+
|
|
191
|
+
### 3)创建文档
|
|
192
|
+
|
|
193
|
+

|
|
194
|
+
|
|
195
|
+
> 这些 Demo 图是基于典型命令与输出流程制作的说明型素材,所有租户相关数据都已移除。
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 真实使用场景
|
|
200
|
+
|
|
201
|
+
### 1)AI 自动创建周报文档
|
|
202
|
+
让 Agent 按周在钉钉知识库中自动创建销售、产品或运营周报文档。
|
|
203
|
+
|
|
204
|
+
### 2)Agent 写入前先浏览知识库结构
|
|
205
|
+
在生成内容之前,先读取 workspace / folder 结构,找到正确目录后再写入。
|
|
206
|
+
|
|
207
|
+
### 3)自动初始化项目知识库目录
|
|
208
|
+
新项目开始时,自动生成标准目录结构,例如:
|
|
209
|
+
|
|
210
|
+
- Project Overview
|
|
211
|
+
- Weekly Reports
|
|
212
|
+
- Specs
|
|
213
|
+
- Release Notes
|
|
214
|
+
- Retrospectives
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 客户端接入示例
|
|
219
|
+
|
|
220
|
+
- [OpenClaw 示例](./docs/clients/openclaw.md)
|
|
221
|
+
- [mcporter 示例](./docs/clients/mcporter.md)
|
|
222
|
+
- [通用 MCP client 示例](./docs/clients/generic-mcp-client.md)
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 示例用法
|
|
227
|
+
|
|
228
|
+
### 已注册 server 模式
|
|
229
|
+
|
|
230
|
+
如果你已经在 MCP client 里把这个 server 注册为 `dingtalk-wiki`:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
mcporter call dingtalk-wiki.show_config
|
|
234
|
+
mcporter call dingtalk-wiki.list_wiki_workspaces
|
|
235
|
+
mcporter call dingtalk-wiki.list_wiki_nodes workspace_id="your_workspace_id"
|
|
236
|
+
mcporter call dingtalk-wiki.create_wiki_doc workspace_id="your_workspace_id" name="Weekly Summary" doc_type="DOC"
|
|
237
|
+
mcporter call dingtalk-wiki.get_user_info userid="your_user_id"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### 直接 stdio 模式
|
|
241
|
+
|
|
242
|
+
如果你不想预先注册 server,而是直接拉起它,那么工具名直接写裸工具名:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
mcporter call --stdio "node ./index.js" show_config
|
|
246
|
+
mcporter call --stdio "node ./index.js" list_wiki_workspaces
|
|
247
|
+
mcporter call --stdio "node ./index.js" list_wiki_nodes workspace_id="your_workspace_id"
|
|
248
|
+
mcporter call --stdio "node ./index.js" create_wiki_doc workspace_id="your_workspace_id" name="Weekly Summary" doc_type="DOC"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 可用 MCP 工具
|
|
254
|
+
|
|
255
|
+
- `set_operator`
|
|
256
|
+
- `show_config`
|
|
257
|
+
- `list_wiki_workspaces`
|
|
258
|
+
- `get_wiki_workspace`
|
|
259
|
+
- `list_wiki_nodes`
|
|
260
|
+
- `get_wiki_node`
|
|
261
|
+
- `create_wiki_doc`
|
|
262
|
+
- `search_wiki`
|
|
263
|
+
- `list_departments`
|
|
264
|
+
- `get_department_users`
|
|
265
|
+
- `get_user_info`
|
|
266
|
+
- `list_notable_sheets`
|
|
267
|
+
- `list_notable_records`
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## 环境要求
|
|
272
|
+
|
|
273
|
+
- Node.js 18+
|
|
274
|
+
- 一个具备相关 API 权限的钉钉应用
|
|
275
|
+
- 一个支持 stdio 的 MCP client,例如:
|
|
276
|
+
- OpenClaw
|
|
277
|
+
- mcporter
|
|
278
|
+
- 其他 MCP Host / Client
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 权限说明
|
|
283
|
+
|
|
284
|
+
根据你的使用范围,钉钉应用可能需要这些权限:
|
|
285
|
+
|
|
286
|
+
- `Document.WorkspaceDocument.Write`
|
|
287
|
+
- Wiki 读取权限
|
|
288
|
+
- 部门读取权限
|
|
289
|
+
- 用户读取权限
|
|
290
|
+
|
|
291
|
+
请以钉钉开放平台最新文档和审批要求为准。
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 信任材料
|
|
296
|
+
|
|
297
|
+
- [FAQ](./FAQ.md)
|
|
298
|
+
- [Changelog](./CHANGELOG.md)
|
|
299
|
+
- [API 测试说明](./API_TEST_REPORT.md)
|
|
300
|
+
- [Skill 定义](./SKILL.md)
|
|
301
|
+
- [Skill 参考文档](./docs/skill-reference.md)
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 安全说明
|
|
306
|
+
|
|
307
|
+
- 仓库已默认忽略 `.env`
|
|
308
|
+
- 建议通过环境变量注入 AppKey / AppSecret,而不是写死在代码里
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 限制说明
|
|
313
|
+
|
|
314
|
+
- 本项目是社区补充实现,不是钉钉官方项目
|
|
315
|
+
- 部分 API 需要企业侧权限审批
|
|
316
|
+
- `search_wiki` 当前更偏向“跳转辅助”,不是完整全文检索实现
|
|
317
|
+
- 目前项目仍未实现通过官方公开 API 读取普通 DingTalk 文档正文
|
|
318
|
+
- 当前 Notable / `.able` 支持的是数据表和 records 读取,不是任意正文导出
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 相关链接
|
|
323
|
+
|
|
324
|
+
- [钉钉开放平台 - 知识库概述](https://open.dingtalk.com/document/development/knowledge-base-overview)
|
|
325
|
+
- [创建团队空间文档](https://open.dingtalk.com/document/development/create-team-space-document)
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## License
|
|
330
|
+
|
|
331
|
+
MIT
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Generic MCP Client Example
|
|
2
|
+
|
|
3
|
+
Many MCP clients support stdio-based servers with a configuration block similar to this:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"dingtalk-wiki": {
|
|
9
|
+
"command": "node",
|
|
10
|
+
"args": ["/absolute/path/to/dingtalk-wiki-mcp/index.js"],
|
|
11
|
+
"env": {
|
|
12
|
+
"DINGTALK_APP_KEY": "your-app-key",
|
|
13
|
+
"DINGTALK_APP_SECRET": "your-app-secret"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If your client supports environment-file injection, you can also keep secrets in `.env` instead of embedding them directly.
|