Back to MCP directory
publicPublicdnsLocal runtime

DingTalk

钉钉MCP服务是一个基于Model Control Protocol的钉钉API访问服务,提供获取token、部门及用户信息等功能。

article

README

🚀 钉钉 MCP 服务

这是一个基于 MCP(模型控制协议)的钉钉服务,它为用户提供了访问钉钉 API 的功能,能帮助开发者更便捷地与钉钉系统进行交互。

🚀 快速开始

在使用该服务前,你需要了解其环境要求、安装配置步骤以及不同场景下的使用方法。

✨ 主要特性

  • 获取钉钉 Access Token
  • 获取部门列表
  • 获取部门用户列表
  • 根据姓名查询用户详细信息(包括遍历部门查找用户)

📦 安装指南

环境要求

  • Python 3.12+
  • Docker(推荐)
  • 钉钉应用凭证

安装步骤

1. 获取钉钉应用凭证

  1. 登录钉钉开放平台
  2. 创建企业内部应用。
  3. 获取应用的 AppKey 和 AppSecret。

2. 配置环境变量

需要设置以下环境变量:

DINGDING_APP_KEY=你的AppKey
DINGDING_APP_SECRET=你的AppSecret

💻 使用示例

在 Claude 桌面客户端中使用

在你的 claude_desktop_config.json 中添加以下配置:

{
  "mcpServers": {
    "dingding": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "DINGDING_APP_KEY=你的AppKey",
        "-e", "DINGDING_APP_SECRET=你的AppSecret",
        "ghcr.io/你的用户名/dingding-mcp:latest"
      ]
    }
  }
}

本地开发

  1. 克隆仓库:
git clone <repository_url>
cd dingding_chat
  1. 安装依赖:
pip install -r requirements.txt
  1. 运行服务:
python src/server.py

Docker 部署

  1. 拉取镜像:
docker pull ghcr.io/你的用户名/dingding-mcp:latest
  1. 运行容器:
docker run -d --name dingding-mcp \
  -e DINGDING_APP_KEY=你的AppKey \
  -e DINGDING_APP_SECRET=你的AppSecret \
  ghcr.io/你的用户名/dingding-mcp:latest

📚 详细文档

API 说明

1. 获取 Access Token

  • 功能:获取钉钉 API 的 access token
  • 工具名:get_access_token
  • 参数:无
  • 返回:access token 字符串

2. 获取部门列表

  • 功能:获取企业的部门列表
  • 工具名:get_department_list
  • 参数:
    • fetch_child: 是否抓取子部门列表(可选,默认为 true)
  • 返回:部门列表信息(包括部门 ID、名称、父部门 ID 等)

3. 获取部门用户列表

  • 功能:获取指定部门的用户列表
  • 工具名:get_department_users
  • 参数:
    • department_id: 部门 ID(必填)
  • 返回:部门用户列表(包括用户 ID、姓名等)

4. 根据姓名查询用户

  • 功能:通过用户姓名查询用户详细信息
  • 工具名:get_user_by_name
  • 参数:
    • user_name: 用户姓名
  • 返回:用户详细信息(包括用户 ID、姓名、邮箱等)

⚠️ 注意事项

⚠️ 重要提示

配置钉钉应用凭证时,请确保 AppKey 和 AppSecret 正确无误。使用本服务进行用户查询时,可能会涉及网络延迟,具体取决于钉钉服务器响应时间。

💡 使用建议

建议在生产环境中使用 Docker 部署以保证服务稳定性。

📄 许可证

本项目遵循 MIT 协议。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client