macos-computer-use
🍏 macOS Computer Use (MCP Server)
一个超快、原生的 模型上下文协议(MCP) 服务器,为 LLM 和自主智能体提供完整的视觉检查和桌面自动化能力,且 不会劫持你的物理硬件鼠标或键盘焦点。
基于编译的 Swift 核心构建,利用 Apple 原生的 CoreGraphics、Vision OCR(VNRecognizeTextRequest) 以及直接的进程级事件路由(CGEvent.postToPid)。
⚡ 主要亮点
🎯 低于 30ms 的 Apple Vision OCR(
find_text/click_text):无需盲猜 $(x, y)$ 坐标。智能体通过名称即可找到按钮、标签和文本占位符,并借助 Apple Neural Engine 加速实现像素级精度。🛡️ 非侵入式后台执行:与全局 macOS 硬件事件监听解耦。点击、滚动和按键可以直接定向到特定应用的 PID,同时你可以继续在 IDE 或浏览器中工作。
👁️ 虚拟光标叠加层(
mark_cursor):智能体的目标坐标会被可视地绘制到截图帧上(青色目标环 + 洋红色脉冲点),而不会在屏幕上移动你的物理鼠标。⚡ 响应式 UI 同步(
wait_for_text):用高速 OCR 轮询循环取代盲目的sleep()超时,一旦动态自动补全下拉框、模态框或状态变化出现,立即得到解析。🖼️ 窗口隔离截屏:在后台干净地捕获目标应用缓冲区(
screencapture -l <wid> -o -x),不会把窗口带到前台,也不会捕获重叠的窗口。
🛠️ 暴露的工具
工具 | 描述 | 关键参数 |
| 通过 Apple Vision OCR 查找任意按钮、标签或 UI 文本,并平滑点击其精确中心。 |
|
| 检查屏幕或指定窗口中的文本,并返回精确的边界框和逻辑坐标。 |
|
| 响应式轮询目标窗口/屏幕,直到预期文本出现(自动补全下拉框、提示条、弹窗等)。 |
|
| 捕获整个显示器或指定的后台应用窗口,支持可选的虚拟光标渲染。 |
|
| 列出打开的应用窗口、进程 ID( |
|
| 在逻辑 |
|
| 平滑地将鼠标光标移动到 |
|
| 平滑地将鼠标从 |
|
| 将纯文本注入活动输入字段(或直接注入目标进程队列)。 |
|
| 按下特殊按键或带修饰键的键盘快捷键。 |
|
| 在垂直和水平方向上滚动鼠标滚轮。 |
|
| 启动或前置一个 macOS 应用。 |
|
| 返回当前处于活动状态的最前端应用名称和窗口标题。 | 无 |
| 运行自定义 AppleScript,用于深度 macOS 辅助功能和 UI 层级检查。 |
|
🚀 安装与设置
1. 前提条件
macOS 13.0+(Apple Silicon 或 Intel)
Node.js 18+
Xcode Command Line Tools(用于编译原生 Swift 二进制文件):
xcode-select --install
2. 克隆与构建
git clone https://github.com/johnexzy/macos-computer-use.git
cd macos-computer-use
npm install(postinstall 脚本会自动将 native_helper.swift 编译为优化的原生二进制文件)。
🔒 必需的 macOS 权限
要允许桌面捕获和输入模拟,请在 系统设置 > 隐私与安全性 中为你的宿主应用(Terminal、iTerm2、Antigravity、Cursor 或 VS Code)授予权限:
屏幕与系统音频录制:
screenshot和视觉 OCR 所必需。辅助功能:
mouse_click、type_text和press_key所必需。
🔌 MCP 配置
将此服务器添加到你的 MCP 客户端配置中:
Antigravity / Claude Desktop / Cursor / Windsurf
添加到你的 mcp_config.json / claude_desktop_config.json 中:
{
"mcpServers": {
"macos-computer-use": {
"command": "node",
"args": ["/absolute/path/to/macos-computer-use/server.mjs"]
}
}
}🧪 直接测试原生 Swift 辅助程序
你可以直接从终端测试原生二进制文件:
# 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📄 许可证
MIT © John Oba
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/johnexzy/macos-computer-use'
If you have feedback or need assistance with the MCP directory API, please join our Discord server