Skip to main content
Glama

The Problem

There are 7+ macOS automation MCP servers. None of them remember anything. Every session starts from zero — same trial and error, same failures, same wasted tokens.

Related MCP server: openowl

The Solution

Mac-Pilot is different. It learns from every interaction:

  • Success? The pattern is auto-saved as app-specific knowledge

  • Failure? The error is recorded so it won't repeat the same mistake

  • Multi-step workflow? Save it as a recipe — replay it in one call next time

Ships with 21 built-in recipes so you're productive from the first run.


Quick Start

Install

npm install -g mac-pilot-mcp

Connect to your AI client

claude mcp add mac-pilot -- mac-pilot-mcp

Or manually add to ~/.claude.json:

{
  "mcpServers": {
    "mac-pilot": {
      "command": "mac-pilot-mcp"
    }
  }
}

Add to claude_desktop_config.json:

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

Add to your MCP settings (.cursor/mcp.json):

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

Add to your MCP config:

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

Grant Permissions

Mac-Pilot needs Accessibility access for UI automation:

  1. System Settings → Privacy & Security → Accessibility

  2. Toggle ON for your terminal app (Terminal, iTerm2, VS Code, Cursor, etc.)

  3. Restart the terminal


How It Works

You: "Export the current Figma frame as PNG"

┌─ First time ─────────────────────────────────────────┐
│                                                       │
│  1. mac_recipe_search("Figma export") → No matches   │
│  2. mac_state() → Figma is frontmost                 │
│  3. mac_run(applescript) → File > Export > PNG        │
│  4. mac_recipe_save("export-figma-png", steps=[...]) │
│                                                       │
│  ✓ Worked! Pattern saved automatically.              │
└───────────────────────────────────────────────────────┘

┌─ Next time ───────────────────────────────────────────┐
│                                                       │
│  1. mac_recipe_search("Figma export")                │
│     → Found: export-figma-png (100% success rate)    │
│  2. mac_recipe_run("export-figma-png")               │
│     → Done instantly                                  │
│                                                       │
│  ⚡ 4 steps → 2 steps. No trial and error.           │
└───────────────────────────────────────────────────────┘

Tools

Tool

What it does

mac_run

Execute AppleScript, JXA, shell commands, open apps/URLs, click, type, keypress

mac_state

Query system state — frontmost app, windows, clipboard, running apps

mac_find_ui

Find UI elements via Accessibility API (buttons, fields, menus)

mac_screenshot

Capture screen/window/region as base64 PNG

mac_recipe_save

Save a working action sequence as a reusable recipe

mac_recipe_run

Replay a saved recipe with parameter substitution

mac_recipe_search

Full-text search across recipes and action history


Built-in Recipes

21 recipes ship out of the box — no setup needed:

Category

Recipes

Example

System

toggle-dark-mode set-volume mute-toggle lock-screen show-desktop screenshot-desktop empty-trash get-dark-mode

mac_recipe_run { name: "toggle-dark-mode" }

Finder

new-finder-window get-selected-files

mac_recipe_run { name: "new-finder-window", params: { path: "/tmp" } }

Safari

safari-current-url safari-current-title

mac_recipe_run { name: "safari-current-url" }

Clipboard

get-clipboard set-clipboard

mac_recipe_run { name: "set-clipboard", params: { text: "Hello" } }

Notifications

notify

mac_recipe_run { name: "notify", params: { title: "Done", message: "Build passed" } }

Terminal

open-terminal-at kill-process

mac_recipe_run { name: "open-terminal-at", params: { path: "~/dev" } }

Windows

list-windows close-front-window

mac_recipe_run { name: "close-front-window" }

Music

music-play-pause music-next-track

mac_recipe_run { name: "music-play-pause" }


Examples

AppleScript

{ "actionType": "applescript", "script": "tell application \"Finder\" to get name of every window" }

JXA (JavaScript for Automation)

{ "actionType": "jxa", "script": "Application('Safari').documents[0].url()" }

Shell command

{ "actionType": "shell", "command": "ls -la ~/Desktop" }

Open an app or URL

{ "actionType": "open", "target": "Safari" }
{ "actionType": "open", "target": "https://github.com" }

