macos-computer-use
An ultra-fast native MCP server for macOS desktop automation, enabling visual OCR, text-based clicking, window management, and keyboard/mouse control without hijacking the physical cursor.
README
๐ macOS Computer Use (MCP Server)
An ultra-fast, native Model Context Protocol (MCP) server that gives LLMs and autonomous agents visual inspection and fail-closed desktop automation on macOS.
Built with a compiled Swift core leveraging Apple's native CoreGraphics, Vision OCR (VNRecognizeTextRequest), and Accessibility APIs for semantic background actions. Untargeted input remains an explicit global CoreGraphics fallback.
โก Key Highlights
- ๐ฏ Native Apple Vision OCR (
find_text/click_text): Finds visible text with explicitexact,word,prefix, orsubstringmatching and refuses ambiguous clicks unless an occurrence is selected. - ๐ก๏ธ Fail-Closed Targeting:
windowIdis authoritative. Invalid IDs and app/window mismatches return errors instead of falling back to another window or the full display. - โฟ Accessibility Actions: Targeted clicks invoke
AXPress, targeted scrolling adjusts AX scrollbars, and exact-window typing focuses the requested AX window before process delivery. - ๐ฑ๏ธ Live Agent Cursor: Clicks and scrolling glide a distinctive, click-through cursor overlay to the target, show success or failure feedback, and fade when idle without moving your physical pointer.
- ๐๏ธ Matching Screenshot Cursor (
mark_cursor): Returned action screenshots render the same agent cursor at the target coordinate. - โก Reactive UI Synchronization (
wait_for_text): Replaces blindsleep()timeouts with a high-speed OCR polling loop that resolves the instant dynamic autocomplete dropdowns, modals, or state changes appear. - ๐ผ๏ธ Window-Isolated Screen Capture: Captures target application buffers cleanly in the background (
screencapture -l <wid> -o -x) without bringing the window to the front or capturing overlapping windows.
๐ ๏ธ Tools Exposed
| Tool | Description | Key Parameters |
|---|---|---|
click_text |
Finds OCR text, glides the live cursor to it, resolves ambiguity, and invokes the matching Accessibility control. | text, matchMode, occurrence, appName, windowId, returnScreenshot |
find_text |
Inspects on-screen or window-specific text and returns exact bounding boxes and logical coordinates. | text, appName (optional), windowId (optional) |
wait_for_text |
Reactively polls the target window/screen until expected text appears (autocomplete dropdowns, toasts, sheets). | text, appName (optional), timeoutSeconds (default: 5.0) |
screenshot |
Captures the entire display or a specific background application window with optional virtual cursor rendering. | appName, windowId, maxWidth, format (jpeg | png), cursor ({x, y}) |
list_windows |
Lists open application windows, process IDs (pid), titles, and coordinate bounds in front-to-back Z-order. |
appName (optional filter) |
mouse_click |
Glides the live cursor to (x, y), then invokes the targeted AX control or performs an explicit global click. |
x, y, appName, windowId, relativeCoords, button, clickCount |
type_text |
Types into the active app or focuses an exact AX window before background process delivery. | text, appName (optional), windowId (optional) |
press_key |
Presses special keys or keyboard shortcuts with modifiers. | key (return, space, tab, escape, c, etc.), modifiers (command, shift, option, control) |
scroll |
Glides the live cursor to the target and adjusts an AX scrollbar; without a target, scrolls globally. | x, y, deltaY, deltaX, appName, windowId |
launch_app |
Launches or brings a macOS application to the front. | appName (e.g. Google Chrome, Safari, Finder, Slack, Notes) |
get_active_app |
Returns the currently active frontmost application name and window title. | None |
run_applescript |
Runs custom AppleScript for deep macOS Accessibility and UI hierarchy inspection. | script |
๐ Installation & Setup
Run with npx
Configure an MCP client to download, build, and launch the latest public package:
{
"mcpServers": {
"macos-computer-use": {
"command": "npx",
"args": ["-y", "macos-computer-use-mcp"]
}
}
}
The package includes an ad-hoc-signed universal Swift helper for Apple Silicon and Intel Macs, so npx does not require a local Swift compiler or install-script approval.
1. Prerequisites
- macOS 13.0+ (Apple Silicon or Intel)
- Node.js 20+
- Xcode Command Line Tools only when building from source:
xcode-select --install
2. Clone & Build
git clone https://github.com/johnexzy/macos-computer-use.git
cd macos-computer-use
npm install
npm run build
๐ Required macOS Permissions
To allow desktop capture and input simulation, grant your host application (Terminal, iTerm2, Antigravity, Cursor, or VS Code) permissions in System Settings > Privacy & Security:
- Screen & System Audio Recording: Required for
screenshotand visual OCR. - Accessibility: Required for
mouse_click,type_text, andpress_key.
๐ MCP Configuration
Add this server to your MCP client configuration:
Antigravity / Claude Desktop / Cursor / Windsurf
Add to your mcp_config.json / claude_desktop_config.json:
{
"mcpServers": {
"macos-computer-use": {
"command": "node",
"args": ["/absolute/path/to/macos-computer-use/server.mjs"]
}
}
}
๐งช Testing the Native Swift Helper Directly
You can test the native binary directly from your terminal:
# Display resolution and scaling
./native_helper size
# List active Chrome windows in Z-order
./native_helper list_windows "Google Chrome"
# Find a button or text on screen with Apple Vision OCR in ~30ms
./native_helper find_text "Search" "Google Chrome"
# Reactively wait for dynamic text to appear
./native_helper wait_for_text "quantum" "Google Chrome" nil 5.0
Run the automated fail-closed and matching regressions:
npm test
With Calculator, System Settings, and two TextEdit windows open, run the live native-app smoke suite:
npm run test:live
Mutating actions return status: "delivered_unverified". Verify the expected post-state with wait_for_text, find_text, or a screenshot before continuing.
The MCP server starts one cursor overlay process lazily on the first click or scroll and stops it when the MCP connection closes. The overlay never intercepts mouse input, joins all Spaces and full-screen windows, and reports cursorOverlay.status: "unavailable" without blocking the requested action if AppKit cannot display it.
๐ License
MIT ยฉ John Oba
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.