MCP server for DingTalk Wiki — gives AI assistants (Claude Code, Cursor, etc.) read/write access to DingTalk knowledge bases via Streamable HTTP
DingTalk Wiki MCP Server
English
A Model Context Protocol (MCP) server that gives AI assistants (Claude Code, Cursor, Windsurf, etc.) read/write access to DingTalk (Dingtalk) Wiki knowledge bases.
Features
- 8 MCP Tools:
list_workspaces,list_nodes,get_node,read_document,write_document,create_document,create_folder,search - Remote HTTP Transport: Streamable HTTP — no local install needed for end users
- Multi-user Sessions: Each user connects with their own DingTalk UnionId, 30min TTL with auto-cleanup
- Built-in Auth Page: Web UI for users to obtain their UnionId via DingTalk OAuth
- Markdown Read/Write: Documents are read and written as Markdown
- Minimal Dependencies: Only
@modelcontextprotocol/sdkandzod
Quick Start
git clone https://github.com/sputnicyoji/DingDingWiki_MCP.git
cd DingDingWiki_MCP
npm ci && npm run build
Create .env.local with your DingTalk app credentials:
DINGTALK_APP_KEY=your_app_key
DINGTALK_APP_SECRET=your_app_secret
DINGTALK_CORP_ID=your_corp_id
PUBLIC_URL=http://your-server:3000
npm start
Connect from AI Assistant
# Claude Code
claude mcp add dingtalk-wiki --transport http http://your-server:3000/mcp?uid=<your_union_id>
# OpenClaw
openclaw mcp set dingtalk-wiki '{"url":"http://your-server:3000/mcp?uid=<your_union_id>"}'
Cursor / Windsurf — add to .cursor/mcp.json or .windsurf/mcp.json:
{
"mcpServers": {
"dingtalk-wiki": {
"url": "http://your-server:3000/mcp?uid=<your_union_id>"
}
}
}
To get your UnionId, open http://your-server:3000 in DingTalk's built-in browser and click verify.
Docker
docker build -t dingtalk-wiki-mcp .
docker run -d --restart unless-stopped -p 3000:3000 --env-file .env.local dingtalk-wiki-mcp
Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| DINGTALK_APP_KEY | Yes | — | DingTalk app key |
| DINGTALK_APP_SECRET | Yes | — | DingTalk app secret |
| DINGTALK_CORP_ID | Yes | — | DingTalk corp ID |
| PUBLIC_URL | Yes | http://localhost:3000 | Public-facing server URL |
| PORT | No | 3000 | HTTP listen port |
API Endpoints
| Path | Description |
|------|-------------|
| GET / | UnionId lookup page |
| POST /mcp?uid=<id> | MCP protocol endpoint |
| POST /api/get-unionid | DingTalk OAuth code exchange |
| GET /health | Health check |
Known Limitations
DingTalk's block API does not return text content for list items, blockquotes, or table cells when reading. These appear as [...] placeholders. Writing supports full Markdown.
中文
一个 MCP (Model Context Protocol) 服务器,让 AI 助手(Claude Code、Cursor、Windsurf 等)能够读写钉钉知识库文档。
功能
- 8 个 MCP 工具:
list_workspaces、list_nodes、get_node、read_document、write_document、create_document、create_folder、search - 远程 HTTP 传输: Streamable HTTP 协议,终端用户无需本地安装
- 多用户会话: 每个用户通过自己的钉钉 UnionId 连接,30 分钟 TTL 自动清理
- 内置认证页面: 用户通过钉钉 OAuth 获取 UnionId 的 Web 界面
- Markdown 读写: 文档以 Markdown 格式读写
- 最小依赖: 仅依赖
@modelcontextprotocol/sdk和zod
快速开始
git clone https://github.com/sputnicyoji/DingDingWiki_MCP.git
cd DingDingWiki_MCP
npm ci && npm run build
创建 .env.local 填入钉钉应用凭证:
DINGTALK_APP_KEY=your_app_key
DINGTALK_APP_SECRET=your_app_secret
DINGTALK_CORP_ID=your_corp_id
PUBLIC_URL=http://your-server:3000
npm start
连接 AI 助手
# Claude Code
claude mcp add dingtalk-wiki --transport http http://your-server:3000/mcp?uid=<your_union_id>
# OpenClaw
openclaw mcp set dingtalk-wiki '{"url":"http://your-server:3000/mcp?uid=<your_union_id>"}'
Cursor / Windsurf — 在项目根目录创建 .cursor/mcp.json 或 .windsurf/mcp.json:
{
"mcpServers": {
"dingtalk-wiki": {
"url": "http://your-server:3000/mcp?uid=<your_union_id>"
}
}
}
获取 UnionId: 在钉钉内置浏览器中打开 http://your-server:3000,点击验证按钮。
Docker 部署
docker build -t dingtalk-wiki-mcp .
docker run -d --restart unless-stopped -p 3000:3000 --env-file .env.local dingtalk-wiki-mcp
环境变量
| 变量 | 必填 | 默认值 | 说明 |
|------|------|--------|------|
| DINGTALK_APP_KEY | 是 | — | 钉钉应用 Key |
| DINGTALK_APP_SECRET | 是 | — | 钉钉应用 Secret |
| DINGTALK_CORP_ID | 是 | — | 钉钉企业 ID |
| PUBLIC_URL | 是 | http://localhost:3000 | 服务器公网地址 |
| PORT | 否 | 3000 | HTTP 监听端口 |
已知限制
钉钉 Block API 在读取时不返回列表项、引用块和表格单元格的文本内容,这些会显示为 [...] 占位符。写入支持完整 Markdown。
License
MIT