opencode-computer-use
Allows AI agents to control the macOS desktop by taking screenshots, reading the accessibility tree, and performing mouse, keyboard, and window-management actions for GUI testing and app automation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opencode-computer-useOpen Safari, take a screenshot, and describe what's on screen."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
opencode-computer-use
An MCP server that gives opencode hands and eyes on macOS.
Screenshots · Mouse · Keyboard · Accessibility tree · App & window management
Let your agent launch the app, look at the screen, click the right button, type into the field, and verify the result.
Why
Testing an application by using it is the most honest test there is. This MCP server lets opencode drive your Mac the way a human tester would:
See — take a screenshot and reason about what's on screen
Target — read the accessibility tree to get exact coordinates and element values
Act — click, drag, scroll, type, press key combos, trigger menu items
Verify — screenshot again, or re-read the UI tree to confirm the result
Everything runs locally via a small Swift helper that talks to CoreGraphics (events, screen capture) and the macOS Accessibility API.
Related MCP server: macos-desktop-control
Requirements
macOS (Apple Silicon or Intel)
Xcode Command Line Tools (
xcode-select --install) — for the Swift compilerNode.js 18+
Two macOS permissions, granted to whatever app hosts the server (Terminal, iTerm, VS Code, ...):
Permission | Used for | Where to grant |
Accessibility | Mouse clicks, keyboard events, accessibility tree | System Settings → Privacy & Security → Accessibility |
Screen Recording | Screenshots, window titles | System Settings → Privacy & Security → Screen Recording |
Run the
computer_permissionstool (orbin/computeruse perms --prompt) at any time to check status — it can open the right System Settings panes for you.
Install
git clone https://github.com/virajshoor/opencode-computer-use.git
cd opencode-computer-use
npm install && npm run build # compiles Swift helper → bin/ and TypeScript → dist/Configure opencode
Add to ~/.config/opencode/opencode.json:
{
"mcp": {
"computer-use": {
"type": "local",
"command": ["node", "/absolute/path/to/opencode-computer-use/dist/index.js"]
}
}
}Restart opencode — you should see the computer_* tools appear.
Works with any MCP client (Claude Desktop, Cursor, etc.) — the server speaks standard MCP over stdio.
Tools (17)
Eyes
Tool | What it does |
| Capture screen / region / display, returned as an image the model can see (auto-downscaled, JPEG) |
| Connected displays with bounds |
| Check Accessibility & Screen Recording status, optionally open System Settings |
Hands
Tool | What it does |
| Move + click (left/right/middle, single/double/triple) |
| Mouse positioning / hover |
| Smooth press-drag-release (sliders, DnD, text selection, window moves) |
| Wheel events at a point (positive dy = down, dx = right) |
| Unicode text typing into the focused element |
| Key combos: |
Eyes-on-the-inside
Tool | What it does |
| Full accessibility tree of any app — roles, titles, values, frames. The precise-targeting superpower |
| What UI element lives at (x, y)? Check before you click |
| On-screen windows with app, title and bounds |
| Running GUI apps with pids and frontmost state |
Control
Tool | What it does |
| Launch / activate / quit an app by name or bundle id |
| Click any menu path ( |
| Escape hatch — full AppleScript for anything else (dialogs, UI scripting) |
| Sleep between steps |
The workflow
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ screenshot │───▶│ read_screen │───▶│ click / type │───▶│ screenshot │
│ (see it) │ │ (exact x,y) │ │ (do it) │ │ (verify it) │
└─────────────┘ └──────────────┘ └─────────────┘ └──────────────┘Example agent loop:
Agent: "Let me test that the settings save button works."
computer_screenshot→ sees the app ·computer_read_screen→ finds "Save" button at (812, 404) ·computer_click→ clicks it ·computer_read_screen→ confirms the "Saved ✓" toast appeared
How it works
opencode ──MCP/stdio──▶ dist/index.js ──exec──▶ bin/computeruse (Swift)
TypeScript MCP server ├── CGEvent: mouse & keyboard
17 tools, zod-validated ├── screencapture + sips: screenshots
└── AXUIElement: accessibility treeThe Swift helper is a single-file CLI (swift/ComputerUse.swift, ~600 lines) — no external dependencies, no daemon. Each tool call is one short-lived process.
Testing it yourself
A minimal raw-protocol client is included:
node scripts/test-mcp.mjs # drives TextEdit: launch → click → type → verify → cleanupSecurity notes
This tool gives an agent full control of your Mac. It can click, type, and read any app's UI. Only enable it for sessions where you're comfortable with that.
All actions happen on your real user session with your real permissions. There is no sandbox.
The
computer_applescripttool is an arbitrary-code escape hatch — treat it accordingly.Nothing is sent anywhere except between opencode and the local server process.
Known limitations
Menu traversal uses System Events (AppleScript) rather than raw AX — more reliable across macOS versions, but requires the host app to have Automation permission on first use.
macOS 26's SwiftUI apps (e.g. Calculator) expose empty button titles in AX — use
computer_screenshot+ visual coordinates for those.Screenshots are downscaled to 1800px max (pass full-res intent through
full-resin the CLI if you need every pixel).
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Use your own Mac from ChatGPT, Claude or Codex: files, commands, documents, and a browser.
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
remote debug iOS/Android/Unity/Godot/Flutter/RN/Web on real-device.ui-tree/screenshots/taps,tests.
Drive real devices from your AI Coding tool. Embed a client SDK (Unity, Godot, Flutter, iOS/macOS, Android, React Native, Web) in your app, then capture screenshots, traverse the UI tree, inject taps and key events, and run automated test tasks on the physical device over a secure relay.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to automate macOS desktop tasks including mouse control, keyboard input, screenshots, window management, and UI interaction.6 npm415MIT
- AlicenseNot gradedqualityDmaintenanceProvides native macOS desktop automation for AI agents, enabling screen capture, mouse/keyboard control, window management, and iOS/Android simulator control in both foreground and background modes without focus stealing.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to control macOS via accessibility and screen recording, providing tools to list apps, observe UI, click, type, press keys, and scroll.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to control macOS desktop apps via screenshots, mouse clicks, keyboard input, accessibility queries, and AppleScript.1120 npmMIT