Skip to main content
Glama

desktop-mcp

Guarded macOS desktop control for Claude Code in the terminal: read an app's accessibility tree, screenshot its window, click, type and scroll, via MCP.

It drives apps the way an accessibility tool does (macOS Accessibility API + synthetic keyboard and mouse events). It never modifies the apps it controls. It ships with a WhatsApp skill that teaches Claude Code to send messages safely through the WhatsApp desktop app.

Safety model

Guard

What it does

Allowlist

Only bundle ids in ~/.config/desktop-mcp/config.toml can be touched, or every non-blocked app with allow_all = true. Missing config = nothing allowed.

Hard blocklist

Terminals, IDEs, the Claude app, macOS password prompts/login window, Keychain/Passwords and password managers. Cannot be overridden by config (Claude must never approve its own permission prompts or enter passwords).

Frontmost check

Input events are only posted after verifying the target app is frontmost.

Hit test

Coordinate clicks are refused if another app's window covers the point.

Confirmation

Return/Enter, type_text(submit=True) and clicks on controls labelled send/submit/delete/pay/confirm/... open a native dialog. Default button is Deny; it times out to Deny after 60s.

Trusted chats

WhatsApp chats in whatsapp_trusted_chats skip the dialog, but only when the open chat's exact name matches and the message box holds exactly the typed text.

Draft protection

type_text refuses to type into a field that already has text, unless clear_existing=True. Before sending it reads the field back and refuses on any mismatch.

Focus watch

While typing, it checks after every character that the same field still has focus, and stops at once if not.

Human pacing

Randomised per-key timing (longer after spaces/punctuation, occasional pauses) and a delay after every click.

One at a time

A lock serialises all actions, including while a dialog is open.

Audit log

Every action goes to ~/.local/state/desktop-mcp/actions.jsonl.

Window-only screenshots

Captures the target app's window, never the whole screen.

Related MCP server: screenmcp-claude-plugin

Setup

Requires macOS and uv.

git clone https://github.com/Jenish-1235/desktop-mcp && cd desktop-mcp
uv sync

# 1. Config: you edit this, not Claude
mkdir -p ~/.config/desktop-mcp
cp config.example.toml ~/.config/desktop-mcp/config.toml

# 2. Register with Claude Code (user scope)
claude mcp add desktop -s user -- uv --directory "$PWD" run desktop-mcp

# 3. Optional: install the WhatsApp skill for all Claude Code sessions
mkdir -p ~/.claude/skills && cp -r skills/whatsapp ~/.claude/skills/
  1. macOS permissions, for the terminal app that runs claude (iTerm, Ghostty, Terminal, ...): System Settings → Privacy & Security → Accessibility and Screen Recording. Restart the terminal.

  2. In Claude Code, ask it to run check_setup.

After changing the server code, reload it with /mcp → desktop → Reconnect. Config changes apply immediately.

Add to ~/.claude/settings.json:

{
  "permissions": {
    "deny": [
      "Edit(~/.config/desktop-mcp/**)",
      "Write(~/.config/desktop-mcp/**)",
      "Bash(osascript:*)"
    ]
  }
}

Config

See config.example.toml:

Key

Default

Meaning

allowed_apps

[]

Bundle ids Claude may control (osascript -e 'id of app "WhatsApp"').

allow_all

false

Allow every app except the hard blocklist.

whatsapp_trusted_chats

[]

Exact chat names (as in "Messages in chat with …") that send without a dialog. Your own chat is "You".

type_delay

0.03

Median seconds per keystroke (0–0.5), randomised.

click_delay

0.5

Seconds to wait after each click (0–5).

Tools

check_setup, list_apps, open_app, ui_tree, screenshot, click_element, click, type_text, press_key, scroll.

Prefer ui_tree + click_element: element refs are exact and cost far fewer tokens than images. Use screenshot + click for apps with poor accessibility support.

Limits & known gaps

  • Coordinates assume the window doesn't move between screenshot and click (it checks the window id, not position).

  • Keycodes are ANSI US layout; type_text uses Unicode events so typing works on any layout.

  • Risky-click detection is label based. Unlabelled icon buttons won't trigger a dialog unless they're activated with Return.

  • Trusted chats match by name, so a group renamed to a trusted name would also count.

  • Claude Code's Bash tool can still run arbitrary osascript/cliclick; the deny rules above close the obvious path.

  • Web apps installed as Chrome apps (e.g. YouTube Music) are owned by Chrome; for websites, the Claude in Chrome extension is the better tool.

  • WhatsApp: keep it to occasional messages to people who know you. This doesn't change ban risk from volume or spam reports.

Dev

uv run pytest

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables high-speed native macOS automation for Claude by interacting directly with the Accessibility API, AppleScript, and UI trees instead of using screenshots. It allows users to read app states, click elements, and type text semantically across any macOS application.
      11 npm
      13
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables Claude Code to read and operate macOS app interfaces through the accessibility tree, pressing buttons, setting text fields, typing with IME support, sending shortcuts, scrolling, dragging, and capturing screenshots. It drives background apps without moving the mouse or stealing focus from the user's current work.
      12
      16 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Claude Code to drive macOS apps in the background through the computer-use engine bundled with the ChatGPT desktop app, sending clicks, drags, keystrokes, menu bar and notification interactions to target apps while the user's cursor, windows and other work stay untouched.
      6
      MIT