macos-mcp

macos-mcp

Enables AI assistants to read, create, update, and delete data in macOS apps (Reminders, Calendar, Notes, Mail, Messages, Contacts) via natural language, using EventKit, JXA, and SQLite backends.

Category
访问服务器

README

macos-mcp Platform: macOS License: MIT

Based on FradSer/mcp-server-apple-events

MCP server for Reminders, Calendar, Notes, Mail, Messages, and Contacts on macOS. Local stdio transport — works with any MCP-capable client running on the same Mac (Claude Code, Claude Desktop, Cursor, Zed, Continue, ChatGPT desktop, etc.).

Requires a Mac. This server drives native macOS apps via EventKit, JXA (Apple Events), and SQLite reads of local Apple databases. It cannot run on Linux, Windows, iOS, Android, or in a web browser. You need a Mac (desktop or laptop) running macOS.

Design Notes

  • SQLite for reads, JXA for writes. JXA reads of Mail and Messages don't scale — 60s timeouts on real inboxes, and JXA Messages reads are broken entirely on macOS Sonoma+. This server reads chat.db and Mail's Envelope Index directly, including the Gmail labels join table for [Gmail]/All Mail accounts. Writes still go through JXA because Apple Events is the only API that triggers them. See ADR-001.
  • Per-app hybrid backend. Each app uses the bridge that works: Swift CLI through EventKit for Reminders and Calendar, JXA for Notes/Contacts/Mail-writes/Messages-send, SQLite for Mail and Messages reads. The architecture diagram below shows the full fan-out.
  • Cross-tool contact enrichment. A shared layer resolves raw phone numbers and emails to contact names across Messages, Mail, and Calendar. Bulk cache via SQLite AddressBook (<50ms for 1,100+ entries), targeted lookups via JXA whose(). See ADR-002.
  • Preflight check. macos-mcp --check validates macOS version, Node.js, the EventKit binary, Full Disk Access, and JXA permissions before runtime, with deep-links to the relevant System Settings panes for any failures.

Quick Start

Install as a Claude Code plugin

/plugin marketplace add krmj22/macos-mcp
/plugin install macos-mcp@krmj22-plugins

Run these inside Claude Code. The plugin wires up the MCP server via npx -y mcp-macos, so no separate install step is required.

Install from npm

npm install -g mcp-macos
# or use npx via your client's MCP config (no global install needed)

Or install via MCPB (Claude Desktop)

Download the .mcpb bundle from the latest GitHub release and drag it onto Claude Desktop. The bundle includes a pre-built universal Swift binary (arm64 + x86_64), so no Xcode Command Line Tools required.

Or build from source

git clone https://github.com/krmj22/macos-mcp.git
cd macos-mcp
pnpm install
pnpm build

Verify setup

macos-mcp --check   # or: node dist/index.js --check

Checks macOS version, Node.js, EventKit binary, Full Disk Access, and JXA automation permissions.

Tools

Tool App Bridge Actions
reminders_tasks Reminders EventKit read, create, update, delete
reminders_lists Reminders EventKit read, create, update, delete
calendar_events Calendar EventKit read, create, update, delete
calendar_calendars Calendar EventKit read
notes_items Notes JXA read, create, update, delete
notes_folders Notes JXA read, create
mail_messages Mail SQLite + JXA read, create, update, delete
messages_chat Messages SQLite + JXA read, create
contacts_people Contacts JXA read, search, create, update, delete

Both underscore (reminders_tasks) and dot (reminders.tasks) notation work.

Setup

Prerequisites

  • Node.js 20+
  • macOS
  • Xcode Command Line Tools (Swift compilation)

Client Configuration

The JSON config is the same for all clients — just the location differs.

{
  "mcpServers": {
    "macos-mcp": {
      "command": "npx",
      "args": ["mcp-macos"]
    }
  }
}
Client Config location
Claude Desktop claude_desktop_config.json
Cursor Settings > MCP > Add new global MCP server
Claude Code .mcp.json in project root

Permissions

macOS prompts for access on first use. Click Allow when prompted.

