mcp-dingtalk-bridge
v0.1.0
Published
Bridge between DingTalk AI Hub Streamable HTTP MCP and standard stdio MCP
Readme
mcp-dingtalk-bridge
DingTalk AI Hub MCP 协议转换工具,将钉钉 Streamable HTTP MCP 转换为标准 stdio MCP,供主流 Agent(Cursor、Claude、OpenCode 等)调用。
功能特性
- 协议转换:Streamable HTTP ↔ stdio
- 完整权限:使用钉钉官方开放的完整能力
- 开箱即用:无需自建钉钉应用
- 支持所有钉钉 MCP 服务:日历、待办、文档、AI 表格、机器人等
支持的钉钉 MCP 服务
已测试并完美支持:
- 钉钉日历 (mcpId: 1050) - 17个工具
- 钉钉待办 (mcpId: 2034) - 17个工具
- 钉钉 AI 表格 - 48个工具
- 钉钉文档 - 26个工具
- 钉钉日志 - 7个工具
- 钉钉机器人消息 - 12个工具
- 钉钉通讯录 - 10个工具
- 钉钉群聊 - 1个工具
- 钉钉表格 - 42个工具
- 以及其他任意钉钉 Streamable HTTP MCP 服务
安装与配置
1. 获取 DingTalk MCP Server URL
- 访问 钉钉 AI Hub: https://aihub.dingtalk.com/
- 使用钉钉扫码登录
- 在 AI Hub 中找到你需要的 MCP 服务(如「钉钉日历」、「钉钉待办」等)
- 点击「获取 MCP server 配置」按钮
- 复制完整的 URL(类似
https://mcp-gw.dingtalk.com/server/...?key=...)
URL 中包含认证密钥,请妥善保管,切勿提交到公开仓库。
2. 方式一:通过 npx 使用(推荐)
发布后在任意 Agent 中直接使用,无需本地安装。
2.1 环境变量方式
{
"mcpServers": {
"dingtalk": {
"command": "npx",
"args": ["-y", "mcp-dingtalk-bridge@latest"],
"env": {
"DINGTALK_MCP_URL": "https://mcp-gw.dingtalk.com/server/your-mcp-id?key=your-key"
}
}
}
}2.2 JSON 配置文件方式
将 URL 写入配置文件(注意:配置文件包含密钥,不要放在 repo 内):
{
"dingtalkMcpUrl": "https://mcp-gw.dingtalk.com/server/your-mcp-id?key=your-key"
}然后在 Agent 配置中指定:
{
"mcpServers": {
"dingtalk": {
"command": "npx",
"args": ["-y", "mcp-dingtalk-bridge@latest", "--config", "/path/to/config.json"]
}
}
}2.3 多个钉钉 MCP 服务配置
{
"mcpServers": {
"dingtalk-calendar": {
"command": "npx",
"args": ["-y", "mcp-dingtalk-bridge@latest"],
"env": {
"DINGTALK_MCP_URL": "https://mcp-gw.dingtalk.com/server/your-calendar-url?key=..."
}
},
"dingtalk-todo": {
"command": "npx",
"args": ["-y", "mcp-dingtalk-bridge@latest"],
"env": {
"DINGTALK_MCP_URL": "https://mcp-gw.dingtalk.com/server/your-todo-url?key=..."
}
}
}
}3. 方式二:本地开发运行
3.1 安装依赖与构建
npm install
npm run build3.2 在 Agent 中使用本地构建产物
{
"mcpServers": {
"dingtalk": {
"command": "node",
"args": ["/path/to/mcp-dingtalk-bridge/dist/index.js"],
"env": {
"DINGTALK_MCP_URL": "https://mcp-gw.dingtalk.com/server/your-mcp-id?key=your-key"
}
}
}
}4. 安全注意事项
- URL 中的
key参数是认证凭证,严禁提交到 Git - 本地开发使用
.env文件存放DINGTALK_MCP_URL(已加入.gitignore) - JSON 配置文件应放在 repo 外部,或确保已被
.gitignore排除
开发
# 安装依赖
npm install
# 开发模式(tsx 热重载)
npm run dev
# 运行测试
npm test
# 构建
npm run build
# 代码检查
npm run lint项目结构
mcp-dingtalk-bridge/
├── src/ # 源代码
│ ├── index.ts # 入口(协议桥接)
│ ├── bridge/ # 协议转换层
│ ├── config/ # 配置管理
│ └── types/ # TypeScript 类型
├── reference/ # 参考文件
├── dist/ # 构建输出
├── test/
│ ├── unit/ # 单元测试
│ └── integration/ # 集成测试
└── docs/ # 文档协议说明
- 输入协议:钉钉 Streamable HTTP MCP
- 输出协议:标准 MCP stdio
- 兼容:所有支持 MCP 的 Agent
