mcpField
M
Mcp Server Dingtalk

Mcp Server Dingtalk

本地服务
github.com/1lib通信协作274 周前更新

关于 Mcp Server Dingtalk

MCP Server DingTalk 让 MCP 客户端通过已配置的机器人向钉钉群发送消息,支持多种消息格式,并使用 HMAC-SHA256 对 Webhook 请求签名。

主要功能

  1. 01通过已配置机器人发送消息
  2. 02支持五种消息格式
  3. 03使用 HMAC-SHA256 签名请求
  4. 04通过 JSON 配置机器人

适用场景

  1. 01向钉钉群发送文本更新
  2. 02分享链接或格式化公告
  3. 03发布互动卡片或信息流卡片

MCP 相关

它向 MCP 客户端提供 dingtalk_bot_send_message 工具,通过已配置的机器人向钉钉群发送消息。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"dingtalk": {
"command": "npx",
"args": [
"-y",
"mcp-server-dingtalk"
],
"env": {
"DINGTALK_BOT_CONFIGS": "<DINGTALK_BOT_CONFIGS>"
}
}
}
}
启动命令npx -y mcp-server-dingtalk
需要配置的环境变量
DINGTALK_BOT_CONFIGS

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npmmcp-server-dingtalk

工具

1

收录的工具列表 · 更新于 2 周前

参数类型必填说明
messageobject是要发送的消息。 type Message = TextMessage | LinkMessage | MarkdownMessage | ActionCardMessage | FeedCardMessage; interface TextMessage { type: 'text'; content: string; } interface LinkMessage { type: 'link'; text: string; title: string; picUrl?: string; messageUrl: string; } interface MarkdownMessage { type: 'markdown'; title?: string; text: string; } interface ActionCardMessage { type: 'actionCard'; title: string; text: string; // markdown text btnOrientation?: '0' | '1'; // 0: vertical, 1: horizontal singleTitle?: string; // single button title singleURL?: string; // single button URL btns?: Array<{ title: string; // button title actionURL: string; // button URL }>; // array of buttons } interface FeedCardMessage { type: 'feedCard'; links: Array<{ title: string; // title of the link messageURL: string; // URL to open when the link is clicked on picURL: string; // image URL for the link }>; // array of links }
message.btnOrientationenum否0 | 1
message.btnsarray否
message.contentstring否
message.linksarray否
message.messageUrlstring否
message.picUrlstring否
message.singleTitlestring否
message.singleURLstring否
message.textstring否
message.titlestring否
message.typeenum是要发送的消息类型text | link | markdown | actionCard | feedCard
namestring是用于发送消息的机器人名称
notifyobject是
notify.atMobilesarray否要通知的手机号码
notify.atUserIdsarray否要通知的用户 ID
notify.isAtAllboolean否是否通知所有用户

详细介绍

MCP Server DingTalk

用于集成 DingTalk 的模型上下文协议(MCP)服务。

功能

  • 🤖 支持发送 DingTalk 机器人消息
  • 📦 支持多种消息类型(文本、链接、Markdown、actionCard、feedCard)
  • 🔐 使用 HMAC-SHA256 安全签署 webhook
  • 🎯 支持 TypeScript,并进行严格的类型检查

前置条件

  • Node.js 18+

用法

{
    "mcp-server-dingtalk": {
        "transport": "stdio",
        "command": "npx",
        "args": [
            "-y",
            "mcp-server-dingtalk"
        ],
        "env": {
            "DINGTALK_BOT_CONFIGS": "[{\"name\": \"your-bot-name\", \"accessToken\": \"your-access-token\", \"signSecret\": \"your-sign-secret\"}]"
        }
    }
}
环境变量
变量描述必填默认值
DINGTALK_BASE_URLDingTalk API 基础 URL否https://oapi.dingtalk.com/robot/send
DINGTALK_BOT_CONFIGS机器人配置的 JSON 数组是[]
可用工具

该服务提供以下 MCP 工具:

dingtalk_bot_send_message

通过已配置的机器人向 DingTalk 聊天群组发送消息。

参数:

  • name(string):用于发送消息的机器人名称
  • message(object):包含特定类型字段的消息内容
  • notify(object):@ 提及的通知设置

支持的消息类型:

  1. 文本消息

    {
      "type": "text",
      "content": "Hello, World!"
    }
    
  2. 链接消息

    {
      "type": "link",
      "text": "Link description",
      "title": "Link Title",
      "messageUrl": "https://example.com"
    }
    
  3. Markdown 消息

    {
      "type": "markdown",
      "title": "Markdown Title",
      "text": "## Markdown Content\n- Item 1\n- Item 2"
    }
    
  4. Action Card 消息

    {
      "type": "actionCard",
      "title": "Action Card Title",
      "text": "Action card content",
      "singleTitle": "Read More",
      "singleURL": "https://example.com"
    }
    
  5. Feed Card 消息

    {
      "type": "feedCard",
      "links": [
        {
          "title": "Feed Item",
          "messageURL": "https://example.com",
          "picURL": "https://example.com/image.png"
        }
      ]
    }
    

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。