mac-control-mcp

io.github.AdelElo13由 GitHub 账号 AdelElo13 发布v0.10.3更新于 Oct 30, 2026

Native Swift macOS automation — 153 tools: AX, EventKit, voice, browser DOM, undo.

概览

AI 生成的概览

原生 Swift 编写的 macOS 自动化服务器,为助手提供 153 个工具,用于检查并操控应用、窗口、浏览器、屏幕与系统设置。

可以做什么
  • 读取并修改运行中应用的辅助功能树,查找元素并执行操作
  • 点击、输入、滚动、拖拽、发送按键事件以及点击菜单路径
  • 控制窗口与应用生命周期:列出、启动、激活、退出、移动、调整大小、聚焦
  • 驱动 Safari 与 Chrome 的标签页、导航、DOM 检查与 JavaScript 执行
  • 截取屏幕、窗口与显示器,对屏幕做 OCR,录制音频与屏幕,语音转文字与文字转语音
  • 使用剪贴板、Spotlight 搜索、文件对话框、系统开关、Apple 应用(邮件、信息、日历、提醒事项、通讯录)以及撤销
适用场景
适合需要助手直接操作 Mac 的场景:自动化没有 API 的图形界面应用、测试或检查桌面与浏览器界面、截图与 OCR,或在聊天客户端中处理邮件、信息、日历和提醒事项。
运行要求
需要 macOS 14.0 或更高版本,通过 stdio 在本机运行。可通过 Claude Desktop 的 .mcpb 包安装、用 npx 运行 npm 启动器(首次运行会下载已签名应用)、使用预构建应用,或用 Swift 6 / Xcode 16+ 从源码构建。首次调用工具会触发屏幕录制、辅助功能和 Apple 事件的 macOS 授权提示,权限授予启动它的宿主应用。未声明 API 密钥或环境变量。
安装前请注意
对机器拥有广泛控制权:可点击、输入、发送信息和邮件、创建日历事件、退出应用、调整音量与深色模式,并通过 browser_eval_js 执行任意网页 JavaScript,该工具明确不受密码字段防护覆盖。密码字段在代码层面被拦截,但其他屏幕上的敏感内容仍可被读取、截屏或 OCR。撤销仅覆盖最近一次操作。TCC 权限需授予宿主应用,从源码重新构建会重置授权。

安装

在 SourceWeft 中

  1. 打开 控制台中的 mac-control-mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

mac-control-mcp

[CI] [License: MIT] [Platform] [Notarized] [MCP Registry]

Native Swift MCP server for full macOS automation. 153 tools in one signed .app bundle — no Python, no Node runtime, no Electron. Full list with parameters: docs/TOOLS.md.

[mac-control-mcp driving Safari: open tab, type query, capture window, OCR, Spotlight search — all via MCP stdio]

Gives any MCP-compatible client (Claude Desktop, Claude Code, Cursor, etc.) the ability to:

  • Read and mutate the Accessibility tree of any running app
  • Drive Safari and Chrome (tabs, navigation, JS eval)
  • Capture the screen, a display, or a specific window (ScreenCaptureKit)
  • OCR what's on screen
  • Click, type, scroll, drag, send key events
  • Control windows (move / resize / fullscreen / minimize / main)
  • Manage the clipboard
  • Launch / activate / quit apps
  • Search Spotlight's index (NSMetadataQuery) and launch results
  • Toggle dark mode, volume, list displays, inspect menus

Install

Requires macOS 14.0+. Four options, in order of simplicity:

1. One-click install (Claude Desktop, recommended)

The server is published as an MCP Bundle — a zip with a manifest.json that Claude Desktop reads directly:

  1. Download mac-control-mcp-v<version>.mcpb from the latest release.
  2. Double-click the .mcpb file. Claude Desktop opens an install dialog.
  3. Click Install. The server is registered under the name mac-control-mcp and available immediately in new chats.
  4. First tool call triggers the macOS TCC consent prompts (Screen Recording, Accessibility, Apple Events). Grant all three once — the bundle is Developer-ID signed and notarized, so grants persist across updates.

It's also listed on the official MCP Registry as io.github.AdelElo13/mac-control-mcp, so any MCP client that supports the registry will find it by searching for "mac-control".

2. Install via npm / npx

For clients that are configured with a command line rather than a file path. The npm package mac-control-mcp is a thin launcher: it has no runtime dependencies, and on install it downloads the notarized MacControlMCP.app for that exact version from this repo's GitHub release, verifies it against the published .sha256, refuses any archive entry that escapes the install directory, and re-checks the bundle with codesign --verify --deep --strict, spctl --assess --type execute and a pinned Team ID (A3W973JZ49). The first run therefore pulls ~3 MB; later runs are local.

Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "mac-control-mcp": {      "command": "npx",      "args": ["-y", "mac-control-mcp"]    }  }}

Claude Code:

bash
claude mcp add mac-control-mcp -- npx -y mac-control-mcp