Type text

{ "actionType": "type", "text": "Hello World" }

Keyboard shortcut

{ "actionType": "keypress", "text": "cmd+c" }
{ "actionType": "keypress", "text": "cmd+shift+4" }

Find UI elements

mac_find_ui { "app": "Safari", "role": "AXButton" }
mac_find_ui { "app": "Finder", "searchText": "Downloads" }

Electron apps (VSCode / Cursor / Slack / Discord) — macOS Accessibility exposes a thin tree for Electron, so Mac-Pilot can optionally fall back to Chrome DevTools Protocol when the app is launched with --remote-debugging-port=<PORT>. See docs/ELECTRON-SUPPORT.md.

mac_find_ui {
  "app": "Visual Studio Code",
  "searchText": "Run Test",
  "useElectronFallback": "auto"
}

Take a screenshot

mac_screenshot { "target": "screen", "scale": 0.3 }
mac_screenshot { "target": "window", "windowName": "Safari" }

Save a custom recipe

mac_recipe_save {
  "name": "open-project",
  "description": "Open VS Code at project directory",
  "steps": [
    { "actionType": "shell", "params": { "command": "code {{path}}" }, "description": "Open VS Code" }
  ],
  "parameters": [
    { "name": "path", "description": "Project directory path" }
  ],
  "tags": ["dev", "vscode"]
}

Security

Mac-Pilot blocks dangerous operations before they execute:

Layer

Protection

Hard block

sudo, rm -rf /, curl|sh, dd if=, $() subshell injection, keychain access, csrutil disable, diskutil erase, and 20+ patterns

Risk classification

Every action is rated low / medium / high / blocked

Audit log

All actions (including blocked ones) are logged to SQLite

Dry run

Test any action with dryRun: true before executing

Auto-cleanup

Action logs older than 30 days are pruned automatically


Architecture

~/.mac-pilot/pilot.db (SQLite, WAL mode)
├── action_log       — Every action executed, with timing + success/failure
├── action_log_fts   — Full-text search index over action history
├── recipes          — Saved automation sequences
├── recipes_fts      — Full-text search index over recipes
├── app_knowledge    — Per-app quirks, selectors, workarounds (auto-learned)
└── security_log     — Blocked command audit trail

Built-in recipes are auto-loaded on first run. Your custom recipes and learned knowledge persist across sessions.


Comparison

Feature

mac-pilot-mcp

Other MCP servers

Self-learning (auto-saves knowledge)

Yes

No

Reusable recipes with parameters

Yes

No

Built-in recipe library

21

0

JXA + AppleScript

Both

Usually one

Full-text search (recipes + history)

Yes

No

Security audit log

Yes

Rare

Risk classification (4 levels)

Yes

No

Dry run mode

Yes

Rare

Action log auto-cleanup

Yes

No


Troubleshooting

Your terminal needs Accessibility permission:

  1. System Settings → Privacy & Security → Accessibility

  2. Toggle ON for your terminal

  3. Restart the terminal app completely

The target app must be running. Open it first:

mac_run { "actionType": "open", "target": "AppName" }

Reduce the scale (default is 0.5):

mac_screenshot { "target": "screen", "scale": 0.3 }

Recipe names are case-sensitive. Search first:

mac_recipe_search { "query": "your keyword" }

Use dry run to check the risk classification:

mac_run { "actionType": "shell", "command": "your-command", "dryRun": true }

Requirements

  • macOS (darwin only)

  • Node.js >= 18

  • Accessibility permission for UI automation


Contributing

Issues and PRs welcome at github.com/leesgit/mac-pilot-mcp.

git clone https://github.com/leesgit/mac-pilot-mcp.git
cd mac-pilot-mcp
npm install
npm run build
npm test        # 144 tests

License

MIT - Byeongchang Lee

Available Tools

11 tools
mac_clipboardA

Read / write / clear the macOS clipboard (text only, via pbpaste/pbcopy).

Examples:

  • Read text: { action: "read" }

  • Write text: { action: "write", text: "hello" }

  • Clear: { action: "clear" }

Limitations:

  • Text only. Images/files in the clipboard appear as their typed name.

  • No clipboard history — only the current value.

