dingtalk-wiki 1.1.1 → 1.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.
package/README.md CHANGED
@@ -38,36 +38,21 @@ All config goes into one JSON block — no local files needed:
38
38
  "env": {
39
39
  "DINGTALK_APP_KEY": "your-app-key",
40
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
- }
41
+ "DINGTALK_WIKI_CONFIG": "{\"defaultUser\":\"me\",\"users\":{\"me\":{\"userId\":\"your-user-id\"}}}"
54
42
  }
55
43
  }
56
44
  }
57
45
  }
58
46
  ```
59
47
 
60
- > `DINGTALK_WIKI_CONFIG` 支持两种写法:
61
- > - **JSON 对象**(如上)— MCP 客户端自动处理,**推荐**
62
- > - **JSON 字符串** — shell export 时必须用,如 `"{\"defaultUser\":\"me\",...}"`
63
48
 
64
- | env var | 说明 |
49
+ | env var | Description |
65
50
  |---------|------|
66
- | `DINGTALK_APP_KEY` | 钉钉应用 AppKey |
67
- | `DINGTALK_APP_SECRET` | 钉钉应用 AppSecret |
68
- | `DINGTALK_WIKI_CONFIG` | 用户/知识库配置(JSON),必填 |
51
+ | `DINGTALK_APP_KEY` | DingTalk App Key |
52
+ | `DINGTALK_APP_SECRET` | DingTalk App Secret |
53
+ | `DINGTALK_WIKI_CONFIG` | User/workspace config (JSON string), required |
69
54
 
70
- 首次调用时程序自动通过 `userId` 获取 `unionId` 并缓存到 `~/.cache/dingtalk-wiki-mcp/`,后续启动不再重复请求。
55
+ On first call the server auto-fetches `unionId` via `userId` and caches it to `~/.cache/dingtalk-wiki-mcp/`.
71
56
 
72
57
  Then call tools as `dingtalk-wiki.list_wiki_workspaces` (namespaced).
73
58
 
@@ -306,7 +291,6 @@ Please refer to DingTalk Open Platform documentation for the latest permission n
306
291
  - [Changelog](./CHANGELOG.md)
307
292
  - [API test notes](./API_TEST_REPORT.md)
308
293
  - [Skill definition](./skill/SKILL.md)
309
- - [Skill reference (Chinese)](./docs/skill-reference.md)
310
294
 
311
295
  ---
312
296
 
package/README.zh-CN.md CHANGED
@@ -38,34 +38,20 @@
38
38
  "env": {
39
39
  "DINGTALK_APP_KEY": "your-app-key",
40
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
- }
41
+ "DINGTALK_WIKI_CONFIG": "{\"defaultUser\":\"me\",\"users\":{\"me\":{\"userId\":\"your-user-id\"}}}"
54
42
  }
55
43
  }
56
44
  }
57
45
  }
58
46
  ```
59
47
 
60
- > `DINGTALK_WIKI_CONFIG` 支持两种写法:
61
- > - **JSON 对象**(如上)— MCP 客户端自动处理,**推荐**
62
- > - **JSON 字符串** — shell export 时必须用,如 `"{\"defaultUser\":\"me\",...}"`
48
+ > `DINGTALK_WIKI_CONFIG` 必须是 JSON **字符串**(MCP 客户端 env 字段只接受 string 类型)。
63
49
 
64
50
  | 环境变量 | 说明 |
65
51
  |---------|------|
66
52
  | `DINGTALK_APP_KEY` | 钉钉应用 AppKey |
67
53
  | `DINGTALK_APP_SECRET` | 钉钉应用 AppSecret |
68
- | `DINGTALK_WIKI_CONFIG` | 用户/知识库配置(JSON),必填 |
54
+ | `DINGTALK_WIKI_CONFIG` | 用户/知识库配置(JSON 字符串),必填 |
69
55
 
70
56
  首次调用时程序自动通过 `userId` 获取 `unionId` 并缓存到 `~/.cache/dingtalk-wiki-mcp/`,后续启动不再重复请求。
71
57
 
