Hammerspoon MCP server
io.github.mobabur94/hammerspoon·v0.1.0·1 starsmacOS automation via Hammerspoon — 75 tools for windows, Spaces, audio, Bluetooth, and more
1 stars22 downloads/wk
Reviews
Write oneNobody has reviewed Hammerspoon yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
Hammerspoon tools (75, 9 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
hs_alertShow a large on-screen alert message (HUD-style overlay that auto-dismisses).
hs_audio_datasourcesList available data sources for a device (e.g., 'Internal Speakers' vs 'Headphones' on the same device). Can also set the active source.
hs_audio_defaultGet or set the default audio device. When setting, matches by name substring (case-insensitive).
hs_audio_devicesList all audio devices (input + output). Shows name, UID, type, volume, mute state, and whether it's the current default.
hs_audio_muteGet or toggle mute for a specific device or the default output.
hs_audio_volumeGet or set volume for a specific device (by name substring) or the default output. Volume is 0-100.
hs_audio_watchStart watching audio device changes (device added/removed, default changed, volume changed). Events appear as updates to resource `watcher://audio`.
hs_batteryGet battery status.
hs_bluetooth_connectConnect to a paired Bluetooth device by name or MAC address.
hs_bluetooth_devicesList paired Bluetooth devices with connection status. Use `connected: true` to filter to only connected devices.
hs_bluetooth_disconnectDisconnect a Bluetooth device by name or MAC address.
hs_bluetooth_powerTurn Bluetooth on or off.
hs_bluetooth_statusGet Bluetooth power state and discoverability.
hs_brightnessGet or set display brightness (0-100).
hs_caffeinatePrevent the Mac from sleeping for a duration. Like the `caffeinate` command but manageable.
hs_clickClick at screen coordinates.
hs_clipboardRead or write the system clipboard.
hs_dark_modeGet or toggle macOS dark mode.
hs_evalwrite actionExecute arbitrary Lua code in the Hammerspoon runtime. Returns the string result. Use for anything not covered by other tools.
hs_executewrite actionRun a shell command and return its output. Uses hs.execute which runs in the user's environment.
hs_finder_openOpen a path in Finder (file or folder). Reveals in Finder if it's a file.
hs_finder_selectionGet the currently selected files/folders in Finder.
hs_focus_cancel_timerwrite actionCancel a scheduled Focus mode timer (from hs_focus_schedule) without disabling DND.
hs_focus_install_shortcutwrite actionCreates helper Shortcuts for Focus mode control. Opens the Shortcuts app with instructions. You need to manually create: 1. "Enable DND" shortcut: Set Focus → Do Not Disturb → Turn On 2. "Disable DND" shortcut: Set Focus → Do Not Disturb → Turn Off 3. "Toggle Focus" shortcut: Set Focus → Do Not Disturb → Toggle This only needs to be done once.
hs_focus_scheduleEnable DND for a specified duration, then automatically disable it. Uses hs.timer.
hs_focus_shortcutEnable or disable Focus/DND using macOS Shortcuts app. Requires a shortcut named "Toggle Focus" to be installed. Use hs_focus_install_shortcut first if you haven't set one up. This is the most reliable method on macOS 13+.
hs_focus_statusGet the current Do Not Disturb / Focus mode status. Returns whether DND is active and the active focus profile name if available.
hs_focus_toggleToggle Do Not Disturb on/off via Control Center. Brief visual flash of Control Center is unavoidable.
hs_focus_windowFocus a window by its ID or by title substring match.
hs_get_clipboard_historyRead the full clipboard history buffer. Returns array of {text, timestamp, app}. Requires `hs_watch_clipboard_history` to be running.
hs_hotkeyPress a key combination. Examples: "cmd+c", "cmd+shift+4", "return", "escape".
hs_kill_appwrite actionQuit an application by name.
hs_launch_appLaunch or activate an application by name.
hs_list_appsList running applications.
hs_list_layoutsList all saved window layout names.
hs_list_watchersList all active watchers.
hs_list_windowsList all visible windows. Returns array of {id, app, title, frame: {x,y,w,h}, isMinimized}.
hs_mouse_positionGet current mouse cursor position.
hs_move_windowMove and/or resize a window by ID.
hs_notifywrite actionPost a macOS notification.
hs_open_urlOpen a URL in the default browser or a specific app.
hs_quicklookShow a Quick Look preview of a file (press Space equivalent).
hs_restore_layoutRestore a previously saved window layout by name. Windows are matched by app name + title.
hs_save_layoutSave the current window positions as a named layout. Can be restored later with hs_restore_layout.
hs_screensGet info about connected displays.
hs_screenshotTake a screenshot. Returns base64 PNG.
hs_spaces_activeGet the currently focused space ID and which screen it's on.
hs_spaces_addwrite actionCreate a new space on the specified screen (or main screen). Briefly flashes Mission Control.
hs_spaces_gotoSwitch to a specific space by ID or by index (1-based position on the main screen). Note: briefly flashes Mission Control.
hs_spaces_listList all Spaces across all screens. Returns per-screen arrays of space IDs with the active space marked. Also shows which windows are on each space.
hs_spaces_mission_controlToggle Mission Control, App Exposé, Launchpad, or Show Desktop.
hs_spaces_move_windowMove a window to a different space. The window stays focused but appears on the target space.
hs_spaces_removewrite actionRemove a space by ID. Cannot remove the active space or the last remaining space. Briefly flashes Mission Control.
hs_spaces_window_spacesShow which space(s) a window is on (some windows appear on all spaces).
hs_spaces_windowsList all windows on a specific space.
hs_system_infoGet detailed system information: hostname, OS version, CPU, memory, uptime, thermal state.
hs_timer_cancelwrite actionCancel a running timer by name.
hs_timer_listList all active timers.
hs_timer_startStart a named countdown timer. Shows a notification and emits an event when it fires. Useful for pomodoro, reminders, etc.
hs_trashMove a file or folder to Trash (reversible delete).
hs_typeType text at current cursor position.
hs_unwatchStop a watcher by its ID.
hs_volumeGet or set system volume (0-100).
hs_watch_appsStart watching application lifecycle events (activated, deactivated, launched, terminated, hidden, unhidden). Events appear as updates to resource `watcher://apps`.
hs_watch_batteryStart watching battery status changes (charge level, power source). Events appear as updates to resource `watcher://battery`.
hs_watch_clipboardStart watching pasteboard (clipboard) changes. Fires on every copy. Events appear as updates to resource `watcher://clipboard`.
hs_watch_clipboard_historyStart a clipboard history tracker. Maintains a ring buffer of recent clipboard entries (text, timestamp, source app). Events appear as updates to resource `watcher://clipboard_history`. Use `hs_get_clipboard_history` to read the full buffer.
hs_watch_pathsStart watching filesystem paths for changes. Events appear as updates to resource `watcher://paths`.
hs_watch_screensStart watching display configuration changes (monitors connected/disconnected/reconfigured). Events appear as updates to resource `watcher://screens`.
hs_watch_sleepStart watching system sleep/wake/lock/unlock events. Events appear as updates to resource `watcher://sleep`.
hs_watch_urlsStart watching URL events. Captures: (1) hammerspoon://mcp/... custom scheme URLs opened from other apps, (2) HTTP callback URLs if Hammerspoon is set as default browser. Events appear as updates to resource `watcher://urls`. Use this to let external apps trigger your agent via URLs.
hs_watch_usbStart watching USB device connect/disconnect events. Events appear as updates to resource `watcher://usb`.
hs_watch_wifiStart watching WiFi network changes. Events appear as updates to resource `watcher://wifi`.
hs_wifiGet current WiFi info.
hs_window_layoutApply a window layout preset. Presets: • "left-half" / "right-half" / "top-half" / "bottom-half" — snap focused window • "maximize" — fill screen (not fullscreen mode) • "center" — center at 70% screen size • "thirds-left" / "thirds-center" / "thirds-right" — vertical thirds • "quarters-tl" / "quarters-tr" / "quarters-bl" / "quarters-br" — quadrants • "cascade" — cascade all visible windows • "sid
Public scan report
scanner v0.1.9 · 2026-09-23 · same rubric, same numbers if you re-run it
- Code scan21 source files scanned8/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 47 days ago12/15
- Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
Findings (2)
- mediumeval / new Function used
exec.evaldist/audio-tools.js: …t per-device) return bridge.eval(` if _mcpAudioWatcher then _mcpA…
- highShell command built from a string (injection risk)
exec.shell-concatdist/bridge.js: … try { const result = execSync(`${this.hsPath} -c '${escaped}'`, { timeout: t…
How Hammerspoon compares
Against every graded Media MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 62/100
- higher than 16% of 1,337 Media servers
- Tools
- 75
- the typical Media server has 7
- Tools that change things
- 12%
- typical: 4%. Fewer write tools means less an agent can break
- GitHub stars
- 1
- more than 55% of 715 Media servers
- Downloads a week
- 22
- more than 9% of 365 Media servers with a package
What its tools let an agent do: 66 read · 9 change
Install Hammerspoon in Claude Code, Cursor or VS Code
Runs npx -y hammerspoon-mcp on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add hammerspoon -- npx -y hammerspoon-mcp
What the publisher says
From the Hammerspoon repository's README, as published. We do not edit it. Read it on GitHub
hammerspoon-mcp
Give AI agents deep control over macOS — windows, audio, Bluetooth, Spaces, Focus mode, and 200+ OS APIs — through one MCP server.
What is this?
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.
Quick Start
# 1. Install Hammerspoon (if you haven't)
brew install --cask hammerspoon
# 2. Enable the IPC module (one-time setup)
# Add this line to ~/.hammerspoon/init.lua:
# require("hs.ipc")
# Then reload your Hammerspoon config (Cmd+Alt+Ctrl+R or restart the app)
# 3. (Optional) Install the hs CLI symlink for convenience:
# Run in Hammerspoon console: hs.ipc.cliInstall()
# Or manually: ln -sf /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs ~/.local/bin/hs
# 4. Run the MCP server
npx hammerspoon-mcpNote: The server auto-discovers the hs binary — it checks ~/.local/bin/hs, /usr/local/bin/hs, /opt/homebrew/bin/hs, and the app bundle path. You don't need hs on your PATH if Hammerspoon is installed to /Applications.
Architecture
┌─────────────────────────────────────────────────────────┐
│ MCP Client (Claude, Cursor, MeshClaw, etc.) │
└──────────────────────────┬──────────────────────────────┘
│ stdio (JSON-RPC)
┌──────────────────────────▼──────────────────────────────┐
│ hammerspoon-mcp (Node.js) │
│ ├─ tools → execSync("hs -c '...'") (request/response)│
│ └─ watchers → named pipe reader (push events) │
└──────────────────────────┬──────────────────────────────┘
│ hs CLI / named pipe
┌──────────────────────────▼──────────────────────────────┐
│ Hammerspoon.app (Lua runtime + ObjC bridge) │
│ 200+ modules: window, screen, spaces, audio, wifi, │
│ bluetooth, battery, USB, filesystem, accessibility... │
└──────────────────────────┬──────────────────────────────┘
│
macOS APIs (CoreGraphics, IOKit, etc.)MCP Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claudedesktopconfig.json:
{
"mcpServers": {
"hammerspoon": {
"command": "npx",
"args": ["hammerspoon-mcp"]
}
}
}Claude Code
claude mcp add hammerspoon -- npx hammerspoon-mcpCursor / VS Code / Copilot
Add to .vscode/mcp.json:
{
"servers": {
"hammerspoon": {
"command": "npx",
"args": ["hammerspoon-mcp"]
}
}
}Kiro
Add to ~/.aws/amazonq/mcp.json:
{
"mcpServers": {
"hammerspoon": {
"command": "npx",
"args": ["hammerspoon-mcp"]
}
}
}Tools
🪟 Window Management (7)
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Hammerspoon: common questions
- Is Hammerspoon MCP server safe?
- With care: it is graded C, so read the findings first (62/100). Read the Hammerspoon safety report
- How do I install Hammerspoon?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does Hammerspoon need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is Hammerspoon maintained?
- The last commit was 88 days ago (2026-08-08). The latest release is v0.1.0.
- What can I use instead of Hammerspoon?
- Servers from other publishers that do the same job: Macos MCP server, FunASR MCP server and FFmpeg MCP server.
- How does Hammerspoon compare with other Media MCP servers?
- safety score 62/100 (higher than 16% of 1,337 Media servers); tools 75 (the typical Media server has 7); tools that change things 12% (typical: 4%. Fewer write tools means less an agent can break). Full comparison.
Alternatives to Hammerspoon
Same job from other publishers: the closest match first, then the best rated.
- MacosControl macOS settings, apps, windows, audio, Music, displays, screenshots, and Focus mode via MCP.not reviewedGrowingA
- FunASRTranscribe local audio with FunASR and SenseVoice using private, on-device inference.not reviewedEstablishedA
- FFmpegTrim, convert, resize, compress, and remix audio and video.not reviewedEstablishedA
- AudioEdit, analyze and convert audio: loudness, spec checks, denoise, EQ, cuts, BPM, key. No ffmpeg.not reviewedEstablishedA
Transloadit Media ProcessingProcess video, audio, images and documents with Transloadit Robots. Connect by URL with OAuth.not reviewedEstablishedA