dingtalk-calendar-mcp
v1.4.0
Published
MCP server for DingTalk Calendar API - manage events, attendees, and calendar views
Maintainers
Readme
DingTalk Calendar MCP Server
钉钉日程管理 MCP 服务器 - 通过 Model Context Protocol 管理钉钉日程
English
A Model Context Protocol (MCP) server for managing DingTalk calendar events. This server provides tools to create, update, delete, and query calendar events, manage attendees, and configure event reminders and recurrence rules.
Features
- 📅 Event Management: Create, update, delete, and query calendar events
- 👥 Attendee Management: Add or remove event attendees
- ⏰ Reminders: Configure event reminders
- 🔁 Recurrence: Support for recurring events with various patterns
- 🔗 Online Meetings: Create events with DingTalk video meetings
- 🎨 UI Customization: Control the display of event detail page components
- 🔐 Token Management: Automatic token refresh with caching
Available Tools
- createEvent - Create a new calendar event
- updateEvent - Update an existing event
- deleteEvent - Delete an event
- getEvent - Get details of a single event
- listEvents - List events with time range filtering
- addAttendee - Add attendees to an event
- removeAttendee - Remove attendees from an event
- getAttendees - Get the list of event attendees
- getCalendarView - Query calendar view by time range
Installation
# Clone the repository
git clone https://github.com/your-org/dingtalk-calendar-mcp
cd dingtalk-calendar-mcp
# Install dependencies
npm install
# Build the project
npm run buildConfiguration
- Copy the environment variables template:
cp env.example .env- Edit
.envfile and add your DingTalk credentials:
# Option 1: Direct access token (for testing, valid for 2 hours)
DINGTALK_ACCESS_TOKEN=your_access_token_here
# Option 2: Client ID and Secret (recommended, auto-refresh)
DINGTALK_Client_ID=your_client_id_here
DINGTALK_Client_Secret=your_client_secret_hereUsage
As MCP Server
Start the server:
npm start
# or
./start-mcp.shIn Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"dingtalk-calendar": {
"command": "node",
"args": ["/path/to/dingtalk-calendar-mcp/dist/cli.js"],
"env": {
"DINGTALK_Client_ID": "your_client_id",
"DINGTALK_Client_Secret": "your_client_secret"
}
}
}
}Example Usage
Create an Event
{
"unionId": "user_union_id",
"calendarId": "primary",
"summary": "Team Meeting",
"description": "Weekly team sync",
"start": {
"dateTime": "2024-01-15T10:00:00+08:00",
"timeZone": "Asia/Shanghai"
},
"end": {
"dateTime": "2024-01-15T11:00:00+08:00",
"timeZone": "Asia/Shanghai"
},
"attendees": [
{
"id": "attendee_union_id",
"isOptional": false
}
],
"reminders": [
{
"method": "dingtalk",
"minutes": 15
}
]
}Create a Recurring Event
{
"unionId": "user_union_id",
"calendarId": "primary",
"summary": "Daily Standup",
"start": {
"dateTime": "2024-01-15T09:30:00+08:00",
"timeZone": "Asia/Shanghai"
},
"end": {
"dateTime": "2024-01-15T09:45:00+08:00",
"timeZone": "Asia/Shanghai"
},
"recurrence": {
"pattern": {
"type": "daily",
"interval": 1
},
"range": {
"type": "endDate",
"endDate": "2024-12-31T23:59:59+08:00"
}
}
}Development
# Run in development mode
npm run dev
# Build
npm run build
# Test with MCP Inspector
npm run inspector中文
基于 Model Context Protocol (MCP) 的钉钉日程管理服务器。该服务器提供了创建、更新、删除和查询日程的工具,以及管理参与者、设置提醒和重复规则等功能。
功能特性
- 📅 日程管理:创建、更新、删除和查询日程
- 👥 参与者管理:添加或删除日程参与者
- ⏰ 提醒设置:配置日程提醒
- 🔁 重复日程:支持多种重复模式的循环日程
- 🔗 在线会议:创建包含钉钉视频会议的日程
- 🎨 UI自定义:控制日程详情页组件的显示
- 🔐 令牌管理:自动刷新令牌并缓存
可用工具
- createEvent - 创建新日程
- updateEvent - 更新已有日程
- deleteEvent - 删除日程
- getEvent - 获取单个日程详情
- listEvents - 列出日程,支持时间范围过滤
- addAttendee - 添加日程参与者
- removeAttendee - 删除日程参与者
- getAttendees - 获取日程参与者列表
- getCalendarView - 按时间范围查询日程视图
安装
# 克隆仓库
git clone https://github.com/your-org/dingtalk-calendar-mcp
cd dingtalk-calendar-mcp
# 安装依赖
npm install
# 构建项目
npm run build配置
- 复制环境变量模板:
cp env.example .env- 编辑
.env文件,添加钉钉凭证:
# 方式一:直接使用访问令牌(用于测试,有效期2小时)
DINGTALK_ACCESS_TOKEN=your_access_token_here
# 方式二:使用客户端ID和密钥(推荐,自动刷新)
DINGTALK_Client_ID=your_client_id_here
DINGTALK_Client_Secret=your_client_secret_here使用方法
作为 MCP 服务器
启动服务器:
npm start
# 或
./start-mcp.sh在 Claude Desktop 中使用
添加到 Claude Desktop 配置文件(~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"dingtalk-calendar": {
"command": "node",
"args": ["/path/to/dingtalk-calendar-mcp/dist/cli.js"],
"env": {
"DINGTALK_Client_ID": "your_client_id",
"DINGTALK_Client_Secret": "your_client_secret"
}
}
}
}使用示例
创建日程
{
"unionId": "用户的unionId",
"calendarId": "primary",
"summary": "团队会议",
"description": "每周团队同步会",
"start": {
"dateTime": "2024-01-15T10:00:00+08:00",
"timeZone": "Asia/Shanghai"
},
"end": {
"dateTime": "2024-01-15T11:00:00+08:00",
"timeZone": "Asia/Shanghai"
},
"attendees": [
{
"id": "参与者的unionId",
"isOptional": false
}
],
"reminders": [
{
"method": "dingtalk",
"minutes": 15
}
]
}创建重复日程
{
"unionId": "用户的unionId",
"calendarId": "primary",
"summary": "每日站会",
"start": {
"dateTime": "2024-01-15T09:30:00+08:00",
"timeZone": "Asia/Shanghai"
},
"end": {
"dateTime": "2024-01-15T09:45:00+08:00",
"timeZone": "Asia/Shanghai"
},
"recurrence": {
"pattern": {
"type": "daily",
"interval": 1
},
"range": {
"type": "endDate",
"endDate": "2024-12-31T23:59:59+08:00"
}
}
}开发
# 开发模式运行
npm run dev
# 构建
npm run build
# 使用 MCP Inspector 测试
npm run inspectorAPI 权限要求
使用本服务需要在钉钉开发者后台为应用开通以下权限:
- 日历应用中日程写权限
- 日历应用中日程读权限
注意事项
- 所有日程操作都需要提供用户的
unionId calendarId统一使用primary,表示用户的主日历- 时间格式遵循 ISO-8601 标准
- 全天日程使用
date字段,非全天日程使用dateTime字段 - 每次参与者操作最多支持 500 人
License
MIT
Contributing
欢迎提交 Issue 和 Pull Request!
Support
如有问题,请提交 Issue