@@ -0,0 +1,18 @@
1
+ <svg width="1280" height="720" viewBox="0 0 1280 720" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="1280" height="720" rx="24" fill="#0B1020"/>
3
+ <rect x="40" y="40" width="1200" height="640" rx="20" fill="#111827" stroke="#334155"/>
4
+ <circle cx="84" cy="82" r="10" fill="#EF4444"/>
5
+ <circle cx="116" cy="82" r="10" fill="#F59E0B"/>
6
+ <circle cx="148" cy="82" r="10" fill="#10B981"/>
7
+ <text x="190" y="89" fill="#CBD5E1" font-size="24" font-family="ui-monospace, monospace">Demo 3 · Create a Wiki Document</text>
8
+ <text x="80" y="150" fill="#93C5FD" font-size="24" font-family="ui-monospace, monospace">$ mcporter call dingtalk-wiki.create_wiki_doc workspace_id="workspace_product_demo" name="Weekly Summary"</text>
9
+ <text x="80" y="225" fill="#86EFAC" font-size="22" font-family="ui-monospace, monospace">✅ Document created successfully</text>
10
+ <text x="80" y="285" fill="#E2E8F0" font-size="20" font-family="ui-monospace, monospace">📄 Weekly Summary</text>
11
+ <text x="120" y="330" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Node ID: node_weekly_summary_demo</text>
12
+ <text x="120" y="365" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">DocKey: doc_key_demo</text>
13
+ <text x="120" y="400" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Workspace ID: workspace_product_demo</text>
14
+ <text x="120" y="435" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: DOC</text>
15
+ <rect x="80" y="500" width="900" height="88" rx="12" fill="#0F172A" stroke="#1E293B"/>
16
+ <text x="110" y="548" fill="#93C5FD" font-size="18" font-family="ui-monospace, monospace">Typical follow-up: create DOC / WORKBOOK / MIND / FOLDER in the same workflow</text>
17
+ <text x="80" y="635" fill="#64748B" font-size="18" font-family="ui-monospace, monospace">Illustrative demo output for repository documentation</text>
18
+ </svg>
@@ -0,0 +1,20 @@
1
+ <svg width="1280" height="720" viewBox="0 0 1280 720" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="1280" height="720" rx="24" fill="#0B1020"/>
3
+ <rect x="40" y="40" width="1200" height="640" rx="20" fill="#111827" stroke="#334155"/>
4
+ <circle cx="84" cy="82" r="10" fill="#EF4444"/>
5
+ <circle cx="116" cy="82" r="10" fill="#F59E0B"/>
6
+ <circle cx="148" cy="82" r="10" fill="#10B981"/>
7
+ <text x="190" y="89" fill="#CBD5E1" font-size="24" font-family="ui-monospace, monospace">Demo 2 · Browse Workspace Nodes</text>
8
+ <text x="80" y="150" fill="#93C5FD" font-size="24" font-family="ui-monospace, monospace">$ mcporter call dingtalk-wiki.list_wiki_nodes workspace_id="workspace_product_demo"</text>
9
+ <text x="80" y="210" fill="#E2E8F0" font-size="22" font-family="ui-monospace, monospace">📄 Workspace nodes (4)</text>
10
+ <text x="80" y="265" fill="#FDE68A" font-size="20" font-family="ui-monospace, monospace">1. 📁 Weekly Reports</text>
11
+ <text x="120" y="300" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">ID: node_weekly_reports_demo</text>
12
+ <text x="120" y="330" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: FOLDER · Has children: yes</text>
13
+ <text x="80" y="390" fill="#A7F3D0" font-size="20" font-family="ui-monospace, monospace">2. 📄 Product Overview</text>
14
+ <text x="120" y="425" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">ID: node_product_overview_demo</text>
15
+ <text x="120" y="455" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: FILE · Has children: no</text>
16
+ <text x="80" y="515" fill="#A7F3D0" font-size="20" font-family="ui-monospace, monospace">3. 📄 Release Checklist</text>
17
+ <text x="120" y="550" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">ID: node_release_checklist_demo</text>
18
+ <text x="120" y="580" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: FILE · Has children: no</text>
19
+ <text x="80" y="635" fill="#64748B" font-size="18" font-family="ui-monospace, monospace">Illustrative demo output for repository documentation</text>
20
+ </svg>
@@ -0,0 +1,20 @@
1
+ <svg width="1280" height="720" viewBox="0 0 1280 720" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="1280" height="720" rx="24" fill="#0B1020"/>
3
+ <rect x="40" y="40" width="1200" height="640" rx="20" fill="#111827" stroke="#334155"/>
4
+ <circle cx="84" cy="82" r="10" fill="#EF4444"/>
5
+ <circle cx="116" cy="82" r="10" fill="#F59E0B"/>
6
+ <circle cx="148" cy="82" r="10" fill="#10B981"/>
7
+ <text x="190" y="89" fill="#CBD5E1" font-size="24" font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace">Demo 1 · List Wiki Workspaces</text>
8
+ <text x="80" y="150" fill="#93C5FD" font-size="24" font-family="ui-monospace, monospace">$ mcporter call dingtalk-wiki.list_wiki_workspaces</text>
9
+ <text x="80" y="210" fill="#E2E8F0" font-size="22" font-family="ui-monospace, monospace">📚 Wiki workspaces (3)</text>
10
+ <text x="80" y="260" fill="#A7F3D0" font-size="20" font-family="ui-monospace, monospace">1. Product Knowledge Base</text>
11
+ <text x="120" y="295" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">ID: workspace_product_demo</text>
12
+ <text x="120" y="325" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: TEAM</text>
13
+ <text x="80" y="385" fill="#A7F3D0" font-size="20" font-family="ui-monospace, monospace">2. Engineering Wiki</text>
14
+ <text x="120" y="420" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">ID: workspace_engineering_demo</text>
15
+ <text x="120" y="450" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: TEAM</text>
16
+ <text x="80" y="510" fill="#A7F3D0" font-size="20" font-family="ui-monospace, monospace">3. Operations Docs</text>
17
+ <text x="120" y="545" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">ID: workspace_ops_demo</text>
18
+ <text x="120" y="575" fill="#CBD5E1" font-size="18" font-family="ui-monospace, monospace">Type: TEAM</text>
19
+ <text x="80" y="635" fill="#64748B" font-size="18" font-family="ui-monospace, monospace">Illustrative demo output for repository documentation</text>
20
+ </svg>
package/index.js CHANGED
@@ -310,28 +310,6 @@ const server = new Server(
310
310
  server.setRequestHandler(ListToolsRequestSchema, async () => {
311
311
  return {
312
312
  tools: [
313
- {
314
- name: 'set_operator',
315
- description: '设置操作者 unionid(用于访问 Wiki API)',
316
- inputSchema: {
317
- type: 'object',
318
- properties: {
319
- unionid: {
320
- type: 'string',
321
- description: '用户的 unionid'
322
- }
323
- },
324
- required: ['unionid']
325
- }
326
- },
327
- {
328
- name: 'show_config',
329
- description: '显示当前配置信息(默认用户和知识库列表)',
330
- inputSchema: {
331
- type: 'object',
332
- properties: {}
333
- }
334
- },
335
313
  {
336
314
  name: 'list_wiki_workspaces',
337
315
  description: '列出用户有权限的知识库工作空间列表',
@@ -557,50 +535,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
557
535
 
558
536
  try {
559
537
  switch (name) {
560
- case 'set_operator': {
561
- const { unionid } = args;
562
- dingtalk.setOperatorId(unionid);
563
- return {
564
- content: [{
565
- type: 'text',
566
- text: `✅ 操作者已设置为: ${unionid}`
567
- }]
568
- };
569
- }
570
-
571
- case 'show_config': {
572
- let output = '⚙️ 当前配置信息\n\n';
573
-
574
- output += '👤 默认用户:\n';
575
- if (userConfig.defaultUser && userConfig.users) {
576
- const user = userConfig.users[userConfig.defaultUser];
577
- output += ` 姓名: ${user.name}\n`;
578
- output += ` User ID: ${user.userId}\n`;
579
- output += ` Union ID: ${user.unionId}\n`;
580
- } else {
581
- output += ' (未配置)\n';
582
- }
583
-
584
- output += '\n📚 知识库列表:\n';
585
- if (userConfig.workspaces) {
586
- Object.entries(userConfig.workspaces).forEach(([name, info], index) => {
587
- output += ` ${index + 1}. ${name}\n`;
588
- output += ` ID: ${info.id}\n`;
589
- });
590
- }
591
-
592
- output += '\n💡 使用提示:\n';
593
- output += ' - list_wiki_workspaces 和 list_wiki_nodes 会自动使用默认 operator_id\n';
594
- output += ' - 如需使用其他用户,可传入 operator_id 参数覆盖\n';
595
-
596
- return {
597
- content: [{
598
- type: 'text',
599
- text: output
600
- }]
601
- };
602
- }
603
-
604
538
  case 'list_wiki_workspaces': {
605
539
  if (args.operator_id) {
606
540
  dingtalk.setOperatorId(args.operator_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dingtalk-wiki",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "DingTalk Wiki / Docs read-write MCP server that fills the gap left by DingTalk official MCP.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -23,6 +23,7 @@
23
23
  "javascript"
24
24
  ],
25
25
  "files": [
26
+ "assets/",
26
27
  "skill/",
27
28
  "docs/",
28
29
  "index.js",
package/skill/SKILL.md CHANGED
@@ -17,40 +17,107 @@
17
17
  - `get_department_users` - 获取部门成员
18
18
  - `get_user_info` - 获取用户详情(包含 `unionid`)
19
19
 
20
- ### 配置管理
21
- - `set_operator` - 设置操作者 `unionid`
22
- - `show_config` - 显示当前配置信息
23
-
24
20
  ## 使用示例
25
21
 
26
- ### 查看当前配置
22
+ ### 查看所有工具
27
23
 
28
24
  ```bash
29
- mcporter call dingtalk-wiki.show_config
25
+ mcporter list dingtalk-wiki
30
26
  ```
31
27
 
32
- ### 列出知识库
28
+ ### 知识库管理
33
29
 
34
30
  ```bash
31
+ # 列出知识库工作空间
35
32
  mcporter call dingtalk-wiki.list_wiki_workspaces
36
- ```
37
33
 
38
- ### 获取某个知识库节点
34
+ # 获取知识库详情
35
+ mcporter call dingtalk-wiki.get_wiki_workspace workspace_id="your_workspace_id"
39
36
 
40
- ```bash
37
+ # 列出知识库节点(根目录)
41
38
  mcporter call dingtalk-wiki.list_wiki_nodes workspace_id="your_workspace_id"
42
- ```
43
39
 
44
- ### 创建文档
40
+ # 列出指定目录下的节点
41
+ mcporter call dingtalk-wiki.list_wiki_nodes workspace_id="your_workspace_id" parent_node_id="folder_node_id"
45
42
 
46
- ```bash
43
+ # 创建文档(默认 DOC)
47
44
  mcporter call dingtalk-wiki.create_wiki_doc \
48
45
  workspace_id="your_workspace_id" \
49
46
  name="新文档标题"
47
+
48
+ # 创建表格
49
+ mcporter call dingtalk-wiki.create_wiki_doc \
50
+ workspace_id="your_workspace_id" \
51
+ name="数据统计" \
52
+ doc_type="WORKBOOK"
53
+
54
+ # 创建脑图
55
+ mcporter call dingtalk-wiki.create_wiki_doc \
56
+ workspace_id="your_workspace_id" \
57
+ name="思维导图" \
58
+ doc_type="MIND"
59
+
60
+ # 创建文件夹
61
+ mcporter call dingtalk-wiki.create_wiki_doc \
62
+ workspace_id="your_workspace_id" \
63
+ name="项目文档" \
64
+ doc_type="FOLDER"
65
+
66
+ # 在指定目录下创建文档
67
+ mcporter call dingtalk-wiki.create_wiki_doc \
68
+ workspace_id="your_workspace_id" \
69
+ name="周报" \
70
+ parent_node_id="folder_node_id"
71
+
72
+ # 获取节点详情
73
+ mcporter call dingtalk-wiki.get_wiki_node node_id="your_node_id"
74
+
75
+ # 搜索知识库内容
76
+ mcporter call dingtalk-wiki.search_wiki keyword="项目规划"
77
+
78
+ # 在指定知识库内搜索
79
+ mcporter call dingtalk-wiki.search_wiki keyword="项目规划" workspace_id="your_workspace_id"
80
+ ```
81
+
82
+ ### AI 表格(Notable)
83
+
84
+ ```bash
85
+ # 获取 AI 表格的所有数据表(base_id 通常就是 nodeId)
86
+ mcporter call dingtalk-wiki.list_notable_sheets base_id="your_base_id"
87
+
88
+ # 获取数据表中的记录
89
+ mcporter call dingtalk-wiki.list_notable_records \
90
+ base_id="your_base_id" \
91
+ sheet_id="your_sheet_id"
92
+
93
+ # 指定返回条数(默认 20)
94
+ mcporter call dingtalk-wiki.list_notable_records \
95
+ base_id="your_base_id" \
96
+ sheet_id="your_sheet_id" \
97
+ max_results=100
98
+
99
+ # 分页获取
100
+ mcporter call dingtalk-wiki.list_notable_records \
101
+ base_id="your_base_id" \
102
+ sheet_id="your_sheet_id" \
103
+ next_token="your_next_token"
50
104
  ```
51
105
 
52
- ### 获取用户信息
106
+ ### 组织架构
53
107
 
54
108
  ```bash
109
+ # 列出根部门
110
+ mcporter call dingtalk-wiki.list_departments
111
+
112
+ # 列出指定部门下的子部门
113
+ mcporter call dingtalk-wiki.list_departments dept_id=123456
114
+
115
+ # 获取部门成员(默认每页 50 条)
116
+ mcporter call dingtalk-wiki.get_department_users dept_id=123456
117
+
118
+ # 分页获取部门成员
119
+ mcporter call dingtalk-wiki.get_department_users dept_id=123456 cursor=0 size=100
120
+
121
+ # 获取用户详情
55
122
  mcporter call dingtalk-wiki.get_user_info userid="your_user_id"
56
123
  ```
@@ -1,108 +0,0 @@
1
- # DingTalk Wiki MCP Server 参考文档
2
-
3
- 钉钉知识库 MCP Server,支持通过 MCP 协议读写钉钉 Wiki / Docs 内容。
4
-
5
- ## 功能特性
6
-
7
- ### 知识库管理
8
- - `list_wiki_workspaces` - 列出知识库工作空间列表
9
- - `get_wiki_workspace` - 获取知识库详情
10
- - `list_wiki_nodes` - 列出知识库节点(文档 / 目录)
11
- - `get_wiki_node` - 获取节点详情
12
- - `create_wiki_doc` - 创建文档(支持 `DOC` / `WORKBOOK` / `MIND` / `FOLDER`)
13
- - `search_wiki` - 搜索知识库内容
14
- - `list_notable_sheets` - 获取 `.able` / AI 表格中的所有数据表
15
- - `list_notable_records` - 获取指定数据表中的 records
16
-
17
- ### 组织架构
18
- - `list_departments` - 列出部门列表
19
- - `get_department_users` - 获取部门成员
20
- - `get_user_info` - 获取用户详情(包含 `unionid`)
21
-
22
- ### 配置管理
23
- - `set_operator` - 设置操作者 `unionid`
24
- - `show_config` - 显示当前配置信息
25
-
26
- ---
27
-
28
- ## 环境变量
29
-
30
- ```bash
31
- cp .env.example .env
32
- ```
33
-
34
- 填写:
35
-
36
- ```env
37
- DINGTALK_APP_KEY=your-app-key
38
- DINGTALK_APP_SECRET=your-app-secret
39
- ```
40
-
41
- 可选:
42
-
43
- ```env
44
- DINGTALK_WIKI_CONFIG_PATH=/absolute/path/to/config.json
45
- ```
46
-
47
- 如果不设置 `DINGTALK_WIKI_CONFIG_PATH`,程序默认读取当前目录下的 `config.json`。
48
-
49
- ---
50
-
51
- ## 配置文件
52
-
53
- 先复制示例配置:
54
-
55
- ```bash
56
- cp config.example.json config.json
57
- ```
58
-
59
- 然后填入你自己的:
60
- - 默认用户
61
- - userId / unionId
62
- - 常用 workspace 信息
63
-
64
- ---
65
-
66
- ## 配置文件格式
67
-
68
- ```json
69
- {
70
- "defaultUser": "your-default-user",
71
- "users": {
72
- "your-default-user": {
73
- "name": "Your Name",
74
- "userId": "your-user-id"
75
- }
76
- },
77
- "workspaces": {
78
- "Your Workspace": {
79
- "id": "your_workspace_id",
80
- "url": "https://alidocs.dingtalk.com/i/spaces/your-space-id/overview",
81
- "type": "TEAM"
82
- }
83
- },
84
- }
85
- ```
86
-
87
- ---
88
-
89
- ## API 端点
90
-
91
- - Wiki API v2.0: `https://api.dingtalk.com/v2.0/wiki`
92
- - 创建文档: `POST /v1.0/doc/workspaces/{workspaceId}/docs`
93
-
94
- ---
95
-
96
- ## 注意事项
97
-
98
- 1. `operator_id` 使用 DingTalk `unionId`
99
- 2. 不传 `operator_id` 时,默认使用配置文件中的默认用户
100
- 3. 只能访问当前账号有权限的知识库
101
- 4. `config.json` 不建议提交到 Git 仓库
102
-
103
- ---
104
-
105
- ## 相关链接
106
-
107
- - [钉钉开放平台 - 知识库概述](https://open.dingtalk.com/document/development/knowledge-base-overview)
108
- - [Create Team Space Document](https://open.dingtalk.com/document/development/create-team-space-document)