Skip to main content
Glama

mcp-ical-swift

Bun Swift MCP License: MIT macOS

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 build

build スクリプトは 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.ts

OpenClaw

{
  "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"]
    }
  }
}

ツール

ツール

説明

ical__list_calendars

すべてのAppleカレンダーを一覧表示

ical__list_events

指定期間内(YYYY-MM-DD)のイベントを一覧表示

ical__search_events

キーワードでイベントを検索(デフォルト:30日先まで)

ical__create_event

新規イベントを作成(タイトル、開始、終了、カレンダー、場所、メモ、終日)

ical__update_event

UIDで既存イベントを更新

ical__get_event

UIDでイベントの詳細を取得

ical__delete_event

UIDでイベントを削除

仕組み

MCP Client (Claude, OpenClaw, etc.)
  --> stdio --> Bun MCP server (src/index.ts)
    --> execFileSync --> compiled Swift binary (bin/calendar-reader)
      --> EventKit framework --> Apple Calendar data

Swiftバイナリは一度コンパイルされ (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

ライセンス

MIT

Available Tools

4 tools
ical__get_eventGet Calendar EventA
Read-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 CalendarsA
Read-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 EventsA
Read-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 EventsA
Read-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

    A4.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count4/5

    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.

    Completeness3/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers