cua-mac

cua-mac

macOS MCP server that enables AI agents to directly control the host OS, including mouse, keyboard, windows, files, and accessibility automation for computer-use workflows.

Category
访问服务器

README

Cua Mac: macOS MCP Server for AI Agents

cua-mac is a macOS Model Context Protocol (MCP) server that gives an AI agent direct access to the user's real Mac host over stdio.

It is built for computer-use workflows where an MCP client needs to click, type, inspect windows, read the accessibility tree, interact with files, and automate native macOS apps instead of a sandboxed VM or browser-only environment.

Why This MCP Server Exists

Most MCP servers expose APIs, databases, or browser automation. This one exposes the host operating system itself.

Use it when you need an AI agent to:

  • control the macOS cursor and keyboard
  • inspect and manipulate native app windows
  • read and write files on the host machine
  • access clipboard contents
  • capture screenshots for perception loops
  • query the focused accessibility tree for UI automation
  • launch apps and open files or URLs

Key Features

  • 48 MCP tools for host automation, file access, window management, accessibility inspection, and lightweight web search
  • direct macOS interaction through a Swift helper plus a thin Node MCP server
  • permission-aware error handling for Accessibility and Screen Recording
  • structured JSON tool outputs for MCP clients that consume structuredContent
  • safer destructive operations with protected-path checks for file and directory deletion
  • bounded shell command execution with timeout reporting

Who Should Use It

  • teams building computer-use agents on macOS
  • MCP client developers who need native OS control
  • researchers prototyping AI desktop automation
  • developers integrating Model Context Protocol tools into agent loops

Supported Environment

  • macOS
  • Node.js 18+
  • Swift toolchain available at /usr/bin/swiftc

This server does not support Linux or Windows.

Installation

git clone https://github.com/ashish200729/personal-ai-computer-mcp.git
cd personal-ai-computer-mcp
npm install

The Swift helper is compiled automatically on first run.

Run The MCP Server

cd /path/to/personal-ai-computer-mcp
node ./src/index.mjs

MCP Client Configuration

Use this server in any MCP-compatible client that supports stdio servers.

{
  "mcpServers": {
    "cua-mac": {
      "command": "node",
      "args": ["/absolute/path/to/personal-ai-computer-mcp/src/index.mjs"]
    }
  }
}

Tool Categories

Screenshots and Perception

  • computer_screenshot
  • computer_get_screen_size
  • computer_get_cursor_position

Mouse and Keyboard Automation

  • computer_click
  • computer_double_click
  • computer_move
  • computer_drag
  • computer_scroll
  • computer_mouse_down
  • computer_mouse_up
  • computer_type
  • computer_press_key
  • computer_hotkey
  • computer_key_down
  • computer_key_up

Clipboard and Shell

  • computer_clipboard_get
  • computer_clipboard_set
  • computer_run_command

Host File System

  • computer_file_read
  • computer_file_write
  • computer_file_exists
  • computer_directory_exists
  • computer_list_directory
  • computer_create_directory
  • computer_delete_file
  • computer_delete_directory
  • computer_get_file_size
  • computer_open

Apps and Windows

  • computer_launch_app
  • computer_get_active_window
  • computer_get_window_name
  • computer_get_window_size
  • computer_get_window_position
  • computer_set_window_size
  • computer_set_window_position
  • computer_activate_window
  • computer_minimize_window
  • computer_maximize_window
  • computer_close_window
  • computer_get_app_windows
  • computer_get_desktop_environment
  • computer_set_wallpaper

Accessibility and Discovery

  • computer_get_accessibility_tree
  • computer_find_element
  • computer_web_search
  • computer_permissions_status
  • computer_request_permissions

Example Use Cases

macOS Computer Use

An AI agent can capture a screenshot, move the mouse, click a button, type into a native app, and verify the next state with another screenshot.

Native App Automation

A client can inspect the focused window, locate controls through the accessibility tree, and operate Finder, System Settings, browsers, editors, or internal desktop tools.

Host File Operations

An agent can read logs, create directories, write files, inspect file sizes, and open local artifacts with the default macOS handler.

Tool Discovery Workflow

An agent can use computer_web_search for quick discovery, then open the selected URL in the user's default browser with computer_open.

Production Notes

  • UI coordinate tools use absolute macOS screen coordinates.
  • computer_screenshot requires Screen Recording permission.
  • cursor, keyboard, and accessibility tools require Accessibility permission.
  • computer_run_command is a fallback. Prefer dedicated tools when they exist.
  • computer_run_command supports timeout_ms and returns timed_out.
  • computer_find_element requires at least one of role, title, or value.
  • file and directory deletion reject a small set of protected paths such as /, /System, /Users, the current working directory, and the current home directory
  • window ids are emitted as pid:index

Troubleshooting

Accessibility Actions Fail

Call computer_permissions_status first. If Accessibility access is missing, call computer_request_permissions and approve the MCP client or terminal in:

System Settings > Privacy & Security > Accessibility

Screenshots Fail

Grant Screen Recording permission to the MCP client or terminal in:

System Settings > Privacy & Security > Screen Recording

Screen Size Returns An Error

That means the current macOS session is not exposing valid display dimensions to the helper process. In practice this usually points to a headless, locked, or otherwise restricted session.

Repository Metadata Recommendations

To improve GitHub discovery and click-through rate further, configure these repository settings in GitHub:

  • description: macOS MCP server for AI agents, computer use, native app automation, screenshots, accessibility, and host OS control
  • website: https://github.com/trycua/cua/tree/main/mcp
  • topics: mcp, model-context-protocol, macos, ai-agents, computer-use, desktop-automation, accessibility, host-automation, tool-use, agent-tools
  • social preview image: a 1280x640 image showing macOS automation plus the phrases macOS MCP Server and AI Agent Computer Use
  • if trycua/cua is intended to be open source, add a repository-level LICENSE file at the repo root so GitHub can classify it as open source

Search Intent This README Covers

This README is intentionally optimized for queries such as:

  • macOS MCP server
  • Model Context Protocol macOS
  • AI agent computer use macOS
  • desktop automation MCP
  • native app automation for AI agents
  • host OS control for MCP clients
  • macOS accessibility automation server

Related Project Links

  • repository root: https://github.com/trycua/cua
  • package path: https://github.com/trycua/cua/tree/main/mcp

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选