mcp-ical-swift
mcp-ical-swift
macOS SequoiaのTCC制限を回避するためにコンパイル済みSwiftバイナリを使用する、Apple Calendar用のローカルMCPサーバーです。
なぜこれが必要なのか
macOS Sequoia (26.x) では、ヘッドレスプロセスは標準のTCC(プライバシーとセキュリティ)メカニズムを通じてカレンダーへのアクセス権を取得できません。
PythonからのEventKit (例: PyObjC) は
kTCCServiceCalendarを必要としますが、これはヘッドレスプロセスではトリガーできないシステムダイアログを通じてのみ許可されます。Sequoiaの「システム設定」>「プライバシーとセキュリティ」>「カレンダー」には+ボタンが存在しません。osascript経由のAppleScript はkTCCServiceAppleEvents(自動化の許可)を必要としますが、これは呼び出し元のバイナリ(通常はnodeやbun)に帰属します。TCCデータベースを直接編集しても、TCCデーモンの整合性チェックによって無視されます。icalBuddy やその他のHomebrewツールは内部でEventKitを使用しており、同様の壁に突き当たります。
コンパイル済みのSwiftバイナリ (swiftc) が機能するのは、それがAppleによって署名されたMach-O実行ファイルであり、システムSwiftツールチェーンからカレンダーのTCC権限を継承するためです。Node/Bunが execFileSync を介してこのバイナリを起動すると、EventKitは authorizationStatus = .fullAccess を報告し、カレンダーデータを返します。
Related MCP server: apple-calendar-mcp
機能
すべてのカレンダーを一覧表示
指定した期間内のイベントを一覧表示
キーワードでイベントを検索
新規イベントの作成(カレンダー、場所、メモ、終日対応)
既存イベントの更新
UIDによるイベント詳細の取得
イベントの削除
stdio経由で完全にローカルで動作(ネットワーク、APIキー、クラウドは不要)
前提条件
macOS Sequoia (26.x) 以降
Bun 1.1以降
swiftc用のXcode Command Line Tools (xcode-select --install)Appleカレンダー内のカレンダーデータ(iCloud、Exchange、またはローカルカレンダー)
インストール
git clone https://github.com/Sealjay/mcp-ical-swift.git
cd mcp-ical-swift
bun install
bun run buildbuild スクリプトは src/calendar-reader.swift を bin/calendar-reader にコンパイルします。
MCPクライアントの設定
Claude Code
claude mcp add --transport stdio ical --scope user -- bun run /absolute/path/to/mcp-ical-swift/src/index.tsOpenClaw
{
"mcp": {
"servers": {
"ical": {
"command": "bun",
"args": ["run", "/absolute/path/to/mcp-ical-swift/src/index.ts"]
}
}
}
}Claude Desktop
claude_desktop_config.json に以下を追加します:
{
"mcpServers": {
"ical": {
"command": "bun",
"args": ["run", "/absolute/path/to/mcp-ical-swift/src/index.ts"]
}
}
}ツール
ツール | 説明 |
| すべてのAppleカレンダーを一覧表示 |
| 指定期間内(YYYY-MM-DD)のイベントを一覧表示 |
| キーワードでイベントを検索(デフォルト:30日先まで) |
| 新規イベントを作成(タイトル、開始、終了、カレンダー、場所、メモ、終日) |
| UIDで既存イベントを更新 |
| UIDでイベントの詳細を取得 |
| UIDでイベントを削除 |
仕組み
MCP Client (Claude, OpenClaw, etc.)
--> stdio --> Bun MCP server (src/index.ts)
--> execFileSync --> compiled Swift binary (bin/calendar-reader)
--> EventKit framework --> Apple Calendar dataSwiftバイナリは一度コンパイルされ (bun run build)、各ツール呼び出し時に同期的に実行されます。バイナリはJSONをstdoutに出力し、Bun MCPサーバーがそれをMCPツール結果としてラップします。サーバーはインジェクションリスクを避けるため、シェル実行ではなく execFileSync を使用します。
重要なポイント:swiftc でコンパイルされたバイナリはAppleによって署名されており、システムツールチェーンからカレンダーのTCC権限を継承します。これにより、Node、Bun、Python、AppleScriptがヘッドレス環境でカレンダーにアクセスすることを妨げるTCC制限を回避できます。
プライバシーとセキュリティ
このサーバーはデフォルトでシステム上のすべてのカレンダー(iCloud、Exchange、ローカル、共有、購読)にアクセスします。
list_eventsおよびsearch_eventsのオプションのcalendarパラメータを使用して、リクエストごとにカレンダー名でフィルタリングできます。イベントのメモはレスポンスに含まれ、機密データ(会議のPIN、パスワード、個人情報など)が含まれている可能性があります。MCPクライアントにアクセス権を付与する際はこれを考慮してください。
書き込み操作(
create_event、update_event、delete_event)は確認ステップなしで実行可能です。MCPクライアント(またはその中のプロンプトインジェクション)がカレンダーデータを変更する可能性があります。すべての通信はstdio経由のローカルで行われ、外部サービスにデータは送信されません。
脆弱性を報告する場合は SECURITY.md を参照してください。
制限事項
macOS専用(EventKitとSwiftツールチェーンが必要)
Bunランタイムが必要
Swiftバイナリは一度コンパイルされ、ツール呼び出しごとに同期的に呼び出されるため、非常に高いスループットの用途には適していません
定期的なイベントの変更は、その単一のインスタンスのみに適用されます (
.thisEventスパン)カレンダーへのアクセスは、macOSのTCCがコンパイル済みバイナリに許可を与えているかどうかに依存します
トラブルシューティング
「Calendar access is not granted(カレンダーへのアクセス権がありません)」
コンパイルされたバイナリは、カレンダーのTCC権限を持つコンテキストから少なくとも一度実行する必要があります。ビルドとテストを実行してください:
bun run build
bin/calendar-reader list-events $(date +%Y-%m-%d)これでイベントが返されれば、バイナリはカレンダーへのアクセス権を持っています。そうでない場合は、Terminal.app(通常はカレンダーのTCC権限が付与されています)から実行してみてください。
イベントが空の場合
Appleカレンダーでカレンダーが設定されていることを確認してください。以下を実行してください:
bin/calendar-reader list-calendarsコンパイルに失敗する場合
Xcode Command Line Toolsがインストールされていることを確認してください:
xcode-select --installライセンス
Available Tools
4 toolsical__get_eventGet Calendar EventARead-only
Get details of one calendar event by UID. Recurring events require the matching occurrence object from list or search. Returns {uid, title, start, end, allDay, calendar, location?, notes?, url?, occurrence?, hasRecurrence?}; use ical__list_events or ical__search_events for bulk queries. Read-only; requires macOS Calendar access.
Inputs: event_id (required), occurrence, include_notes.
ical__list_calendarsList CalendarsARead-only
List calendars available to the local Calendar helper. Returns a JSON array of {name, uid, type, source, writable} objects. Use uid to select a calendar when names are shared across accounts. Read-only. Requires macOS Calendar access.
Inputs: no named parameters.
ical__list_eventsList Calendar EventsARead-only
List calendar events in start-time order within an inclusive date range of up to 90 local days. Returns a JSON array of {title, start, end, allDay, calendar, uid, location?, notes?, occurrence?, hasRecurrence?}; use ical__search_events for keyword queries and ical__get_event for full details on one event. Read-only; requires macOS Calendar access.
Inputs: start_date (required), calendar, end_date, calendar_uid, +1 more.
ical__search_eventsSearch Calendar EventsARead-only
Find upcoming calendar events whose title or location contains the query. With include_notes, also match and return notes. Returns events in start-time order. Use ical__list_events for a specific date range. Read-only. Requires macOS Calendar access.
Inputs: query (required), calendar, days_ahead, calendar_uid, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct query shape: enumerate calendars, enumerate events in a date range, keyword search, or fetch one event by UID. Descriptions explicitly cross-reference the correct alternative ('use list_events for a specific date range'), eliminating misselection risk.
Uniform namespace prefix plus consistent verb_noun snake_case (list_calendars, list_events, search_events, get_event). The two list_* tools differ by resource, which is a predictable and readable pattern.
Four tools is on the lean side but each covers a genuinely different access pattern (enumerate calendars, enumerate by range, search by keyword, fetch by ID), so nothing feels redundant. Slightly thin for a full calendar domain, but well-scoped for a read-only helper.
Read coverage is solid (discovery, range listing, search, detail retrieval with recurrence handling), but the surface is entirely read-only: no create, update, or delete event, and no calendar creation. Agents asked to modify calendars will hit a hard dead end.
Maintenance
Related MCP Connectors
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
A butler for your AI agent: iCloud Calendar, Mail and Contacts, and your Mac.
Connects ChatGPT to your Apple Calendar via a local Mac agent + Vercel relay
MCP server for Cronofy — read calendars, events and free/busy, and create, update or delete events.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for accessing macOS Calendar events2MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Apple Calendar via native EventKit API with proper recurring event support.20 npm10MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Apple Calendar, Mail, Reminders, and Files on macOS using native frameworks.35 npm22MIT
- AlicenseNot gradedqualityDmaintenanceA lightweight MCP server for Apple Calendar on macOS that uses a Swift helper to access EventKit directly, enabling event queries without AppleScript or Calendar.app dependency.MIT