The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Hammerspoon listing page.
Give AI agents deep control over macOS — windows, audio, Bluetooth, Spaces, Focus mode, and 200+ OS APIs — through one MCP server.
An MCP server that bridges AI agents to Hammerspoon — the most powerful macOS automation tool available. Unlike screenshot-and-click tools, this gives agents programmatic OS-level access: manage windows by ID, switch audio devices by name, move apps between Spaces, toggle Focus mode, and subscribe to real-time OS events.
75 tools. 12 subscribable resources. Zero native dependencies.
Note: The server auto-discovers the
hsbinary — it checks~/.local/bin/hs,/usr/local/bin/hs,/opt/homebrew/bin/hs, and the app bundle path. You don't needhson your PATH if Hammerspoon is installed to/Applications.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Add to .vscode/mcp.json:
Add to ~/.aws/amazonq/mcp.json:
| Tool | Description |
|---|---|
hs_list_windows | All visible windows with app, title, frame, id |
hs_focus_window | Bring window to front by id or title match |
hs_move_window | Move/resize window by id |
hs_window_layout | 16 presets (halves, thirds, quarters, grid, cascade, center…) + custom fractional layouts |
hs_save_layout | Snapshot all window positions as a named layout |
hs_restore_layout | Restore a saved layout (matches by app + title) |
hs_list_layouts | List saved layout names |
| Tool | Description |
|---|---|
hs_spaces_list | All spaces per screen with active markers |
hs_spaces_active | Currently focused space + screen |
hs_spaces_goto | Switch by ID or index |
hs_spaces_move_window | Move window to another space (optionally follow) |
hs_spaces_add | Create a new space |
hs_spaces_remove | Remove a space (safety checks) |
hs_spaces_windows | Windows on a specific space |
hs_spaces_window_spaces | Which space(s) a window is on |
hs_spaces_mission_control | Toggle Mission Control / Exposé / Launchpad / Show Desktop |
| Tool | Description |
|---|---|
hs_list_apps | Running applications with bundle ID, PID, hidden state |
hs_launch_app | Launch or activate an app by name |
hs_kill_app | Quit an app |
| Tool | Description |
|---|---|
hs_click | Click at coordinates with button + modifier options |
hs_type | Type text (Unicode, CJK, emoji) |
hs_hotkey | Press key combo (e.g. "cmd+shift+4") |
| Tool | Description |
|---|---|
hs_screenshot | Capture full screen or region (base64 PNG) |
hs_screens | Display info (resolution, name, rotation) |
hs_mouse_position | Current cursor coordinates |
| Tool | Description |
|---|---|
hs_audio_devices | List all input/output with volume, mute, transport type |
hs_audio_default | Get/set default devices (fuzzy name match) |
hs_audio_volume | Volume on any specific device (0–100) |
hs_audio_mute | Mute/unmute/toggle any device |
hs_audio_datasources | List/switch data sources (speakers vs headphones) |
hs_audio_watch | Watch for device changes |
| Tool | Description |
|---|---|
hs_bluetooth_status | Power state and discoverability |
hs_bluetooth_power | On / off / toggle |
hs_bluetooth_devices | List paired or connected devices |
hs_bluetooth_connect | Connect by name (fuzzy) or MAC address |
hs_bluetooth_disconnect | Disconnect a device |
Requires blueutil:
brew install blueutil
| Tool | Description |
|---|---|
hs_focus_status | Check if DND/Focus is active + profile name |
hs_focus_toggle | Toggle via Control Center (no setup needed) |
hs_focus_shortcut | Enable/disable via macOS Shortcuts (most reliable) |
hs_focus_install_shortcut | One-time setup guide |
hs_focus_schedule | DND for N minutes with auto-disable |
hs_focus_cancel_timer | Cancel scheduled disable |
| Tool | Description |
|---|---|
hs_battery | Charge %, power source, time remaining |
hs_wifi | Current SSID and interface details |
hs_volume | System volume get/set |
hs_dark_mode | Get/toggle dark mode |
hs_notify | Post a macOS notification |
hs_clipboard | Read/write system pasteboard |
| Tool | Description |
|---|---|
hs_brightness | Get/set screen brightness (0–100) |
| Tool | Description |
|---|---|
hs_timer_start | Named countdown with notification on fire |
hs_timer_cancel | Cancel by name |
hs_timer_list | List active timers |
| Tool | Description |
|---|---|
hs_finder_selection | Get currently selected Finder items |
hs_finder_open | Open/reveal path in Finder |
hs_trash | Move to Trash (reversible) |
hs_quicklook | Quick Look preview |
| Tool | Description |
|---|---|
hs_system_info | CPU, memory, thermal state, uptime |
hs_caffeinate | Prevent sleep for N minutes |
hs_execute | Run shell command (user environment) |
hs_open_url | Open URL in browser or specific app |
hs_alert | HUD-style on-screen overlay message |
| Tool | Events |
|---|---|
hs_watch_apps | App activated, launched, terminated, hidden |
hs_watch_wifi | Network changes |
hs_watch_usb | Device connect/disconnect |
hs_watch_battery | Charge level, power source |
hs_watch_screens | Display configuration |
hs_watch_paths | Filesystem changes |
hs_watch_sleep | Sleep/wake/lock/unlock |
hs_watch_clipboard | Every pasteboard change |
hs_watch_clipboard_history | Ring buffer with source app tracking |
hs_get_clipboard_history | Read the full buffer |
hs_watch_urls | Incoming hammerspoon://mcp/... URLs |
hs_unwatch | Stop a watcher |
hs_list_watchers | List active watchers |
| Tool | Description |
|---|---|
hs_eval | Execute arbitrary Lua in the Hammerspoon runtime |
This gives access to all 200+ Hammerspoon modules not covered by dedicated tools — USB details, serial ports, network interfaces, Canvas drawing, menubar items, etc.
MCP clients can subscribe to resource URIs and receive push notifications when OS events fire:
| URI | Triggers |
|---|---|
watcher://apps | App lifecycle events |
watcher://wifi | Network changes |
watcher://usb | USB device events |
watcher://battery | Battery/power changes |
watcher://screens | Display reconfiguration |
watcher://paths | Filesystem changes |
watcher://sleep | Sleep/wake/lock events |
watcher://clipboard | Pasteboard changes |
watcher://clipboard_history | Clipboard ring buffer updates |
watcher://urls | Incoming URL events |
watcher://audio | Audio device changes |
hammerspoon://system | System info snapshot |
"Tile my editor and terminal side by side"
"Switch my audio to AirPods"
"Move Slack to Space 3"
"Start a 25-minute focus session"
"Notify me when I switch away from my IDE"
"Connect my headphones and set volume to 40%"
| Capability | hammerspoon-mcp | mac-use-mcp | macos-automator-mcp |
|---|---|---|---|
| Window management by ID | ✅ | ❌ | ❌ |
| Virtual desktop (Spaces) control | ✅ | ❌ | ❌ |
| Audio device switching | ✅ | ❌ | ❌ |
| Bluetooth control | ✅ | ❌ | ❌ |
| Focus / DND mode | ✅ | ❌ | ❌ |
| Real-time OS event subscriptions | ✅ | ❌ | ❌ |
| Clipboard history | ✅ | ✅ | ❌ |
| Arbitrary OS scripting | ✅ (Lua) | ❌ | ✅ (AppleScript) |
| Screenshot | ✅ | ✅ | ❌ |
| Click / type / hotkeys | ✅ | ✅ | ❌ |
| Accessibility tree queries | via hs_eval | ✅ | ❌ |
| Zero-install (no prerequisites) | ❌ | ✅ | ✅ |
| Total tools | 75 | 18 | ~10 |
| Requirement | Install |
|---|---|
| macOS 13+ | — |
| Node.js 22+ | brew install node |
| Hammerspoon | brew install --cask hammerspoon |
hs.ipc module | Add require("hs.ipc") to ~/.hammerspoon/init.lua |
| blueutil (optional) | brew install blueutil (for Bluetooth tools) |
The
hsCLI symlink (hs.ipc.cliInstall()) is optional — the server auto-discovers the binary inside the Hammerspoon app bundle.
If this works, npx hammerspoon-mcp will connect successfully.
| Permission | Required for | How to grant |
|---|---|---|
| Accessibility | Window, input, app control | System Settings → Privacy & Security → Accessibility → add your terminal |
| Screen Recording | hs_screenshot only | System Settings → Privacy & Security → Screen Recording |
hs binary (checks ~/.local/bin, /usr/local/bin, /opt/homebrew/bin, app bundle) and validates connectivityhs -c '<lua>' — typically 30–80ms per call. Stdout noise (-- Loading extension: ...) is stripped automaticallyengines but the server builds and runs fine on Node 20 (tested)hs_spaces_goto, addSpaceToScreen, removeSpace briefly flash Mission Control (macOS limitation — enable "Reduce motion" to minimize)brew install blueutil)hs_screenshot returns base64 — large for full-screen captures/tmp/hs-mcp-events.pipe — only one server instance at a timeMIT © 2026 Mohammed Babur