mac-mcp

mac-mcp

A read-only MCP server that exposes data from native macOS apps (Mail, Notes, Calendar, Reminders, Contacts, Messages, Spotlight) to AI agents over stdio, currently in early development with no domain tools wired yet.

Category
访问服务器

README

mac-mcp

A read-only MCP server that exposes data from native macOS apps (Mail, Notes, Calendar, Reminders, Contacts, Messages, Spotlight) to AI agents over stdio.

Bootstrapped with Vite+ and Bun. Status: Mail domain shipping; other domains in the pipeline.

Status

Domain State
Mail shipped (v0.1)
Spotlight shipped
Notes planned
Calendar / Reminders planned
Contacts planned
Messages planned

The server is read-only by construction. There is no CLI flag, env var, or config key that enables writes. A regression test sweeps every JXA template for write-capable Apple Events phrases (set readStatus, move to, delete, send, etc.) and another sweeps every tool / domain module to ensure they only spawn read-only system commands (osascript, mdfind).

Requirements

  • macOS 14 or newer (15+ unlocks Apple Mail category support)
  • Bun 1.3+
  • Full Disk Access granted to your terminal / MCP client (for reading Apple's local data stores)
  • Automation permission for Mail.app (granted at first JXA call when listing accounts)

CLI

mac-mcp serve            # start the MCP server over stdio (default)
mac-mcp init             # write ~/.mac-mcp/config.toml template
mac-mcp doctor           # probe macOS permissions, print a checklist
mac-mcp status           # print per-domain index health as JSON
mac-mcp index            # bulk-build domain indexes
mac-mcp rebuild --domain <name>   # rebuild a single domain's index

Mail tools (v0.1)

Five read-only MCP tools, plus the index://status resource.

Tool What it does
mail_list_accounts List all Mail accounts with display names + UUIDs.
mail_list_mailboxes List mailboxes per account with current unread counts.
mail_get_emails Recency-sorted email list. Optional account, mailbox, category (primary/transactions/updates/promotions), filter (all/unread/flagged/today/last_7_days), before/after (YYYY-MM-DD), and group_by to bucket by unread state, category, or account.
mail_get_email Fetch a full email by Mail.app integer id with body, recipients, headers.
mail_search FTS5 BM25 search across subject/sender/body with scope, account, mailbox, category, and date filters.

Apple Mail category awareness

Mail's built-in categorisation (Primary, Transactions, Updates, Promotions) ships natively on macOS 15+. The server probes the message_global_data.model_category column at startup and degrades cleanly to category-less output on older macOS. The category filter and group_by: "category" both honour this gracefully.

Local index

The Mail domain maintains a SQLite + FTS5 index at ~/.mac-mcp/mail.db:

  • WAL mode, synchronous=NORMAL, denormalised is_unread/is_flagged columns for indexed sorts.
  • Disk-first state-reconciliation sync (NEW / DELETED / MOVED diffs in pure SQL).
  • Background sync every 5 minutes by default (configurable).
  • Dead-letter queue surfaces parse failures via index://status.

Spotlight tool

One read-only tool: spotlight_search.

Input Type Default Notes
query string required Plain text or full mdfind metadata query syntax (kMDItemContentType == "public.image").
path string none Restrict to this directory tree. Must resolve under $HOME.
kind "file" | "folder" | "any" "any" Post-filter on filesystem entry kind.
limit number 25 Hard cap 100.

The macOS Spotlight index (mds) is already maintained by the OS; we never build our own. Subprocess runs mdfind with a 5-second per-call timeout; truncated indicates more matches existed beyond the limit.

MCP client config

{
  "mcpServers": {
    "mac": {
      "command": "bunx",
      "args": ["-y", "github:DaniAkash/mac-mcp"]
    }
  }
}

Run mac-mcp doctor after install to verify permissions.

Development

bun install        # install dependencies
bun test           # unit + integration tests (CI-safe; e2e tests skip themselves)
bun run test:e2e   # live end-to-end tests; requires macOS + FDA + Mail.app data
bun run check      # lint + format + fallow code-quality, in parallel
bun run lint       # vp lint (oxlint with full TS typecheck)
bun run fmt        # vp fmt --check
bun run fmt:fix
bun run build      # vp pack

End-to-end tests

tests/e2e/ contains tests that hit the real Mail.app + Envelope Index on the local machine. They require Full Disk Access and a configured Mail account, so they only run when MAC_MCP_E2E=1 is set. CI never sets this env var; the tests skip cleanly on every CI run.

Coverage includes the five Mail tools called directly against the live data (sort order, unread / category / account grouping, multi-account filter, get-email round-trip) plus a full MCP stdio round-trip that spawns the actual mac-mcp serve binary and drives it as a real MCP client over JSON-RPC.

# Grant Full Disk Access to your terminal first.
bun run test:e2e

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选