macOS Ghost Control MCP
Provides macOS desktop control and automation, including window capture, accessibility-tree inspection, OCR-based perception, mouse and keyboard injection, virtual cursor feedback, and self-healing SOP execution across macOS applications.
Includes a self-healing SOP for sending WeChat messages through macOS UI automation, covering contact targeting, message entry, and execution verification.
Includes a SOP for searching YouTube and playing a selected video through macOS desktop UI automation.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
macOS Ghost Control MCP (computer-control-mcp)
面向 macOS 的高性能、无感视觉闭环与 自愈式 SOP(Standard Operating Procedure) 桌面控制 MCP 服务端。支持 Claude Desktop、Cursor、Google Antigravity、Windsurf 等所有兼容 Model Context Protocol (MCP) 的 AI Agent 客户端。
核心特性
1x 逻辑分辨率防遮挡截图与网格对齐(Zero Retina Offset)
底层基于
screencapture -x -o -l <wid>与Quartz窗口帧缓冲,自动将 Retina 2x 物理像素归一化为 1x 逻辑坐标空间,并叠加100px辅助网格,彻底解决 macOS 多屏与高分屏点击偏移问题。
Codex 风格常驻平滑虚拟光标 + 自动渐隐(Visual Collaborator Cursor)
执行过程中提供带状态胶囊徽章(
● AI/● CLICK/● TYPE/● SCROLL/● KEY)的NSPanel点击穿透虚拟指针,以三阶缓动(Cubic Ease-Out)平滑滑行展示 AI 操作轨迹,任务序列结束时自动 0.18s 渐隐消失。
零物理鼠标争抢(Zero Mouse Contention)
支持纯后台
PID注入与极速teleport硬件注入双模式;用户鼠标空闲守卫:区分本驱动合成事件与用户真实事件,用户正在移动/按住鼠标时绝不 warp(等待或抛UserBusyError);点击后仅在用户未动鼠标时复位。虚拟光标采用会话心跳:任务期间常驻(长时间 OCR 等待也不闪隐),任务结束立即渐隐;MCP 进程崩溃 2.5s 内自动隐藏;守护进程带协议版本号,升级后自动替换。
混合感知通用泛化(AX + OCR + 弹层)
perception.py:AXUIElement控件树(Electron 自动开启AXManualAccessibility,可AXPress零鼠标点击)+ RapidOCR(小区域 Retina 物理像素识别)+kCGWindowLayer>0弹层窗口感知,统一为窗口相对坐标的UIElement。通用定位打分替代应用专属像素硬编码:分组锚点(
section)、规避分组(网络搜索/聊天记录)、查询回显联想簇识别、排除输入框自身;fail-safe:最佳候选可疑时拒绝而非误选。select_item列表选择:keyboard策略用方向键 + 高亮行帧差分定位,高亮落在目标行才回车(不动鼠标);click/ax/enter策略可选。expect后置条件:text/absent_text/popup/window_size_unchanged,每步证明"生效了"。
闭环自愈 SOP 引擎(
sop_engine.py)快速路径
expect失败 →recover重放前置步骤 →alternatives→ 其它选择策略 /target语义重定位 /heal_region→ 整个 SOP 跑通后自动写回模板(保留{{参数}}、版本 +1、changelog+ 每步heal_history、旧版归档sops/.history/、统计写sops/.state/)。不可逆步骤(
"idempotent": false,如"回车发送")绝不自动重试;vacuous检测防止"动作前条件已成立"造成的假阳性。
Related MCP server: macbot-mcp
目录结构
computer-control-mcp/
├── src/computer_control_mcp/
│ ├── core.py # MCP 工具注册入口
│ ├── macos_ghost_driver.py # Quartz/AppKit 输入注入、截图、鼠标空闲守卫、虚拟光标守护进程
│ ├── perception.py # AX + OCR + 弹层混合感知、通用定位打分、高亮行检测
│ ├── interaction.py # 语义动作、expect 后置校验、自愈 run_step
│ ├── sop_engine.py # SOP 渲染 / 执行 / 自动写回 / 归档 / 统计
│ ├── sop_cli.py # computer-control-sop 命令行
│ ├── server.py # MCP 标准 stdio 服务启动入口
│ └── cli.py # CLI 命令行入口
├── sops/ # 可自愈、可热更新的声明式 SOP 剧本库
│ ├── wechat_send_message.json
│ ├── youtube_search_and_play.json
│ └── activity_monitor_top_processes.json
├── skills/macos-computer-use/ # 通用视觉泛化与 SOP 自愈 Agent Skill (适配 Antigravity / Claude)
│ └── SKILL.md
├── .cursor/rules/ # Cursor 专属自动加载规则
│ └── macos-computer-use.mdc
└── scripts/
└── install_macos.sh # macOS 一键环境构建与配置脚本快速开始(macOS 一键安装)
git clone <your-repo-url> computer-control-mcp
cd computer-control-mcp
chmod +x scripts/install_macos.sh
./scripts/install_macos.sh安装脚本会自动创建 .venv、安装全部依赖、挂载全局 Skill,并在终端输出可直接粘贴到 ~/.cursor/mcp.json 或 claude_desktop_config.json 的配置片段。
系统权限要求
请在 系统设置 -> 隐私与安全性 中为运行客户端(如 Cursor、Terminal、Antigravity 或 Claude)开启:
辅助功能(Accessibility):用于发送 Quartz 键鼠事件。
屏幕录制(Screen & System Audio Recording):用于无遮挡窗口截图与本地 RapidOCR 识别。
核心 MCP 工具一览
工具名称 | 用途说明 |
| 闭环自愈执行 SOP:每步 |
| 结构化感知(无需看图):AX + OCR 元素、弹层窗口,用于构造语义 |
| 批量执行器:原子动作 + 语义动作( |
| 按应用名/标题模糊匹配窗口,返回 1x 逻辑分辨率截图(含可选 |
| 截取指定显示器( |
| 列出 |
| 按 |
| SOP 自愈热更新:当发现 SOP 过时并通过通用视觉推理跑通后,原位保存更新后的 SOP,自动递增版本号并追加 |
| 对截图指定矩形区域执行像素化马赛克 + 高斯模糊隐私脱敏。 |
SOP 命令行
computer-control-sop list
computer-control-sop run wechat_send_message -p target_contact=文件传输助手 -p message_text=你好
computer-control-sop run wechat_send_message --dry-run -p ... # 只渲染不执行
computer-control-sop inspect 微信 --region 0 0 420 600 # 打印 AX/OCR 元素测试
.venv/bin/python -m pytest tests/test_self_healing.py -q # 离线:定位打分 / 高亮差分 / SOP 写回License
MIT License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Let your AI agent control real iPhones: screenshots, tap, swipe, type and open apps.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Bot-free macOS Zoom/Meet/Teams call transcripts, Apple Vision screen OCR, and live SQLite MCP.
1Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to automate macOS desktop tasks including mouse control, keyboard input, screenshots, window management, and UI interaction.10 npm415MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to control macOS applications through the Accessibility API, AppleScript, and CGEvents, providing structured text output of UI elements and actions without needing screenshots.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to control macOS desktop apps via screenshots, mouse clicks, keyboard input, accessibility queries, and AppleScript.1112 npmMIT
- AlicenseNot gradedqualityBmaintenanceLets AI agents see and control desktop applications through the accessibility layer, enabling clicking, typing, scrolling, dragging, and window/app management across macOS, Windows, and Linux entirely on the local machine.20MIT