Inputs: action (required), text.

mac_find_uiA

Find UI elements (role, title, position, size) in an app via Accessibility, with optional Electron CDP fallback.

Examples:

  • All buttons in Safari: { app: "Safari", role: "AXButton" }

  • Element by title: { app: "Mail", title: "Send" }

  • Fuzzy search: { app: "Finder", searchText: "Documents" }

  • Electron AX (VSCode with --remote-debugging-port=9222): { app: "Visual Studio Code", useElectronFallback: true }

  • Auto-fallback for known Electron apps: { app: "Cursor", useElectronFallback: "auto" }

Limitations:

  • Requires Accessibility permission for the client app.

  • Electron apps (VSCode, Cursor, Slack, Discord) expose a thin AX tree; use useElectronFallback when AX returns empty.

  • CDP fallback needs the user to relaunch the app with --remote-debugging-port=.

Inputs: app (required), role, title, maxResults, +3 more.

mac_permissionsA

Check macOS Privacy permissions (Automation/Accessibility/Screen Recording) + deep-link to grant.

Examples:

  • { check: "all" } → return state of all 3 permissions

  • { check: "accessibility" } → only Accessibility

Limitations:

  • macOS doesn't expose TCC state to ordinary processes. We probe by attempting a known-safe operation and observing the error class.

  • "Screen Recording" cannot be detected reliably without invoking a screenshot; we report "unknown" instead of guessing.

Inputs: check.

mac_recipe_exportA

Export user-saved recipes as a portable .mac-recipe.json bundle (built-ins excluded by default).

Examples:

  • Export one recipe inline: { name: "open-url-in-private" }

  • Export all user recipes to a file: { outputPath: "~/recipes/backup.json" }

  • Include built-ins: { outputPath: "~/recipes/full.json", includeBuiltins: true }

Format: mac-recipe-bundle/v1 (versioned for forward compatibility). Limitations: outputPath must resolve under $HOME and end with .json.

Inputs: name, outputPath, includeBuiltins.

mac_recipe_importA

Import a .mac-recipe.json bundle (inline or file path). Conflict policy: skip | rename | replace.

Examples:

  • From file: { inputPath: "~/recipes/team-bundle.json" }

  • From file with replace policy: { inputPath: "~/recipes/team.json", onConflict: "replace" }

  • Inline bundle: { bundle: { format: "mac-recipe-bundle/v1", exportedAt: "...", recipes: [...] } }

Conflict policy:

  • "skip" (default): keep existing recipe

  • "rename": append "-imported-N" until name is unique

  • "replace": delete existing first

Limitations:

  • Provide exactly one of bundle or inputPath.

  • Bundle format major version is enforced — v2 bundles rejected.

Inputs: bundle, inputPath, onConflict.

mac_recipe_runA

Run a saved recipe by name with parameter values.

Examples:

  • { name: "toggle-dark-mode" }

  • { name: "open-url-in-private", params: { url: "https://example.com" } }

  • Dry run (preview steps): { name: "send-email", params: { ... }, dryRun: true }

Limitations:

  • Stops on the first failed step (no partial rollback).

  • Each step inherits the recipe's app as appContext for self-learning.

Inputs: name (required), dryRun, params.

mac_recipe_saveA

Save a multi-step automation as a named recipe. {{param}} placeholders are JSON-safe substituted.

Example: { name: "open-url-in-private", description: "Open a URL in Safari private window", app: "Safari", steps: [ { actionType: "open", params: { target: "Safari" }, description: "Launch Safari" }, { actionType: "keypress", params: { text: "cmd+shift+n" }, description: "Open private window" }, { actionType: "keypress", params: { text: "cmd+l" }, description: "Focus address bar" }, { actionType: "type", params: { text: "{{url}}" }, description: "Enter URL" }, { actionType: "keypress", params: { text: "return" }, description: "Navigate" } ], parameters: [{ name: "url", description: "URL to open" }], tags: ["safari", "browser", "private"] }

Limitations:

  • Recipe names are unique. Re-saving the same name fails — delete or rename.

  • Each step's params goes through the security sandbox at run time.

Inputs: name (required), steps (required), description (required), app, +2 more.

mac_runA

Run an AppleScript/JXA/shell command or send click/type/keypress to macOS.

Supported actionTypes: applescript, jxa, shell, open, click, type, keypress.

Examples:

  • Open Safari: { actionType: "open", target: "Safari" }

  • Type text: { actionType: "type", text: "hello world" }

  • Cmd+C: { actionType: "keypress", text: "cmd+c" }

  • Run AppleScript: { actionType: "applescript", script: 'tell application "Finder" to activate', appContext: "Finder" }

  • List files: { actionType: "shell", command: "ls -la ~/Documents" }

Limitations:

  • Requires Accessibility + Automation permissions for click/type/keypress and AS targeting other apps.

  • Cannot bypass the lock screen.

  • Dangerous shell patterns (rm -rf /, curl|sh, sudo, etc.) are blocked by the sandbox.

  • Set appContext for the best self-learning: errors get classified per-app and reliable hints are auto-prepended on subsequent calls.

Inputs: actionType (required), x, y, text, +6 more.

mac_screenshotA

Capture screen, window, or region as base64 PNG.

Examples:

  • Full screen: { target: "screen" }

  • Specific app window: { target: "window", windowName: "Safari" }

  • Region (x,y from top-left): { target: "region", region: { x: 0, y: 0, width: 800, height: 600 } }

  • High-fidelity capture: { target: "screen", scale: 1.0 } (warning: larger token cost)

Limitations:

  • Requires Screen Recording permission (System Settings → Privacy & Security → Screen Recording).

  • Default scale is 0.5 to keep token cost reasonable; bump for OCR-quality captures.

  • Cursor is not included in the capture.

Inputs: target (required), scale, region, windowName.

mac_stateA

Read current macOS state: frontmost app, windows, Finder selection, running apps.

Examples:

  • All state: {} (returns everything)

  • Window list only: { include: ["windows"] }

  • Frontmost app: { include: ["frontmost_app"] }

Limitations:

  • Window list requires Accessibility for the apps you want to see.

  • "clipboard" still works but mac_clipboard is preferred (lighter + write support).

Inputs: include.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool targets a distinct aspect of macOS automation: mac_run executes commands, mac_state reads system state, mac_clipboard manages the clipboard, mac_find_ui inspects UI elements, mac_screenshot captures the screen, and the recipe* tools cover the full recipe lifecycle. There is no meaningful overlap; even mac_run and mac_recipe_run are clearly separated by ad-hoc vs saved workflows.

    Naming Consistency4/5

    All tools share the mac_ prefix and use snake_case, but the verb/noun order varies: mac_run and mac_find_ui are verb-first, while mac_state and mac_permissions are noun-first, and recipe tools use recipe_verb (e.g., mac_recipe_export). This is a minor deviation from a fully consistent verb_noun pattern but remains predictable and readable.

    Tool Count5/5

    With 11 tools, the server is well-scoped for macOS automation. It covers command execution, state inspection, clipboard, UI inspection, screenshots, permissions, and a complete recipe subsystem without bloating. The count sits comfortably in the ideal 3-15 range and each tool earns its place.

    Completeness4/5

    The tool surface covers core automation actions (run, state, UI, screenshot, clipboard) and a full recipe lifecycle (save, run, search, export, import). Minor gaps exist, such as no explicit recipe deletion or a dedicated list-all tool, but these can be worked around via search or export, so agent workflows are not severely hindered.

    Maintenance

    ActivityNo data
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for macOS that enables AI agents to control the desktop GUI through keyboard input, mouse actions, and screen captures. It provides stable low-level primitives for UI automation and agent-driven desktop workflows.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that gives any AI assistant eyes and hands on your desktop — screenshots, clicking, typing, OCR, window management, accessibility-tree queries, workflow recording.
      5
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Standalone MCP server that gives AI agents full GUI control over macOS — screenshots, mouse, keyboard, apps, clipboard, and multi-display — with zero private dependencies.
      20
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server that enables AI to fully control macOS — mouse, keyboard, terminal, screenshots, window management, UI element detection, and provides AI-optimized information reporting.
      36
      29 npm
      MIT