dingtalk-mcp 1.0.0 → 1.0.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.
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
server:
|
|
2
|
+
name: dingtalk-contacts
|
|
3
|
+
description: 钉钉通讯录
|
|
4
|
+
default_active: true
|
|
5
|
+
securitySchemes:
|
|
6
|
+
- id: DingTalkAuth
|
|
7
|
+
type: apiKey
|
|
8
|
+
in: header
|
|
9
|
+
name: x-acs-dingtalk-access-token
|
|
10
|
+
tools:
|
|
11
|
+
- name: searchUser
|
|
12
|
+
description: 根据姓名搜索钉钉用户的userId。
|
|
13
|
+
args:
|
|
14
|
+
- name: queryWord
|
|
15
|
+
description: 搜索关键词,可以是用户姓名、姓名拼音或英文名称。
|
|
16
|
+
type: string
|
|
17
|
+
required: true
|
|
18
|
+
position: body
|
|
19
|
+
- name: offset
|
|
20
|
+
description: 分页偏移量,从0开始
|
|
21
|
+
type: number
|
|
22
|
+
position: body
|
|
23
|
+
- name: size
|
|
24
|
+
description: 分页大小,最大50
|
|
25
|
+
type: number
|
|
26
|
+
position: body
|
|
27
|
+
- name: fullMatchField
|
|
28
|
+
description: 是否精确匹配,1:精确匹配用户名称。
|
|
29
|
+
type: number
|
|
30
|
+
position: body
|
|
31
|
+
requestTemplate:
|
|
32
|
+
url: https://api.dingtalk.com/v1.0/contact/users/search
|
|
33
|
+
method: POST
|
|
34
|
+
headers:
|
|
35
|
+
- key: Content-Type
|
|
36
|
+
value: application/json
|
|
37
|
+
security:
|
|
38
|
+
id: DingTalkAuth
|
|
39
|
+
responseTemplate: {}
|
|
40
|
+
- name: getUserDetailByUserId
|
|
41
|
+
description: 查询用户详情 - 根据userId获取用户的详细信息,包含用户的unionId。
|
|
42
|
+
args:
|
|
43
|
+
- name: userid
|
|
44
|
+
description: 用户的userId。
|
|
45
|
+
type: string
|
|
46
|
+
required: true
|
|
47
|
+
position: body
|
|
48
|
+
- name: language
|
|
49
|
+
description: 语言。 * **zh_CN** :中文(默认值) * **en_US** :英文
|
|
50
|
+
type: string
|
|
51
|
+
position: body
|
|
52
|
+
items:
|
|
53
|
+
enum:
|
|
54
|
+
- zh_CN
|
|
55
|
+
- en_US
|
|
56
|
+
requestTemplate:
|
|
57
|
+
url: https://oapi.dingtalk.com/topapi/v2/user/get
|
|
58
|
+
method: POST
|
|
59
|
+
headers:
|
|
60
|
+
- key: Content-Type
|
|
61
|
+
value: application/json
|
|
62
|
+
security:
|
|
63
|
+
id: DingTalkAuth
|
|
64
|
+
responseTemplate: {}
|
|
65
|
+
- name: getUserIdByMobile
|
|
66
|
+
description: 根据手机号获取用户的userId。
|
|
67
|
+
args:
|
|
68
|
+
- name: mobile
|
|
69
|
+
description: 手机号
|
|
70
|
+
type: string
|
|
71
|
+
required: true
|
|
72
|
+
position: body
|
|
73
|
+
requestTemplate:
|
|
74
|
+
url: https://oapi.dingtalk.com/topapi/v2/user/getbymobile
|
|
75
|
+
method: POST
|
|
76
|
+
headers:
|
|
77
|
+
- key: Content-Type
|
|
78
|
+
value: application/json
|
|
79
|
+
security:
|
|
80
|
+
id: DingTalkAuth
|
|
81
|
+
responseTemplate: { }
|
|
82
|
+
- name: getUserIdByUnionId
|
|
83
|
+
description: 根据unionId获取用户的userId。
|
|
84
|
+
args:
|
|
85
|
+
- name: unionid
|
|
86
|
+
description: unionId,员工在当前开发者企业账号范围内的唯一标识
|
|
87
|
+
type: string
|
|
88
|
+
required: true
|
|
89
|
+
position: body
|
|
90
|
+
requestTemplate:
|
|
91
|
+
url: https://oapi.dingtalk.com/topapi/user/getbyunionid
|
|
92
|
+
method: POST
|
|
93
|
+
headers:
|
|
94
|
+
- key: Content-Type
|
|
95
|
+
value: application/json
|
|
96
|
+
security:
|
|
97
|
+
id: DingTalkAuth
|
|
98
|
+
responseTemplate: { }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
server:
|
|
2
|
+
name: dingtalk-robot-send-message
|
|
3
|
+
description: 钉钉机器人发消息和DING消息
|
|
4
|
+
securitySchemes:
|
|
5
|
+
- id: DingTalkAuth
|
|
6
|
+
type: apiKey
|
|
7
|
+
in: header
|
|
8
|
+
name: x-acs-dingtalk-access-token
|
|
9
|
+
tools:
|
|
10
|
+
- name: sendDINGByRobot
|
|
11
|
+
description: 机器人发送DING消息
|
|
12
|
+
args:
|
|
13
|
+
- name: robotCode
|
|
14
|
+
description: 机器人Code
|
|
15
|
+
type: string
|
|
16
|
+
required: true
|
|
17
|
+
position: body
|
|
18
|
+
system: ROBOT_CODE
|
|
19
|
+
- name: remindType
|
|
20
|
+
type: string
|
|
21
|
+
description: DING消息类型。1:应用内DING,2:短信DING,3:电话DING;默认值为1。
|
|
22
|
+
position: body
|
|
23
|
+
required: true
|
|
24
|
+
- name: receiverUserIdList
|
|
25
|
+
description: 接收人userId列表。应用内DING消息,每次接收人不能超过200个。短信DING和电话DING,每次接收人不能超过20个。
|
|
26
|
+
type: array
|
|
27
|
+
required: true
|
|
28
|
+
position: body
|
|
29
|
+
items:
|
|
30
|
+
type: string
|
|
31
|
+
- name: content
|
|
32
|
+
description: DING消息内容。
|
|
33
|
+
type: string
|
|
34
|
+
required: true
|
|
35
|
+
position: body
|
|
36
|
+
requestTemplate:
|
|
37
|
+
url: https://api.dingtalk.com//v1.0/robot/ding/send
|
|
38
|
+
method: POST
|
|
39
|
+
headers:
|
|
40
|
+
- key: Content-Type
|
|
41
|
+
value: application/json
|
|
42
|
+
security:
|
|
43
|
+
id: DingTalkAuth
|
|
44
|
+
responseTemplate: {}
|
|
45
|
+
|
|
46
|
+
- name: recallDING
|
|
47
|
+
description: 机器人发送DING消息
|
|
48
|
+
args:
|
|
49
|
+
- name: robotCode
|
|
50
|
+
description: 机器人Code
|
|
51
|
+
type: string
|
|
52
|
+
required: true
|
|
53
|
+
position: body
|
|
54
|
+
system: ROBOT_CODE
|
|
55
|
+
- name: openDingId
|
|
56
|
+
type: string
|
|
57
|
+
description: 需要被撤回的DING消息ID。
|
|
58
|
+
position: body
|
|
59
|
+
required: true
|
|
60
|
+
requestTemplate:
|
|
61
|
+
url: https://api.dingtalk.com//v1.0/robot/ding/recall
|
|
62
|
+
method: POST
|
|
63
|
+
headers:
|
|
64
|
+
- key: Content-Type
|
|
65
|
+
value: application/json
|
|
66
|
+
security:
|
|
67
|
+
id: DingTalkAuth
|
|
68
|
+
responseTemplate: { }
|
|
@@ -45,14 +45,14 @@ export class DingTalkMCPServer {
|
|
|
45
45
|
fs.readdirSync(configDir).forEach(
|
|
46
46
|
(file) => {
|
|
47
47
|
if (file.endsWith('mcp_server.yaml')) {
|
|
48
|
-
console.
|
|
48
|
+
console.error("found mcp config file:", file);
|
|
49
49
|
|
|
50
50
|
const configContent = fs.readFileSync(path.join(configDir, file), 'utf8');
|
|
51
51
|
const config = yaml.load(configContent);
|
|
52
52
|
if (!config) {
|
|
53
53
|
throw new Error('Config is empty');
|
|
54
54
|
}
|
|
55
|
-
if (config.
|
|
55
|
+
if (profiles_list.includes(config.name) || (profiles_list.length == 0 && config.server.default_active)) {
|
|
56
56
|
|
|
57
57
|
(config.tools || []).forEach(tool => {
|
|
58
58
|
if (this.tools.includes(tool.name)) {
|
|
@@ -68,8 +68,8 @@ export class DingTalkMCPServer {
|
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
if (this.tools && this.tools.length > 0) {
|
|
71
|
-
console.
|
|
72
|
-
console.
|
|
71
|
+
console.error(`Loaded ${this.tools.length} tools from config`);
|
|
72
|
+
console.error(`Tools: ${this.tools.map(t => t.name).join(', ')}`);
|
|
73
73
|
}else{
|
|
74
74
|
throw new Error('No tools found in config, tools is empty');
|
|
75
75
|
}
|
|
@@ -433,7 +433,7 @@ export class DingTalkMCPServer {
|
|
|
433
433
|
async run() {
|
|
434
434
|
const transport = new StdioServerTransport();
|
|
435
435
|
await this.server.connect(transport);
|
|
436
|
-
console.
|
|
436
|
+
console.error('DingTalk MCP server running on stdio');
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
//# sourceMappingURL=DingTalkMCPServer.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dingtalk-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "DingTalk MCP Server - A TypeScript-based MCP server for DingTalk integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/**/*",
|
|
13
|
-
"
|
|
13
|
+
"*.yaml"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc",
|