mcp-ical-swift
MCP server for Apple Calendar using compiled Swift to bypass macOS Sequoia TCC restrictions
README
mcp-ical-swift
A local MCP server for Apple Calendar that uses a compiled Swift binary to bypass macOS TCC restrictions blocking headless processes from accessing calendars.
mcp-ical-swift has two parts: a Bun/TypeScript MCP server that exposes calendar tools over stdio, and a compiled Swift binary that accesses EventKit directly. The Swift binary works because swiftc-compiled executables are Apple-signed and inherit Calendar TCC from the system toolchain — bypassing the restrictions that block Node, Bun, Python, and AppleScript in headless contexts. Everything runs locally — no network, no API keys, no cloud.
Features
- List all calendars
- List events within a date range
- Search events by keyword
- Get full event details by UID
- Create, update, and delete events (opt-in via
ICAL_ALLOW_WRITE=true) - Runs entirely locally over stdio — no network, no API keys, no cloud
Setup
Prerequisites
- macOS with Xcode Command Line Tools (
xcode-select --install) forswiftc - Bun 1.1+
- Calendar data in Apple Calendar (iCloud, Exchange, or local calendars)
Installation
-
Clone this repository
git clone https://github.com/Sealjay/mcp-ical-swift.git cd mcp-ical-swift -
Install dependencies and build
bun install bun run buildThe build step compiles
src/calendar-reader.swiftintobin/calendar-reader.
MCP client configuration
All clients use the same command/args shape. On macOS, you may need the absolute path to bun — see macOS: bun PATH below.
Claude Code
The quickest route is the CLI:
claude mcp add --transport stdio ical --scope user -- bun run /absolute/path/to/mcp-ical-swift/src/index.ts
With write operations enabled:
claude mcp add --transport stdio ical --scope user -e ICAL_ALLOW_WRITE=true -- bun run /absolute/path/to/mcp-ical-swift/src/index.ts
Alternatively, add to .mcp.json at your project root (or ~/.claude.json for user scope):
{
"mcpServers": {
"ical": {
"type": "stdio",
"command": "bun",
"args": ["run", "/absolute/path/to/mcp-ical-swift/src/index.ts"]
}
}
}
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"ical": {
"command": "bun",
"args": ["run", "/absolute/path/to/mcp-ical-swift/src/index.ts"]
}
}
}
Restart Claude Desktop. You should see ical listed as an available integration.
Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"ical": {
"command": "bun",
"args": ["run", "/absolute/path/to/mcp-ical-swift/src/index.ts"]
}
}
}
Restart Cursor.
macOS: bun PATH
GUI apps (Claude Desktop, Cursor) don't always inherit PATH from your interactive terminal, so bun may fail with spawn bun ENOENT. Fix by using the absolute path in command:
- Apple Silicon Homebrew —
/opt/homebrew/bin/bun - Intel Homebrew —
/usr/local/bin/bun - Manual install — run
which bunin your terminal
Write operations
Write tools (ical__create_event, ical__update_event, ical__delete_event) are disabled by default. Set ICAL_ALLOW_WRITE=true to enable them:
ICAL_ALLOW_WRITE=true bun run start
Or in your MCP client config:
{
"mcpServers": {
"ical": {
"command": "bun",
"args": ["run", "/absolute/path/to/mcp-ical-swift/src/index.ts"],
"env": { "ICAL_ALLOW_WRITE": "true" }
}
}
}
Architecture
| Component | Description |
|---|---|
| MCP server | Bun/TypeScript, stdio transport, Zod input validation |
| Swift binary | Compiled with swiftc, accesses EventKit framework |
| Communication | execFileSync with array args (no shell interpolation) |
| Output | JSON via JSONSerialization (prevents injection from user strings) |
Data flow
MCP Client (Claude, Cursor, etc.)
→ stdio → Bun MCP server (src/index.ts)
→ execFileSync → compiled Swift binary (bin/calendar-reader)
→ EventKit → Apple Calendar
The Swift binary is compiled once (bun run build) and called synchronously for each tool invocation. It outputs JSON to stdout, which the MCP server wraps in tool results.
Project structure
mcp-ical-swift/
src/
index.ts # MCP server entry point, tool definitions, Zod schemas
calendar-reader.swift # Swift EventKit binary source
bin/
calendar-reader # Compiled binary (gitignored)
package.json
Why a compiled Swift binary?
On macOS Sequoia and later, headless processes cannot obtain Calendar access through TCC (Transparency, Consent, and Control):
- EventKit from Python (PyObjC) requires
kTCCServiceCalendar, which needs a system dialog that headless processes cannot trigger. - AppleScript via
osascriptrequireskTCCServiceAppleEvents, attributed to the calling binary (node/bun). Direct TCC database edits are silently ignored. - icalBuddy and similar Homebrew tools use EventKit internally and hit the same wall.
A swiftc-compiled binary produces an Apple-signed Mach-O executable that inherits Calendar TCC from the system Swift toolchain. When spawned via execFileSync, EventKit reports authorizationStatus = .fullAccess.
Tools
7 tools in two groups.
Read
| Tool | Purpose |
|---|---|
ical__list_calendars |
List all Apple Calendar calendars |
ical__list_events |
List events within a date range (YYYY-MM-DD); optional calendar filter and include_notes |
ical__search_events |
Search events by keyword (default: 30 days ahead); optional calendar filter and include_notes |
ical__get_event |
Get full details of an event by UID; optional include_notes |
Write (requires ICAL_ALLOW_WRITE=true)
| Tool | Purpose |
|---|---|
ical__create_event |
Create a new event (title, start, end, calendar, location, notes, all-day) |
ical__update_event |
Update an existing event by UID |
ical__delete_event |
Delete an event by UID |
Privacy and security
- This server accesses all calendars on the system by default (iCloud, Exchange, local, shared, subscribed). Filter by calendar name per-request using the optional
calendarparameter onlist_eventsandsearch_events. - Event notes are not included by default — set
include_notes: trueper-request to opt in. Notes may contain sensitive data (meeting PINs, passwords, personal details). - Write operations are gated behind
ICAL_ALLOW_WRITE=true(off by default). Even when enabled, there is no per-operation confirmation step — an MCP client (or a prompt injection within one) could modify your calendar data. - All communication is local over stdio — no data leaves your machine.
See SECURITY.md for how to report vulnerabilities.
Limitations
- Prompt-injection risk: as with many MCP servers, this one is subject to the lethal trifecta. Event titles and notes from shared or subscribed calendars could contain adversarial content. Review risky actions before approving them in your MCP client.
- macOS only — requires EventKit and the Swift toolchain.
- Synchronous execution — the Swift binary is called once per tool invocation, not suited for high-throughput use.
- Single-instance recurring events — modifications apply to the individual occurrence only (
.thisEventspan), not the series. - TCC dependency — Calendar access depends on macOS granting permission to the compiled binary.
Troubleshooting
"Calendar access is not granted"
The compiled binary needs to be run at least once from a context that has Calendar TCC. Build and test:
bun run build
bin/calendar-reader list-events $(date +%Y-%m-%d)
If this returns events, the binary has Calendar access. If not, try running from Terminal.app (which typically has Calendar TCC granted).
Events are empty
Check that you have calendars configured in Apple Calendar:
bin/calendar-reader list-calendars
Compilation fails
Ensure Xcode Command Line Tools are installed:
xcode-select --install
MCP client can't launch the server
args must use an absolute path, not relative. If bun itself fails with spawn bun ENOENT, see macOS: bun PATH.
Contributing
Contributions welcome via pull request. Please:
- Use conventional commits (
feat,fix,docs,refactor,test). - Ensure
bun testpasses.
Licence
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。