Cursor — ~/.cursor/mcp.json:

json
{  "mcpServers": {    "mac-control-mcp": {      "command": "npx",      "args": ["-y", "mac-control-mcp"]    }  }}

ChatGPT (developer mode, local MCP connector) — mcp.json:

json
{  "mcpServers": {    "mac-control-mcp": {      "command": "npx",      "args": ["-y", "mac-control-mcp"],      "transport": "stdio"    }  }}

Two flags are handled by the launcher itself instead of being forwarded to the binary:

bash
npx -y mac-control-mcp --version    # version of the bundled .appnpx -y mac-control-mcp --app-path   # path to MacControlMCP.app

--app-path is what you need when granting macOS permissions by hand. Note that TCC grants go to the MCP host application that launches this process (Claude Desktop, Cursor, your terminal), not to npx or to the script — run the permissions_status tool once from your client to see which grants are missing and which app they belong to.

MAC_CONTROL_MCP_SKIP_DOWNLOAD=1 skips the download (CI, sandboxed builds); HTTPS_PROXY and NO_PROXY are honoured.

3. Download the prebuilt app

If you don't use Claude Desktop or want manual control:

  1. Download MacControlMCP-v<version>-macos-universal.tar.gz from the latest release.
  2. Extract and move MacControlMCP.app to ~/Applications/.
  3. Point your MCP client at the binary inside:
json
{  "mcpServers": {    "mac-control-mcp": {      "type": "stdio",      "command": "/Users/you/Applications/MacControlMCP.app/Contents/MacOS/MacControlMCP"    }  }}

Add that block to ~/Library/Application Support/Claude/claude_desktop_config.json (Claude Desktop) or ~/.claude.json → mcpServers (Claude Code).

Verify the download with the published SHA-256:

bash
shasum -a 256 MacControlMCP-v<version>-macos-universal.tar.gz# should match MacControlMCP-v<version>-macos-universal.sha256 on the release

4. Build from source

For contributors or if you want to tweak the code. Requires Swift 6 / Xcode 16+:

bash
git clone https://github.com/AdelElo13/mac-control-mcp.gitcd mac-control-mcp./scripts/build-bundle.sh

Produces ~/Applications/MacControlMCP.app/Contents/MacOS/MacControlMCP. Without a Developer ID cert in your keychain it'll fall back to ad-hoc signing (works for local use, TCC grants reset on every rebuild).

To re-sign + re-notarise an existing Apple Developer account:

bash
# one-time: store notary credentials in keychainxcrun notarytool store-credentials "mac-control-mcp" \    --apple-id "[email protected]" --team-id "XXXXXXXXXX"
# subsequent builds:NOTARIZE_PROFILE=mac-control-mcp ./scripts/build-bundle.sh

Tool surface

