
Hammerspoon
io.github.mobabur94Published by GitHub account mobabur94v0.1.0Updated Oct 25, 2026
macOS automation via Hammerspoon — 75 tools for windows, Spaces, audio, Bluetooth, and more
Overview
A local MCP server that gives an AI assistant programmatic control of macOS through Hammerspoon: windows, Spaces, audio, Bluetooth, Focus mode and system state.
- What you can do
- List, focus, move and resize windows, apply or save layout presets, and manage Spaces and virtual desktops, including Mission Control toggles and moving windows between Spaces. Launch, activate and quit applications, and simulate clicks, typing and hotkeys. Capture screenshots, read display and cursor info, and adjust brightness. List and switch audio devices, volume and mute, and control Bluetooth power, pairing and connections. Read and change system state such as battery, Wi-Fi, volume, dark mode, clipboard, notifications, timers and sleep prevention. Watch live OS events (apps, Wi-Fi, USB, battery, screens, files, sleep, clipboard, URLs) and run shell commands, open URLs, or evaluate Lua
- When to use it
- Useful when you want an assistant to operate a Mac directly rather than by screenshots and clicks: arranging windows, switching audio or Bluetooth devices, moving apps between Spaces, starting Focus sessions, or reacting to system events. It suits macOS users who already use or are willing to install Hammerspoon.
- Requirements
- macOS 13 or later, Node.js (22+ stated, 20 reportedly works), and Hammerspoon installed with the hs.ipc module enabled in its init.lua. Bluetooth tools additionally need blueutil. Accessibility permission is required for window, input and app control; Screen Recording is needed for screenshots. No API keys or accounts.
Installation
In SourceWeft
- Open Hammerspoon in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
hammerspoon-mcp
Give AI agents deep control over macOS — windows, audio, Bluetooth, Spaces, Focus mode, and 200+ OS APIs — through one MCP server.
[macOS 13+] [Node 22+] [MIT License] [TypeScript]
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
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.
Architecture
MCP Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Claude Code
Cursor / VS Code / Copilot
Add to .vscode/mcp.json:
Kiro
Add to ~/.aws/amazonq/mcp.json:
Tools
🪟 Window Management (7)
🖥️ Spaces / Virtual Desktops (9)
📱 Application Control (3)
⌨️ Input (3)
🖼️ Screen (3)
🔊 Audio Devices (6)
🔵 Bluetooth (5)
Requires blueutil:
brew install blueutil
🌙 Focus / Do Not Disturb (6)
🔋 System State (6)
🔆 Display (1)
⏱️ Timers (3)
📁 Finder / Files (4)
🛠️ Utilities (5)
👁️ Watchers — Live OS Event Streams (13)
🧪 Escape Hatch (1)
This gives access to all 200+ Hammerspoon modules not covered by dedicated tools — USB details, serial ports, network interfaces, Canvas drawing, menubar items, etc.
Resources (Subscriptions)
MCP clients can subscribe to resource URIs and receive push notifications when OS events fire:
How event streaming works
Examples
"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%"
Compared to Alternatives
Prerequisites
The
hsCLI symlink (hs.ipc.cliInstall()) is optional — the server auto-discovers the binary inside the Hammerspoon app bundle.
Verify setup
If this works, npx hammerspoon-mcp will connect successfully.
Permissions
Project Structure
Development
How It Works
- Startup — the bridge auto-discovers the
hsbinary (checks~/.local/bin,/usr/local/bin,/opt/homebrew/bin, app bundle) and validates connectivity - Tools execute synchronously via
hs -c '<lua>'— typically 30–80ms per call. Stdout noise (-- Loading extension: ...) is stripped automatically - Watchers inject Lua code that writes JSON lines to a FIFO pipe; a Node reader process emits them as MCP resource updates
- Resources buffer the last 50 events per watcher; clients read on-demand after receiving update notifications
- Graceful shutdown stops all watchers and cleans up the pipe on SIGINT/SIGTERM
Known Limitations
- Node.js 22+ is specified in
enginesbut the server builds and runs fine on Node 20 (tested) hs_spaces_goto,addSpaceToScreen,removeSpacebriefly flash Mission Control (macOS limitation — enable "Reduce motion" to minimize)- Bluetooth tools require blueutil (
brew install blueutil) - Focus/DND reading uses heuristics (no public Apple API exists)
hs_screenshotreturns base64 — large for full-screen captures- Saved layouts persist only in Hammerspoon's runtime (lost on HS reload)
- Named pipe path is
/tmp/hs-mcp-events.pipe— only one server instance at a time
License
MIT © 2026 Mohammed Babur
Source: README.md at commit 388b47d
Tools
0Version history
1- v0.1.0LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts