dingtalk-mcp 1.1.3 → 1.1.4

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
@@ -12,6 +12,7 @@
12
12
  - 钉钉工作通知
13
13
  - 钉钉应用管理
14
14
  - 钉钉服务窗
15
+ - 钉钉项目管理
15
16
 
16
17
  ## 如何使用
17
18
  ```json
@@ -37,18 +38,19 @@
37
38
  2. DINGTALK_Client_Secret
38
39
  3. ACTIVE_PROFILES,激活哪些钉钉MCP服务,逗号风格,如果是ALL则激活全部。可选集合
39
40
 
40
- | ProfileId | Description | Permission |
41
- |--------------------------|--------------------|-------------------------------------------------|
42
- | dingtalk-contacts | 钉钉通讯录,默认激活 |
43
- | dingtalk-department | 钉钉部门管理 |
41
+ | ProfileId | Description | Permission |
42
+ |-----------------------------|--------------------|-------------------------------------------------|
43
+ | dingtalk-contacts | 钉钉通讯录,默认激活 |
44
+ | dingtalk-department | 钉钉部门管理 |
44
45
  | dingtalk-robot-send-message | 钉钉机器人发消息/DING,默认激活 | 需要企业内机器人发送消息权限 |
45
- | dingtalk-honor | 钉钉企业文化荣誉 |
46
- | dingtalk-tasks | 钉钉待办 | Todo.Todo.Write<br>Todo.Todo.Read |
47
- | dingtalk-calendar | 钉钉日程 |
48
- | dingtalk-checkin | 钉钉签到 |
49
- | dingtalk-notice | 钉钉工作通知 |
50
- | dingtalk-app-manage | 钉钉应用管理 | qyapi_microapp_manage<br>qyapi_get_microapp_list |
51
- | dingtalk-service-window | 钉钉服务窗 | |
46
+ | dingtalk-honor | 钉钉企业文化荣誉 |
47
+ | dingtalk-tasks | 钉钉待办 | Todo.Todo.Write<br>Todo.Todo.Read |
48
+ | dingtalk-calendar | 钉钉日程 |
49
+ | dingtalk-checkin | 钉钉签到 |
50
+ | dingtalk-notice | 钉钉工作通知 |
51
+ | dingtalk-app-manage | 钉钉应用管理 | qyapi_microapp_manage<br>qyapi_get_microapp_list |
52
+ | dingtalk-service-window | 钉钉服务窗 | |
53
+ | dingtalk-teambition | 钉钉项目管理 | |
52
54
 
53
55
  4. ROBOT_CODE,用于发消息/DING的机器人Code
54
56
  5. ROBOT_ACCESS_TOKEN,群自定义机器人ACCESS_TOKEN,用于自定义机器人发消息
@@ -0,0 +1,360 @@
1
+ server:
2
+ name: dingtalk-teambition
3
+ description: 钉钉Teambition-项目管理
4
+ tools:
5
+
6
+ - name: createProject
7
+ description: 创建项目
8
+ requestTemplate:
9
+ method: POST
10
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projects
11
+ args:
12
+ - name: userId
13
+ description: 操作者userId。
14
+ type: string
15
+ required: true
16
+ position: path
17
+ - name: name
18
+ description: 项目名称。
19
+ type: string
20
+ required: true
21
+ position: body
22
+
23
+
24
+ - name: queryProjectsByProjectName
25
+ description: 根据项目名称模糊查询项目信息
26
+ requestTemplate:
27
+ method: POST
28
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projects/query
29
+ args:
30
+ - name: userId
31
+ description: 操作者userId。
32
+ type: string
33
+ required: true
34
+ position: path
35
+ - name: name
36
+ description: 项目名称,模糊查询指定项目名称的项目信息
37
+ type: string
38
+ required: true
39
+ position: body
40
+ - name: maxResults
41
+ description: 分页大小,默认10,最大300
42
+ type: number
43
+ required: false
44
+ position: body
45
+ - name: nextToken
46
+ description: 分页标。供分页使用,下一页token,从当前查询结果中获取。
47
+ type: string
48
+ required: false
49
+ position: body
50
+
51
+ - name: queryProjectStatusesByProjectId
52
+ description: 根据项目ID查询项目状态信息
53
+ requestTemplate:
54
+ method: GET
55
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projects/{projectId}/statuses
56
+ args:
57
+ - name: userId
58
+ description: 操作者userId。
59
+ type: string
60
+ required: true
61
+ position: path
62
+ - name: projectId
63
+ description: 项目ID。
64
+ type: string
65
+ required: true
66
+ position: path
67
+
68
+ - name: queryProjectMembersByProjectId
69
+ description: 根据项目ID查询项目成员信息
70
+ requestTemplate:
71
+ method: GET
72
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projects/{projectId}/members?maxResults={String}
73
+ args:
74
+ - name: userId
75
+ description: 操作者userId。
76
+ type: string
77
+ required: true
78
+ position: path
79
+ - name: projectId
80
+ description: 项目ID。
81
+ type: string
82
+ required: true
83
+ position: path
84
+ - name: maxResults
85
+ description: 分页大小,默认10,最大300
86
+ type: number
87
+ required: false
88
+ position: query
89
+
90
+ - name: addProjectMembers
91
+ description: 添加项目成员
92
+ requestTemplate:
93
+ method: POST
94
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projects/{projectId}/members
95
+ args:
96
+ - name: userId
97
+ description: 操作者userId。
98
+ type: string
99
+ required: true
100
+ position: path
101
+ - name: projectId
102
+ description: 项目ID。
103
+ type: string
104
+ required: true
105
+ position: path
106
+ - name: userIds
107
+ description: 被添加的用户userId列表,建议一次不超过10个。
108
+ type: array
109
+ required: true
110
+ position: body
111
+ items:
112
+ type: string
113
+
114
+ - name: removeProjectMembers
115
+ description: 添加项目成员
116
+ requestTemplate:
117
+ method: POST
118
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projects/{projectId}/members/remove
119
+ args:
120
+ - name: userId
121
+ description: 操作者userId。
122
+ type: string
123
+ required: true
124
+ position: path
125
+ - name: projectId
126
+ description: 项目ID。
127
+ type: string
128
+ required: true
129
+ position: path
130
+ - name: userIds
131
+ description: 被删除的用户userId列表,建议一次不超过10个。
132
+ type: array
133
+ required: true
134
+ position: body
135
+ items:
136
+ type: string
137
+
138
+
139
+ # 项目任务
140
+ - name: listProjectTasks
141
+ description: 查询项目中的任务列表
142
+ requestTemplate:
143
+ method: GET
144
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/projectIds/{projectId}/tasks?nextToken=String&maxResults=Integer
145
+ args:
146
+ - name: userId
147
+ description: 操作者userId。
148
+ type: string
149
+ required: true
150
+ position: path
151
+ - name: projectId
152
+ description: 项目ID。
153
+ type: string
154
+ required: true
155
+ position: path
156
+ - name: nextToken
157
+ description: 分页游标。如果是首次调用,该参数不传。如果是非首次调用,该参数传上次接口返回的nextToken。
158
+ type: string
159
+ required: true
160
+ position: query
161
+ - name: maxResults
162
+ description: 每页返回最大数量。默认10,最大500。
163
+ type: number
164
+ required: false
165
+ position: query
166
+
167
+ - name: listUserProjectTasks
168
+ description: 查询用户项目任务信息列表
169
+ requestTemplate:
170
+ method: POST
171
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks/search?roleTypes=String&tql=String&nextToken=String&maxResults=String
172
+ args:
173
+ - name: userId
174
+ description: 操作者userId。
175
+ type: string
176
+ required: true
177
+ position: path
178
+ - name: roleTypes
179
+ description: 用户的任务角色。creator、executor、involveMember 中的一个或多个,多个以英文逗号拼接。例如:creator,executor
180
+ type: string
181
+ required: true
182
+ position: query
183
+ - name: nextToken
184
+ description: 分页游标。如果是首次调用,该参数不传。如果是非首次调用,该参数传上次接口返回的nextToken。
185
+ type: string
186
+ required: true
187
+ position: query
188
+ - name: maxResults
189
+ description: 每页返回最大数量。默认10,最大500。
190
+ type: number
191
+ required: false
192
+ position: query
193
+
194
+ - name: queryProjectTaskDetail
195
+ description: 查询项目任务详情
196
+ requestTemplate:
197
+ method: GET
198
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks?taskId=String
199
+ args:
200
+ - name: userId
201
+ description: 操作者userId。
202
+ type: string
203
+ required: true
204
+ position: path
205
+ - name: taskId
206
+ description: 项目任务ID
207
+ type: string
208
+ required: true
209
+ position: query
210
+
211
+ - name: createProjectTask
212
+ description: 创建项目任务
213
+ requestTemplate:
214
+ method: POST
215
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks
216
+ args:
217
+ - name: userId
218
+ description: 操作者userId。
219
+ type: string
220
+ required: true
221
+ position: path
222
+ - name: projectId
223
+ description: 项目id。
224
+ type: string
225
+ required: true
226
+ position: body
227
+ - name: content
228
+ description: 任务标题
229
+ type: string
230
+ required: true
231
+ position: body
232
+ - name: note
233
+ description: 任务备注
234
+ type: string
235
+ required: false
236
+ position: body
237
+ - name: startDate
238
+ description: 任务截止时间,格式:YYYY-MM-DDTHH:mm:ssZ(ISO 8601/RFC 3339)。
239
+ type: string
240
+ required: false
241
+ position: body
242
+ - name: dueDate
243
+ description: 任务开始时间,格式:YYYY-MM-DDTHH:mm:ssZ(ISO 8601/RFC 3339)。
244
+ type: string
245
+ required: false
246
+ position: body
247
+ - name: executorId
248
+ description: 任务执行者userId。
249
+ type: string
250
+ required: false
251
+ position: body
252
+
253
+ - name: deleteProjectTask
254
+ description: 删除项目任务
255
+ requestTemplate:
256
+ method: DELETE
257
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks/{taskId}
258
+ args:
259
+ - name: userId
260
+ description: 操作者userId。
261
+ type: string
262
+ required: true
263
+ position: path
264
+ - name: taskId
265
+ description: 任务ID
266
+ type: string
267
+ required: true
268
+ position: path
269
+
270
+
271
+ - name: updateProjectTaskNote
272
+ description: 更新项目任务备注
273
+ requestTemplate:
274
+ method: PUT
275
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks/{taskId}/notes
276
+ args:
277
+ - name: userId
278
+ description: 操作者userId。
279
+ type: string
280
+ required: true
281
+ position: path
282
+ - name: taskId
283
+ description: 任务ID。
284
+ type: string
285
+ required: true
286
+ position: path
287
+ - name: note
288
+ description: 任务备注
289
+ type: string
290
+ required: true
291
+ position: body
292
+
293
+ - name: updateProjectTaskContent
294
+ description: 更新项目任务标题
295
+ requestTemplate:
296
+ method: PUT
297
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks/{taskId}/contents
298
+ args:
299
+ - name: userId
300
+ description: 操作者userId。
301
+ type: string
302
+ required: true
303
+ position: path
304
+ - name: taskId
305
+ description: 任务ID。
306
+ type: string
307
+ required: true
308
+ position: path
309
+ - name: content
310
+ description: 任务标题
311
+ type: string
312
+ required: true
313
+ position: body
314
+
315
+ - name: updateProjectTaskExecutors
316
+ description: 更新项目任务执行者
317
+ requestTemplate:
318
+ method: PUT
319
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks/{taskId}/executors
320
+ args:
321
+ - name: userId
322
+ description: 操作者userId。
323
+ type: string
324
+ required: true
325
+ position: path
326
+ - name: taskId
327
+ description: 任务ID。
328
+ type: string
329
+ required: true
330
+ position: path
331
+ - name: executorId
332
+ description: 任务执行者userId
333
+ type: string
334
+ required: true
335
+ position: body
336
+
337
+
338
+ - name: updateProjectTaskInvolveMembers
339
+ description: 更新项目任务参与者
340
+ requestTemplate:
341
+ method: PUT
342
+ url: https://api.dingtalk.com/v1.0/project/users/{userId}/tasks/{taskId}/involveMembers
343
+ args:
344
+ - name: userId
345
+ description: 操作者userId。
346
+ type: string
347
+ required: true
348
+ position: path
349
+ - name: taskId
350
+ description: 任务ID。
351
+ type: string
352
+ required: true
353
+ position: path
354
+ - name: involveMembers
355
+ description: 任务参与者userId列表
356
+ type: array
357
+ required: true
358
+ position: body
359
+ items:
360
+ type: string
@@ -23,7 +23,11 @@ export class DingTalkMCPServer {
23
23
  this.debug = process.env.DEBUG;
24
24
  // Token缓存配置
25
25
  this.tokenCacheFile = path.join(__dirname, '..', '.dingtalk_token_cache.json');
26
- this.loadConfig();
26
+ this.loadConfig(path.join(__dirname, '..'));
27
+ // 测试状态
28
+ if (process.env.STAGING){
29
+ this.loadConfig(path.join(__dirname, '../staging'));
30
+ }
27
31
  this.server = new Server({
28
32
  name: 'Dingtalk MCP Server',
29
33
  description: "Dingtalk MCP Server, inclued tasks, contacts, calendar, robot etc.",
@@ -35,7 +39,7 @@ export class DingTalkMCPServer {
35
39
  this.loadTokenCache();
36
40
  this.setupHandlers();
37
41
  }
38
- loadConfig() {
42
+ loadConfig(dirname) {
39
43
  try {
40
44
  //激活的profile
41
45
  const profiles = process.env.ACTIVE_PROFILES;
@@ -44,7 +48,7 @@ export class DingTalkMCPServer {
44
48
  profiles_list = profiles.split(',');
45
49
  }
46
50
 
47
- const configDir = path.join(__dirname, '..');
51
+ const configDir = path.join(dirname);
48
52
  fs.readdirSync(configDir).forEach(
49
53
  (file) => {
50
54
  if (file.endsWith('mcp_server.yaml')) {
@@ -118,7 +122,7 @@ export class DingTalkMCPServer {
118
122
  * 检查token缓存是否有效(未过期)
119
123
  */
120
124
  isTokenCacheValid(cacheData) {
121
- if (!cacheData || !cacheData.access_token || !cacheData.expires_at) {
125
+ if (!cacheData || !cacheData.access_token || !cacheData.expires_at || cacheData.app_id !== this.appId) {
122
126
  return false;
123
127
  }
124
128
  // 提前5分钟刷新token,避免在请求过程中过期
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dingtalk-mcp",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "DingTalk MCP Server - A TypeScript-based MCP server for DingTalk integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -47,17 +47,17 @@
47
47
  "model-context-protocol",
48
48
  "tasks"
49
49
  ],
50
- "author": "Generated by openapi-to-mcp",
50
+ "author": "dingtalk",
51
51
  "license": "MIT",
52
52
  "engines": {
53
53
  "node": ">=16.0.0"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",
57
- "url": "git+https://github.com/yourusername/dingtalk-mcp.git"
57
+ "url": "https://github.com/open-dingtalk/dingtalk-mcp"
58
58
  },
59
59
  "bugs": {
60
- "url": "https://github.com/yourusername/dingtalk-mcp/issues"
60
+ "url": "https://github.com/open-dingtalk/dingtalk-mcp/issues"
61
61
  },
62
- "homepage": "https://github.com/yourusername/dingtalk-mcp#readme"
62
+ "homepage": "https://open.dingtalk.com/document/ai-dev/dingtalk-server-api-mcp-overview"
63
63
  }