Selected categories — this table is a curated subset, not the full list. For the complete, auto-generated tool reference (every tool, its description, and its required/optional parameters, regenerated straight from the tool registry so it can't drift), see docs/TOOLS.md.

CategoryTools
Permissionspermissions_status, request_permissions
Accessibilityfind_element(s), query_elements, list_elements, get_ui_tree, ax_tree_augmented, get_element_attributes, set_element_attribute, read_value, perform_element_action, wait_for_element, scroll_to_element
App lifecyclelist_apps, launch_app, activate_app, quit_app, force_quit_app, wait_for_app, focused_app
Windowslist_windows, focus_window, move_window, resize_window, set_window_state, wait_for_window, move_window_to_display
Inputclick, mouse_event, drag_and_drop, scroll, type_text, press_key, press_key_sequence, key_down, key_up, convert_coordinates
Menusclick_menu_path, list_menu_paths, list_menu_titles
Browserbrowser_list_tabs, browser_get_active_tab, browser_navigate, browser_new_tab, browser_close_tab, browser_eval_js, browser_dom_tree, browser_visible_text, browser_iframes
Screencapture_screen, capture_screen_v2, capture_window, capture_display, ocr_screen
Clipboardclipboard_read, clipboard_write, clipboard_clear
Spotlightspotlight_search, spotlight_open_result
Systemset_volume, set_dark_mode, list_displays
File dialogsfile_dialog_set_path, file_dialog_select_item, file_dialog_confirm, file_dialog_cancel, wait_for_file_dialog
Apple appsmail_send, imessage_send, imessage_list_recent, calendar_create_event, calendar_list_events, reminders_create, reminders_list, contacts_search
Voice & recordingspeech_to_text, text_to_speech, audio_record, record_screen
Undoundo_last_action, undo_peek
153 tools total — see [docs/TOOLS.md](docs/TOOLS.md) for the complete, generated list.

Which tool when

Several tools overlap in purpose. Based on their actual implementations:

Screen capture — capture_screen vs capture_screen_v2 vs capture_window vs capture_display

  • capture_screen — main display (or a rectangular region within it) to a PNG file, returns the file path + width/height. Simple, synchronous, no size limits applied.
  • capture_screen_v2 — main display only, but stores the PNG as a content-addressed artifact under ~/.mac-control-mcp/artifacts/<sha256>.png and returns {content_ref, bytes, sha256}. Defaults to inline=false and downscales to max_dimension/max_bytes (4000px / 4MB by default) specifically to avoid blowing up an MCP client's context window with a huge inline image (referenced in its own description as a fix for claude-code issues #13383/#45785). Prefer this one when the image is going back through an LLM context rather than straight to disk.
  • capture_window — screenshots one specific window by PID (optionally filtered by title_contains), not the whole display.
  • capture_display — screenshots one specific physical display by its index from list_displays, for multi-monitor setups.

Accessibility tree / element lookup — find_element vs find_elements vs query_elements vs list_elements vs get_ui_tree vs ax_tree_augmented

  • list_elements — lists actionable elements for a PID (a flat, practical "what can I click" view).
  • find_element — returns the first element matching a role/title filter for a PID.
  • find_elements — same matching as find_element, but returns all matches, not just the first.
  • query_elements — regex search over role/title/value (falls back to case-insensitive substring on invalid regex); use when a plain role/title filter isn't precise enough.
  • get_ui_tree — walks the full accessibility tree of a process, including containers, and assigns stable element IDs for follow-up calls. Heavier than list_elements/find_element(s), but the only one that gives you structure/hierarchy.
  • ax_tree_augmented — like get_ui_tree, but does one OCR pass and geometrically joins OCR-derived labels onto AX nodes that have no native label. Use it specifically for Electron/Chromium/Canvas apps where the native AX tree is sparse and unlabeled; it's the expensive option (an OCR pass), so reach for get_ui_tree first and fall back to this when nodes come back unlabeled.

Security model

  • Tools that write files (capture_*, ocr_screen) validate output_path via a strict allow-list — only the user-scoped temp dir (NSTemporaryDirectory()) and ~/Desktop, ~/Documents, ~/Downloads, ~/Pictures are accepted. Symlinks at the target path are rejected to prevent redirection. /tmp is deliberately excluded because it's shared across users and opens a TOCTOU window.
  • AppleScript string interpolation for browser_eval_js wraps user code in (0, eval)(…) via JSON.stringify, so quotes/newlines/unicode can't break out of the wrapper.
  • No network calls. Everything is local system integration.
  • Password fields are off limits in code, not by instruction. A field with role or subrole AXSecureTextField never returns its value or length, and every write route is refused with reason: secure_field: element writes, text_* edits, act, untargeted type_text, and text keys or Cmd+V via press_key, press_key_sequence and key_down while such a field has focus. While such a field has focus, menu-bar and context-menu items (Paste, Start Dictation, Emoji & Symbols) cannot be pressed either; pop-up and combo-box option menus stay usable. Navigation keys (Tab, Return, Escape, arrows) still work, so the agent can hand the field to the user. browser_eval_js runs arbitrary page JavaScript and is not covered by this guard.

Status (verified in the current release)

ScopeState
Unit / integration test suiteswift test, all green locally and on CI (macos-15) — see ci.yml
Live tool probeA subset of tools exercised end-to-end via real MCP stdio against the running binary, all pass
Destructive tools (volume, dark mode, force_quit_app, drag_and_drop, file_dialog_*)Verified live in a reversible way
Code signingDeveloper ID Application (A3W973JZ49) with hardened runtime
Apple notarizationAccepted by Apple Notary Service, ticket stapled, spctl reports source=Notarized Developer ID
Gatekeeper flowExtracted + launched with the com.apple.quarantine xattr set; no right-click-open needed
MCP RegistryPublished as io.github.AdelElo13/mac-control-mcp (see server.json for the current version) — distributed as an .mcpb bundle for one-click install
ArchitecturesUniversal binary (arm64 + x86_64). Intel slice compiles cleanly but has not been runtime-verified on actual Intel hardware
move_window_to_displaySkipped — requires a 2+ display setup

If you run into an untested path, please open an issue with the reproduction — happy to fix fast.

Caveats

  • Cross-origin iframes block browser_eval_js — same-origin policy, not a limitation of the tool. Use AX coords or synthetic CGEvents for content inside embedded iframes from other origins.
  • First-run TCC prompts are unavoidable. macOS requires the user to grant Screen Recording, Accessibility and Apple Events the first time. The usage-description strings in Info.plist make the consent dialogs show up with a clear reason, but you still need to click Allow in System Settings once.

Development

bash
# Run the test suiteswift test
# Build without packagingswift build -c release
# Live probe the running binary via MCP stdiopython3 scripts/mcp-sweep.py  # if included

License

MIT — see LICENSE.

Contributing

Issues and pull requests welcome. Adversarial reviews especially — prior releases went through 11 rounds of external review before shipping.

来源:README.md,提交 949403a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v0.10.3最新Oct 16, 2026
  2. v0.10.2Oct 14, 2026
  3. v0.10.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分