@mcp-s/computer-use-mcp
v1.1.0
Published
Willow Computer Use: an MCP server that lets AI agents see and operate macOS apps through the Accessibility API.
Readme
Willow Computer Use MCP
An MCP server that lets AI agents see and operate macOS apps: read an app's accessibility tree, take a screenshot of its window, then click, type, scroll, drag, paste and set values.
It runs entirely on your Mac using the macOS Accessibility API, CoreGraphics input events and screencapture. No API keys, no cloud service.
Requirements
- macOS 13 or later (Apple silicon or Intel)
- Node.js 18+
MCP client configuration
{
"mcpServers": {
"computer-use": {
"command": "npx",
"args": ["-y", "@mcp-s/computer-use-mcp"]
}
}
}Permissions
macOS grants these permissions to the app that launches the server (Cursor, Claude, your terminal), not to the server itself. On first use macOS prompts for them; you can also turn them on ahead of time.
| Permission | Where | Needed for |
| --- | --- | --- |
| Accessibility | System Settings > Privacy & Security > Accessibility | Reading the UI tree and every action |
| Screen Recording | System Settings > Privacy & Security > Screen & System Audio Recording | Screenshots in get_app_state |
Restart the host app after granting a permission. Without Screen Recording the tools still work, but get_app_state returns the tree only.
Tools
| Tool | What it does |
| --- | --- |
| list_apps | Running apps plus apps installed in the Applications folders |
| get_app_state | Launches the app if needed; returns its accessibility tree (numbered elements) and a window screenshot |
| click | Click an element by element_index, or a point by x/y; button, click count, held modifiers |
| drag | Drag between two screenshot points |
| paste | Paste text, md or html through the clipboard, then restore the clipboard |
| perform_secondary_action | Run an accessibility action an element exposes (Show Menu, Increment, Cancel, Raise…) |
| press_key | Key or combination in xdotool syntax: Return, Tab, super+c, ctrl+shift+t, KP_0 |
| scroll | Scroll an element, a point or the window by a number of pages |
| select_text | Select text in an editable element, or put the cursor before or after it |
| set_value | Set a text field, slider or checkbox value directly |
| type_text | Type literal text with the keyboard |
How agents should use it
- Call
get_app_statewith the app name ("Safari"), bundle id ("com.apple.Safari") or.apppath. - Act using the element numbers from the tree. Fall back to screenshot
x/ywhen the tree is incomplete. - Call
get_app_stateagain after acting. Element numbers only apply to the latest state.
The server sends these instructions, plus a confirmation policy for risky actions (deleting data, sending messages, purchases, changing settings), to the client when it connects.
Behaviour to know about
- Everything runs in the background. The target app is never brought to the front and the real cursor and keyboard are never used, so you can keep working while an agent drives an app.
- macOS apps ignore mouse events posted to them while they are in the background, so mouse actions are carried out through accessibility instead:
clickpresses the button, link or menu item under the point, places the cursor in a text field (double click selects a word, triple click a paragraph), and right click opens the element's context menu.draginside a text field selects the text between the two points.scrolluses the scroll area's page actions or scroll bar, and falls back to Page Up/Page Down keys.- Clicks and drags on anything else (canvases, custom controls) are still posted as mouse events, and the result tells the agent they may have been ignored.
type_textandpasteinsert into the focused field through accessibility, falling back to keystrokes.press_keyposts keys to the app's process; plain keys work, but some apps ignore shortcuts such as Cmd+V while in the background. When a formattedpasteis ignored, the text is inserted as plain text and the result says so. Your clipboard is restored either way.- When a launched app brings itself to the front (some Chromium browsers do), focus is handed back to the app you were using.
- Screenshots are scaled so 1 pixel is 1 point (capped at 1600 px on the long side), and coordinates are relative to the window's top-left.
- For Chrome, Edge, Brave, Arc and Electron apps the server turns on their full accessibility tree the first time it reads them.
- Password managers and Keychain Access are blocked.
How it works
The npm package ships a small universal Swift binary (bin/computer-use-helper). The Node MCP server starts it once and sends it JSON requests over stdin and stdout. The helper keeps the element references from the last get_app_state per app, which is what element_index points to.
Development
npm install
npm run typecheck # TypeScript + Swift type check
npm run build # universal Swift helper + TypeScript
npm run smoke # MCP handshake, tool list, list_appsSource layout:
src/— MCP server (index.ts), helper process bridge (helper.ts), client instructionsnative/— Swift helper: accessibility tree, screenshots, input events, key parsingscripts/build-helper.sh— builds arm64 and x86_64, merges them withlipo, ad-hoc signs
To release, bump version in package.json and merge to main. When CI passes, tag-release.yml tags v<version> and release.yml builds on macOS (it compiles the Swift helper) and publishes to npm.
