苹果日历mcp
Apple Calendar automation through MCP, optimized for n8n AI agents.
Experimental project. Based on supermemoryai/apple-mcp, made with Codex.
______________________________________________________________________
概述
apple-calendar-mcp 公开了一个MCP工具: calendar.
为了在n8n中获得更好的可靠性和更清晰的代理行为,服务器被有意缩小到仅日历操作。
支持的操作:
listCalendarslistsearchopencreateupdatedelete
______________________________________________________________________
为什么这个版本
- 仅日历范围
- 政策驱动的风险敞口(
config.ini) - 强模式契约(显式操作枚举+
outputSchema) - LLM解析器友好模式(扁平,无
oneOf/anyOf/类型联合/模式正则表达式) - 结构化响应(
operation,ok,isError、计数、事件) structuredContent始终返回(n8n MCP客户端在以下情况下需要outputSchema已声明)
______________________________________________________________________
快速开始
1.安装依赖项
bun install2.建造
bun run build3.运行HTTP MCP服务器
APPLE_MCP_TRANSPORT=http \
APPLE_MCP_HTTP_HOST=127.0.0.1 \
APPLE_MCP_HTTP_PORT=8787 \
APPLE_MCP_HTTP_PATH=/mcp \
APPLE_MCP_CALENDAR_INCOMING="Calendar" \
APPLE_MCP_CALENDAR_OUTGOING="🤖AKAI" \
node dist/index.jsMCP端点:
http://127.0.0.1:8787/mcp______________________________________________________________________
日历安全模型
日历访问被env变量锁定:
APPLE_MCP_CALENDAR_INCOMING用于读取范围APPLE_MCP_CALENDAR_OUTGOING用于写入范围
读取操作(list, search, open)解决两个锁定日历中的事件。 写入操作(create, update, delete)仅限于外发日历。
如果缺少任一变量,则禁用日历操作。
______________________________________________________________________
工具政策(config.ini)
例子:
[tools]
enabled = true
read = true
write = true
[tool.calendar]
enabled = true
read = true
write = false政策效果:
- 被阻止的操作被隐藏
tools/list - 被阻止的调用在中返回显式策略错误
tools/call
______________________________________________________________________
日历工具合同
calendar 输入:
operation:listCalendars | list | search | open | create | update | delete- 常见的可选过滤器:
calendarName,fromDate,toDate,limit open:需要eventIdcreate:需要title,startDate,endDateupdate:需要eventId+至少一个补丁字段(title,startDate,endDate,location,notes,isAllDay)delete:需要eventId
calendar 输出:
- 始终包括:
operation,ok,isError,content,structuredContent listCalendars:calendars,calendarsCountlist/search:events,eventsCountcreate:eventupdate:eventdelete:deletedEventId,deletedFromCalendar
______________________________________________________________________
n8n集成
- 使用n8n MCP客户端节点
http://127.0.0.1:8787/mcp - 更喜欢结构化字段(
events,event,计数器) - 对待
content[].text仅作为摘要文本 structuredContent存在n8n兼容性的成功和错误
______________________________________________________________________
PM2运行手册
此设置中使用的PM2生态系统文件:
/Users/cabrera1/pm2-services/mcp-apple-http-streamable/ecosystem.config.js
建议的环境值:
APPLE_MCP_TRANSPORT=httpAPPLE_MCP_HTTP_HOST=127.0.0.1APPLE_MCP_HTTP_PORT=8787APPLE_MCP_HTTP_PATH=/mcpAPPLE_MCP_CALENDAR_INCOMING=CalendarAPPLE_MCP_CALENDAR_OUTGOING=🤖AKAICALENDAR_HTTP_ALLOW_WRITE=1(在以下期间启用HTTP写探测test:calendar-http)
更改后重新加载env:
pm2 restart /Users/cabrera1/pm2-services/mcp-apple-http-streamable/ecosystem.config.js --only apple-mcp --update-env______________________________________________________________________
日志
- PM2运行时日志:
pm2 logs apple-mcp - 删除操作在PM2日志中可见(
deleteEvent - ...) - 扩展日历日志也会写入:
- ~/apple-mcp.out.log (或 APPLE_MCP_CALENDAR_LOG_FILE 以(权力)否决
______________________________________________________________________
验证和测试
bun run test:policy
bun run test:schema
bun run test:calendar
bun run test:calendar-http
CALENDAR_HTTP_ALLOW_WRITE=1 bun run test:calendar-http______________________________________________________________________
文档
- 代理人备注:
AGENTS.md - 测试指南:
TEST_README.md - 策略文件:
config.ini - HTTP验证脚本:
scripts/test-calendar-http.ts - n8n MCP文件:https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcpClient/
- MCP规范:https://modelcontextprotocol.io/specification
______________________________________________________________________
仓库
- 主回购:https://github.com/re-fael/apple-mcp-n8n
- 原基地项目:https://github.com/supermemoryai/apple-mcp
实验项目,与Codex合作。
______________________________________________________________________
许可证
麻省理工学院(LICENSE)
