CalDAV MCP Server
CalDAV MCP Server
CalDAV MCP Server 是一个用于管理 iCloud Calendar 事件的 Model Context Protocol 服务器,原生支持单个事件上的多个 VALARM 提醒。
iCloud Calendar 是首个版本中唯一官方支持并经过手动验证的提供商。该服务器适用于任何支持 stdio 或 Streamable HTTP 的 MCP 客户端。
这个独立项目与 Apple Inc. 无关联,也未获得其授权、赞助或批准。Apple 和 iCloud 是其各自所有者的商标。
导航
Related MCP server: DAV MCP Server
关于
服务器通过 CalDAV 将一个已配置的账户连接到 iCloud。它发现账户的日历,并通过 MCP 暴露规范化的读写操作。
更新会保留完整的 iCalendar 资源,包括未知属性、Apple 扩展、VTIMEZONE、重复例外以及补丁中省略的提醒。写入使用不透明的资源标识符和 ETag,而不是假设 CalDAV 文件名与事件 UID 匹配。
日历资源在内存中处理。服务器没有遥测功能,也没有应用程序数据库,只有在明确请求时才返回原始 iCalendar。
功能特性
发现已配置的 iCloud 账户可用的日历。
在半开时间范围内列出事件,并展开重复发生的事件。
创建定时、全天和重复事件。
支持每个事件零个、一个或多个显示提醒。
发出 iCloud Calendar 期望的 Apple 提醒扩展。
通过不透明资源 ID 或日历 ID 和 UID 读取事件。
应用部分更新,同时保留省略和未知的 iCalendar 数据。
在更新和删除时使用 ETag 进行乐观并发控制。
拒绝孤立的重复变更,而不是更改整个系列。
从日志和错误中编辑掉凭据、原始日历内容和 CalDAV 路径。
以非 root 容器运行,并配置了只读根文件系统。
支持
stdio和 Streamable HTTP MCP 传输。
MCP 工具
list_calendars
列出为已配置账户发现的日历。每个结果包括一个不透明的 calendar_id、显示名称、描述、时区和尽力而为的写入状态。
list_events
在半开区间内列出事件,并展开重复发生的事件。最大范围为 366 天,默认页面大小为 100,最大页面大小为 500。结果使用确定性的时间顺序。分页游标是不透明的,在遍历期间修改事件时不代表快照。
示例输入:
{
"calendar_id": "opaque-calendar-id",
"start": "2026-09-01T00:00:00Z",
"end": "2026-10-01T00:00:00Z",
"timezone": "Europe/Berlin",
"limit": 100
}get_event
通过 resource_id 或 calendar_id 和 UID 对读取事件。默认排除原始 iCalendar,可以通过 include_raw_ical: true 请求以进行受控诊断。
create_event
创建事件并读回服务器存储的表示。
带两个提醒的定时事件:
{
"calendar_id": "opaque-calendar-id",
"summary": "Buy Shinkansen tickets",
"start": {
"date_time": "2026-09-06T03:00:00+02:00",
"timezone": "Europe/Berlin"
},
"end": {
"date_time": "2026-09-06T03:30:00+02:00",
"timezone": "Europe/Berlin"
},
"description": "Smart-EX",
"location": null,
"alarms": [
{ "minutes_before": 1440, "action": "DISPLAY" },
{ "minutes_before": 0, "action": "DISPLAY" }
],
"rrule": null
}带独占结束日期的全天事件:
{
"calendar_id": "opaque-calendar-id",
"summary": "Trip",
"start": { "date": "2026-09-06" },
"end": { "date": "2026-09-08" },
"alarms": []
}重复事件接受不带 RRULE: 前缀的 RFC 5545 规则:
{
"calendar_id": "opaque-calendar-id",
"summary": "Weekly planning",
"start": {
"date_time": "2026-09-07T09:00:00+02:00",
"timezone": "Europe/Berlin"
},
"end": {
"date_time": "2026-09-07T09:30:00+02:00",
"timezone": "Europe/Berlin"
},
"rrule": "FREQ=WEEKLY;BYDAY=MO;COUNT=10"
}update_event
修补事件或完整的重复系列。省略的字段会被保留,null 会移除可空字段,alarms: [] 会移除所有提醒。可选的 expected_etag 可防止覆盖较新的服务器版本。
delete_event
删除事件或完整的重复系列,可选地要求观察到的 ETag。当前版本不支持删除单个展开的事件。
技术栈
安装
先决条件
一个启用了日历的 iCloud 账户。
为 Apple 账户启用了双重认证。
一个应用专用密码。
用于容器部署的 Docker 和 Docker Compose,或用于本地安装的 Node.js 24+ 和 pnpm。
Docker Compose
推荐的安装使用已发布的多架构镜像:
ghcr.io/lukegskw/caldav-mcp:latest下载 Compose 示例:
curl -O https://raw.githubusercontent.com/lukegskw/caldav-mcp/main/compose.example.yaml提供 Apple 账户电子邮件和应用专用密码,然后启动服务:
export CALDAV_USERNAME='user@example.com'
export CALDAV_PASSWORD='xxxx-xxxx-xxxx-xxxx'
docker compose -f compose.example.yaml up -d要发布不同的主机端口,请设置:
export CALDAV_MCP_PUBLISHED_PORT=18100
docker compose -f compose.example.yaml up -dlatest 标签跟随默认分支上最新的成功构建。对于受控部署或回滚,请将其替换为 Compose 文件中的已发布版本或不可变的 sha-* 标签。
Streamable HTTP 端点将位于:
http://<host>:8100/mcp主机端口可以更改,而不会更改容器内的端口 8100。不需要持久卷;日历数据保留在 iCloud 中。
Docker run
相同的加固容器配置可以直接启动:
docker run -d \
--name caldav-mcp \
--restart unless-stopped \
--read-only \
--user 10001:10001 \
--cap-drop ALL \
--security-opt no-new-privileges:true \
--tmpfs /tmp:size=16m,mode=1777 \
-e CALDAV_PROVIDER=icloud \
-e CALDAV_USERNAME \
-e CALDAV_PASSWORD \
-e CALDAV_MCP_TRANSPORT=streamable-http \
-e CALDAV_MCP_HOST=0.0.0.0 \
-p 8100:8100 \
ghcr.io/lukegskw/caldav-mcp:latest从源代码构建容器
本地构建是可选的。除非您需要修改或审计容器构建,否则请优先使用已发布的镜像。
git clone https://github.com/lukegskw/caldav-mcp.git
cd caldav-mcp
docker buildx build --load -t caldav-mcp:local .本地 Node.js 安装
git clone https://github.com/lukegskw/caldav-mcp.git
cd caldav-mcp
pnpm install --frozen-lockfile
cp .env.example .env
pnpm build
pnpm start -- --transport stdio在 stdio 模式下,stdout 仅保留用于 MCP 消息。要在本地运行 Streamable HTTP:
CALDAV_MCP_TRANSPORT=streamable-http pnpm start配置
所有设置都使用 CALDAV_ 或 CALDAV_MCP_ 前缀。
变量 | 必需 | 默认值 | 描述 |
| 否 |
| 提供商策略。iCloud 是受支持的配置文件。 |
| 否 |
| CalDAV 发现 URL。 |
| 是 | 无 | Apple 账户电子邮件。 |
| 是 | 无 | 应用专用密码,而不是账户密码。 |
| 否 |
|
|
| 否 |
| HTTP 绑定地址。 |
| 否 |
| HTTP 监听端口。 |
| 否 |
| 应用程序日志级别。 |
| 否 |
| CalDAV 请求超时。 |
核心保留了一个实验性的 generic 提供商策略和可配置的 URL,以将 Apple 扩展与共享的 iCalendar 实现隔离开来。目前不声称与其他提供商兼容。
必须通过部署平台或环境提供机密信息。切勿提交 .env,将凭据作为 MCP 工具参数传递,或将其包含在诊断报告中。
MCP 客户端设置
对于任何接受 Streamable HTTP 服务器定义的 MCP 客户端,请配置 URL:
mcp_servers:
caldav:
url: http://<host>:8100/mcp如果客户端共享 Compose 网络,请使用服务名称和内部端口:
mcp_servers:
caldav:
url: http://caldav-mcp:8100/mcp对于启动本地 stdio 服务器的客户端,请配置命令以运行 node /absolute/path/to/caldav-mcp/dist/main.js 并设置所需的环境变量。
Claude Desktop(Docker,stdio)
Claude Desktop 将本地 stdio 服务器作为子进程启动。以这种方式运行已发布的容器会将应用专用密码保留在客户端机器上,并且不打开网络端口,这符合限制中的传输指南。
将服务器添加到 claude_desktop_config.json:
{
"mcpServers": {
"icloud-calendar": {
"command": "/absolute/path/to/docker",
"args": [
"run",
"-i",
"--rm",
"--env-file",
"/absolute/path/to/caldav-mcp.env",
"-e",
"CALDAV_PROVIDER=icloud",
"-e",
"CALDAV_MCP_TRANSPORT=stdio",
"ghcr.io/lukegskw/caldav-mcp@sha256:<digest>"
]
}
}
}-i 是必需的。如果没有附加的 stdin,客户端无法与容器进行 MCP 通信。--rm 会在客户端停止容器后将其移除。
通过 --env-file 而不是 -e 提供凭据。传递给 docker run 的参数在主机进程列表中可见;env 文件的内容则不可见。该文件包含配置中描述的变量:
CALDAV_USERNAME=user@example.com
CALDAV_PASSWORD=xxxx-xxxx-xxxx-xxxx按摘要固定镜像而不是 latest,这样重启客户端就不会静默启动不同版本:
docker pull ghcr.io/lukegskw/caldav-mcp:latest
docker images --digests ghcr.io/lukegskw/caldav-mcp编辑配置文件后,完全重启 Claude Desktop。
Windows
通过 设置 -> 开发者 -> 编辑配置 创建和定位配置文件。不要假设路径。当 Claude Desktop 从 Microsoft Store 安装时,Windows 会将 %APPDATA%\Claude 重定向到包容器中,文件位于:
%LOCALAPPDATA%\Packages\Claude_<package-id>\LocalCache\Roaming\Claude\claude_desktop_config.json在这种情况下,dir %APPDATA%\Claude 不会报告任何内容。服务器日志写在配置文件旁边,位于 logs\mcp-server-<server-name>.log。
使用 docker.exe 的绝对路径,因为包容器内的 PATH 不可靠。where docker 会打印它,通常是 C:\Program Files\Docker\Docker\resources\bin\docker.exe。反斜杠必须在 JSON 中转义。
MCP 客户端之间的配置格式不同。请查阅客户端的文档以了解其确切模式,并在更改服务器定义后重新加载或重启它。
验证
检查容器状态和日志:
docker compose -f compose.example.yaml ps
docker compose -f compose.example.yaml logs caldav-mcp容器应报告 healthy。TCP 健康检查验证服务器进程,而不是 iCloud 凭据。
运行仓库验证套件:
pnpm install --frozen-lockfile
pnpm format:check
pnpm lint
pnpm typecheck
pnpm test:unit
pnpm test:integration
pnpm build最后,连接 MCP 客户端并确认所有六个工具都已列出。在发布之前,请针对测试日历运行专门的 iCloud 手动验证。
限制
每个服务器进程或容器配置一个 iCloud 账户。
当前版本中 Streamable HTTP 端点没有身份验证。将其限制在受信任的 LAN、VPN 或私有容器网络中;不要直接暴露到互联网。
单个重复事件是只读的。支持更新或删除整个系列。
仅创建
ACTION:DISPLAY提醒。单个 iCalendar 资源限制为 5 MiB。
事件列表范围限制为 366 天,页面限制为 500 个结果。
事件最多包含 20 个提醒。
与会者调度不在当前范围内。
不正式支持 iCloud 以外的提供商。
有关发现、身份验证、ETag 和 Apple 扩展的指导,请参阅故障排除。在报告安全问题或附加诊断信息之前,请查看 SECURITY.md。
贡献
欢迎贡献。在打开拉取请求之前:
pnpm install --frozen-lockfile
pnpm format:check
pnpm lint
pnpm typecheck
pnpm test
pnpm build
docker buildx build --load -t caldav-mcp:test .对 CalDAV 写入或 iCalendar 序列化的更改必须保留 ETag 检查、不透明资源边界、未知属性、重复例外以及补丁中省略的提醒。TypeScript 更改必须继续满足 .codex/rules/typescript.md 中的规则。
许可证
MIT。请参阅 LICENSE。
Available Tools
6 toolscreate_eventCreate calendar eventA
Create a new event in a writable iCloud calendar and return the stored representation; existing events are not changed. Use list_calendars first to obtain calendar_id, and use update_event when the event already exists. Timed values require matching offsets and timezones, all-day end dates are exclusive, recurrence rules omit the RRULE: prefix, and travel_minutes sets Apple Calendar travel time for timed events.
Inputs: end (required), start (required), summary (required), calendar_id (required), +5 more. Returns: end, uid, etag, href, +13 more
delete_eventDelete calendar eventADestructiveIdempotent
Permanently delete an event or entire recurring series; individual expanded occurrences are not supported. Target it by resource_id or by calendar_id with uid, and supply expected_etag when available to prevent deleting a concurrently changed event.
Inputs: uid, calendar_id, resource_id, expected_etag. Returns: deleted, resource_id
get_eventGet calendar eventARead-onlyIdempotent
Read one event by resource_id, preferably from a previous result, or by the calendar_id and uid pair. Use list_events for range searches. Request raw iCalendar only for controlled diagnostics because it may contain sensitive calendar data.
Inputs: uid, calendar_id, resource_id, include_raw_ical. Returns: end, uid, etag, href, +13 more
list_calendarsList calendarsARead-onlyIdempotent
List calendars available in the configured iCloud account. Use this first to obtain the opaque calendar_id required by list_events and create_event; writable is a best-effort capability indicator.
Inputs: no named parameters. Returns: calendars
list_eventsList calendar eventsARead-onlyIdempotent
List events that overlap the start-inclusive, end-exclusive interval and expand recurring series into occurrences, across at most 366 days. Use list_calendars first to obtain calendar_id and use get_event instead for one known event. Continue with next_cursor and unchanged query filters when more results are available.
Inputs: end (required), start (required), calendar_id (required), limit, +2 more. Returns: events, next_cursor
update_eventUpdate calendar eventADestructive
Modify an existing event or entire recurring series; individual expanded occurrences are not supported. Target it by resource_id or by calendar_id with uid. Omitted patch fields are preserved, null clears nullable fields, an empty alarms array removes alarms, and expected_etag can prevent a stale write.
Inputs: patch (required), uid, calendar_id, resource_id, +1 more. Returns: end, uid, etag, href, +13 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool maps to a distinct action on a distinct resource: create/list/get/update/delete events plus list calendars. The descriptions explicitly clarify boundaries, such as list_events vs get_event and update vs create.
All tool names follow a consistent verb_noun snake_case pattern: create_event, list_events, get_event, update_event, delete_event, list_calendars.
Six tools are well-scoped for a CalDAV server: one discovery tool and a complete event CRUD set. No tool appears redundant or trivial.
The surface covers full event lifecycle plus calendar discovery, which is the core domain. Minor gaps exist around calendar-level operations and individual recurring-occurrence edits, though these are documented limitations rather than dead ends.
Maintenance
Related MCP Connectors
Read, search and manage iCloud Mail, Calendar and Contacts from Claude and other MCP clients.
Model Context Protocol server for todo.vu task management and time tracking.
MCP server for Cronofy — read calendars, events and free/busy, and create, update or delete events.
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
Related MCP Servers
- AlicenseCqualityDmaintenanceA Model Context Protocol server for AI models to access and manipulate Apple Calendar data on macOS through a standardized interface.714MIT
- AlicenseDqualityDmaintenanceA Model Context Protocol server that allows users to interact with their CalDAV, CardDAV, and WebDAV services (calendars, contacts, and files) from Fastmail and Apple iCloud accounts.63MIT
- AlicenseNot gradedqualityCmaintenanceAn HTTP Model Context Protocol (MCP) server exposing iCloud Calendar (CalDAV) tools so MCP-aware clients can list calendars, read events, and create/update/delete events using an iCloud app-specific password.3MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Apple Calendar via native EventKit API with proper recurring event support.13 npm10MIT