App Permission System Settings Path
Reminders Full Access Privacy & Security > Reminders
Calendar Full Access Privacy & Security > Calendars
Notes Automation Privacy & Security > Automation > Notes
Mail Automation + Full Disk Access Both locations
Messages Automation + Full Disk Access Both locations
Contacts Automation Privacy & Security > Automation > Contacts

Messages and Mail read SQLite databases directly, so your terminal app (Terminal, iTerm2, etc.) needs Full Disk Access.

Run macos-mcp --check to verify. See Troubleshooting if anything fails.

Troubleshooting

Quick-Fix Commands

# Open specific settings panes
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Reminders"
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars"
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Automation"
open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"

Full Disk Access (Messages & Mail)

Messages and Mail read SQLite databases (~/Library/Messages/chat.db and ~/Library/Mail/V10/MailData/Envelope Index). These require Full Disk Access on your terminal app.

# Find your real node binary (version managers use shims)
node -e "console.log(process.execPath)"

# Reveal it in Finder for drag-and-drop into FDA settings
open -R "$(node -e "console.log(process.execPath)")"

# Open Full Disk Access settings
open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"

Version manager users (Volta, nvm, fnm): the node command is a shim. System Settings needs the real binary:

Manager Find real binary
Volta volta which node
nvm nvm which current
fnm fnm exec -- node -e "console.log(process.execPath)"

System Settings may not show binaries in hidden directories — use open -R above to reveal it in Finder, then drag into the FDA list.

JXA Automation (Notes, Mail, Contacts)

On first use, macOS prompts for Automation access. Grant via System Settings > Privacy & Security > Automation.

Verify permissions:

osascript -l JavaScript -e 'Application("Contacts").people().length'
osascript -l JavaScript -e 'Application("Calendar").calendars().length'
osascript -l JavaScript -e 'Application("Reminders").defaultList().name()'
osascript -l JavaScript -e 'Application("Mail").inbox().messages().length'
osascript -l JavaScript -e 'Application("Notes").notes().length'

Each command should return a value. A hang means the permission dialog is trying (and failing) to appear.

Gmail Labels / Missing Inbox Messages

Gmail stores all messages in [Gmail]/All Mail and uses labels for folder membership. The server checks both the direct mailbox and labels join table. If Gmail inbox messages are missing, verify the Mail app has fully synced.

Development

pnpm install          # Install dependencies
pnpm build            # Build TypeScript + Swift binary
pnpm test             # Run full test suite
pnpm lint             # Lint and format (Biome + TypeScript)
pnpm dev              # Run from source via tsx

Production entry point (bin/run.cjs) requires pnpm build. Use pnpm dev for local development.

Architecture

flowchart LR
    Client[MCP Client<br/>Claude Code, Cursor, Desktop] -->|stdio| Server[macos-mcp]

    Server --> Swift[Swift CLI]
    Server --> JXA[JXA]
    Server --> SQLite[SQLite Readers]

    Swift -->|EventKit| Reminders[Reminders]
    Swift -->|EventKit| Calendar[Calendar]

    JXA -->|Apple Events| Notes[Notes]
    JXA -->|Apple Events| Contacts[Contacts]
    JXA -->|writes only| Mail[Mail]
    JXA -->|send only| Messages[Messages]

    SQLite -->|Envelope Index| Mail
    SQLite -->|chat.db| Messages
    SQLite -->|AddressBook| Enrich[Contact<br/>Enrichment Cache]

Three bridges to Apple apps:

  • EventKit (Swift binary) — Reminders, Calendar. Compiled Swift CLI, returns JSON.
  • JXA — Notes, Mail writes, Contacts. Scripts run via osascript -l JavaScript.
  • SQLite — Messages reads (~/Library/Messages/chat.db), Mail reads (~/Library/Mail/V10/MailData/Envelope Index). JXA message reading is broken on Sonoma+; JXA mail reading is too slow for real inboxes.

Mail and Messages use a hybrid path: JXA for writes (only way to trigger send/draft), SQLite for reads (the only way that scales). See DECISION.md for architecture decision records.

Dependencies

Runtime: @modelcontextprotocol/sdk, zod

Dev: typescript, tsx, jest, @biomejs/biome

License

MIT

Contributing

See CONTRIBUTING.md.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选