cu
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.
Windows 桌面自动化插件,通过本地 stdio MCP 服务器(cu)为 Antigravity 提供 UI Automation 控件树检查、屏幕截图、键鼠控制、Codex 风格紫色接管视觉提示(支持按物理 Esc 立即暂停接管、中英双语自适应与多屏热插拔)以及服务端硬编码安全红线保护。
A Windows desktop automation plugin for Antigravity providing UI Automation inspection, screenshots, mouse/keyboard control, a Codex-style purple takeover overlay (with instant physical Esc pause/reclaim, bilingual ZH/EN UI, and display hotplug support), and hard-coded server-side safety red lines over a local stdio MCP server (cu).
核心特性 / Feature Highlights
通用 Python 3.10+ 启动器 / Universal Python 3.10+:
mcp_config.json使用py -3启动;server/launch.py支持 Python 3.10+ 并自动检测.venv次版本不匹配,setup.ps1支持-Recreate与-Python覆盖。17 个懒加载 MCP 工具 / 17 Lazy MCP Tools: 全部设为
"eager": false,不占用日常对话上下文;支持单批多步computer_batch(含task、end_session=True、wait_for_title与自动返回foreground_window)。视觉接管覆盖层 + 物理 Esc 急停 / Codex-Style Overlay & Esc Pause: 紫色发光边框(
#8B5CF6)、中英双语状态横幅(CU_OVERLAY_LANG=auto|zh|en)、自适应滑行光标(80–220ms)与点击波纹;支持WDA_EXCLUDEFROMCAPTURE截屏隐身及WM_DISPLAYCHANGE显示器热插拔自适应。免中文输入法干扰 / IME-Proof Unicode Typing: Windows 下
type_text使用私有user32句柄批量调用SendInput KEYEVENTF_UNICODE,完整支持 ASCII、中文及 UTF-16 代理对,并提供clear_first/press_enter。服务端硬编码安全红线 / Hard-Coded Safety Red Lines: 禁止操作 Antigravity / 宿主祖先进程 / 运行
agy的终端 / 覆盖层自身 / UAC / Defender / SmartScreen / 主流密码管理器,自动拦截提权窗口(UIPI 完整性级别检测),并发互斥锁(_ACTION_LOCK)串行化写操作,全链路 TOCTOU 复检与脱敏审计日志。单窗口截图 & Set-of-Marks 标注 / Window-Scoped Capture & SoM:
screenshot支持handle=<hwnd>(PrintWindow-> DWM 裁剪回退)与marks=True([eN]/[feN]编号徽章)。
Related MCP server: windows-computer-use-mcp
架构概览 / Architecture
flowchart LR
AGY["Antigravity Host"] -- "stdio MCP (py -3 launch.py)" --> SRV["server/server.py (cu, 17 lazy tools)"]
SRV --> LOCK["_ACTION_LOCK (RLock)"]
LOCK --> SAFE["server/safety.py (Red Lines, UIPI, Kill Switches)"]
SAFE --> UIA["server/uia.py (UI Automation)"]
SAFE --> INPUT["server/input_ctl.py (SendInput UNICODE / Mouse)"]
SRV --> SCREEN["server/screen.py (mss, PrintWindow, SoM, Desktop State)"]
SRV -- "JSON-line stdin/stdout pipe (only helper)" --> OVC["server/overlay_client.py"]
OVC <--> OV["server/overlay.py (Win32 Layered Overlay + WH_KEYBOARD_LL Esc)"]
SRV --> AUDIT["%LOCALAPPDATA%/agy-computer-use/audit.jsonl"]快速开始 / Quick Start
系统要求 / Requirements: Windows 10 (2004+) / Windows 11, Python 3.10+ (py launcher on PATH), Antigravity.
# 1. 克隆仓库 / Clone the repository
git clone https://github.com/Niall0218/agy-computer-use.git
cd agy-computer-use
# 2. 一键安装到 Antigravity 插件目录 / Install into Antigravity plugins directory
powershell -ExecutionPolicy Bypass -File .\install.ps1安装完成后 / After installation:
install.ps1会仅同步运行时文件(plugin.json,mcp_config.json,requirements.txt,setup.ps1,README.md,LICENSE以及server/,rules/,skills/,assets/镜像,自动排除.git/.github/tests/缓存且不破坏.venv)到%USERPROFILE%\.gemini\config\plugins\agy-computer-use,并在目标目录运行setup.ps1。setup.ps1自动探测py -3(校验>= 3.10)创建.venv,优先以 1500ms 超时探测pypi.org,不可达时自动回退至阿里云镜像https://mirrors.aliyun.com/pypi/simple/。在 Antigravity 的插件管理中启用
Computer Use(agy-computer-use) 即可使用。
如需强制重建虚拟环境(例如升级了默认 Python 版本)或指定 PyPI 镜像 / Rebuild
.venvor override PyPI index:powershell -ExecutionPolicy Bypass -File .\install.ps1 -Recreate powershell -ExecutionPolicy Bypass -File .\install.ps1 -IndexUrl https://mirrors.aliyun.com/pypi/simple/
环境变量 / Environment Variables
变量 / Variable | 默认值 / Default | 说明 / Description |
|
| 设为 |
|
| 覆盖层横幅与状态文案语言: |
|
| 无操作自动隐藏覆盖层的空闲超时秒数 / Idle timeout in seconds before the overlay auto-hides. |
| (unset) | 设为 |
| (unset) | 设为 |
| (unset) | 逗号分隔的额外屏蔽进程/窗口名(只能追加,无法移除内置安全红线)/ Comma-separated extra blocked process or window patterns (strictly additive). |
视觉接管覆盖层与 Esc 暂停 / Visual Takeover Overlay & Esc Pause
当 Agent 执行桌面操作(或调用 control_session(action="begin", task="..."))时,服务端按需启动唯一硬编码辅助进程 server/overlay.py:
紫色发光边框 / Purple Glowing Border: 每个显示器四边绘制
#8B5CF6发光边框,全程点击穿透(WS_EX_TRANSPARENT)且绝不抢占焦点(WS_EX_NOACTIVATE/MA_NOACTIVATE/SW_SHOWNOACTIVATE)。双语顶部状态横幅 / Bilingual Top Status Pill: 根据
CU_OVERLAY_LANG自动显示中文(Antigravity 正在控制您的电脑 · 按 Esc 停止)或英文(Antigravity is controlling your computer · Press Esc to stop),过长文案按像素宽度自动省略号截断,绝不溢出;输入类动作仅显示字符数,绝不泄露输入文本。自适应滑行光标与点击波纹 / Adaptive Gliding Cursor & Click Ripple: 按移动距离自动计算时长(
<4px为0ms,其余80–220ms,带单调请求id防乱序),滑行后执行 TOCTOU 安全复检,再注入真实输入并渲染点击波纹。显示器热插拔自适应 / Display Hotplug (
WM_DISPLAYCHANGE): 分辨率或显示器拓扑变化时,覆盖层自动重建各屏边框、在主屏重新居中横幅、重新应用WDA_EXCLUDEFROMCAPTURE,并通过hwnds_updated同步给OverlayClient。截屏自动隐藏 / Screenshot Exclusion: Windows 10 2004+ (
build >= 19041) 使用SetWindowDisplayAffinity(WDA_EXCLUDEFROMCAPTURE)自动从截屏中排除覆盖层,不支持时回退至capture_guard()瞬间隐藏/恢复。按物理
Esc立即暂停并收回控制权 / Press PhysicalEscto Pause & Reclaim Control:通过进程内
WH_KEYBOARD_LL监听物理Esc(拒绝注入按键LLKHF_INJECTED/LLKHF_LOWER_IL_INJECTED,不注入 DLL、不吞键、不记录击键),第一时间锁存user_stopped=True,全部操作类工具返回[BLOCKED]。横幅切换为暂停态(
已暂停 · 点击此处将控制权交还 Antigravity/Paused · Click here to hand control back to Antigravity)。仅用户点击暂停横幅或重启服务端可恢复;没有任何 MCP 工具可清除user_stopped。
单批流畅执行示例 / Single-Batch Browser URL Recipe
优先在一次 computer_batch 调用内完成多步操作(自动开启/结束覆盖层、免 IME 干扰输入并自动返回 foreground_window):
computer_batch(
task="Open example.com",
end_session=True,
actions=[
{"action": "focus_window", "handle": <hwnd>},
{"action": "key", "combo": "ctrl+l"},
{"action": "type_text", "text": "https://example.com", "clear_first": True, "press_enter": True},
{"action": "wait_for_title", "handle": <hwnd>, "title_changed_from": "<old_title>", "timeout_ms": 5000},
],
)急停开关与安全机制 / Kill Switches & Safety
四重急停开关 / Kill Switches
物理
Esc键 / PhysicalEscKey: 接管期间按物理Esc立即暂停,点击暂停横幅方可恢复。文件开关 / File Kill Switch: 创建
%LOCALAPPDATA%\agy-computer-use\STOP(删除文件即可恢复):New-Item -ItemType File -Force "$env:LOCALAPPDATA\agy-computer-use\STOP"环境变量 / Environment Variables:
CU_DISABLED=1或CU_READONLY=1。屏幕角落急停 / Mouse Corner Failsafe:
pyautogui.FAILSAFE=True,鼠标甩至任意屏幕角落即返回[BLOCKED] failsafe。
硬编码安全红线 / Hard-Coded Red Lines
以下保护内置于 server/safety.py 与 server/server.py,无法通过环境变量放宽(详见 SECURITY.md):
禁止操作 Antigravity、宿主祖先进程、运行
agy的终端与覆盖层自身窗口。高危系统界面与密码管理器黑名单:
consent.exe(UAC)、credentialuibroker.exe、logonui.exe、lockapp.exe、smartscreen.exe、useraccountcontrolsettings.exe、Windows 安全中心/Defender UI(含ApplicationFrameHost.exeUWP 子进程),以及1password*.exe、keepass*.exe、keepassxc.exe、bitwarden.exe、lastpass*.exe、dashlane.exe、protonpass.exe、nordpass*.exe、keeper*.exe、enpass*.exe、roboform*.exe、authy*.exe(可通过CU_EXTRA_BLOCKED追加)。UIPI 提权目标拦截 / UIPI Elevation Blocking: 自动对比目标进程与服务端的 Windows 完整性级别 RID;若目标运行于更高权限(如管理员窗口),直接返回
[BLOCKED]。高危快捷键拦截: 拒绝
ctrl+alt+del/ctrl+alt+delete、win+l、win+r、ctrl+shift+esc/ctrl+shift+escape。并发串行化与 TOCTOU 防护: 全部写操作经
_ACTION_LOCK串行化;光标滑行后复检、drag每<=16px插值复检、type_text每<=32字符块复检前台窗口句柄。单一辅助进程例外与脱敏审计日志: 仅允许拉起
server/overlay.py;所有调用记录于%LOCALAPPDATA%\agy-computer-use\audit.jsonl(5 MB 自动轮转,文本输入仅记长度、密码框脱敏为***)。
工具列表与限制 / Tools (cu, 17 Lazy Tools) & Limits
会话与覆盖层 / Session & Overlay:
control_session只读观察 / Read-only:
screenshot(支持handle单窗口截图与marks=TrueSet-of-Marks 编号标注)、screen_info(含desktop_session与server_elevated诊断)、list_windows、ui_tree、find_elementsUIA 控件操作 / UIA Actions:
click_element,set_element_value键鼠与窗口控制 / Input & Window:
focus_window,click,move,drag,scroll,type_text,key,wait批量执行 / Batch:
computer_batch
项目 / Item | 限制 / Limit |
|
|
|
|
|
|
|
|
|
|
|
|
开发与测试 / Development & Testing
# 安装开发依赖 (pytest + ruff) / Install dev dependencies
powershell -ExecutionPolicy Bypass -File .\setup.ps1 -Dev
# 代码检查 / Lint
.\.venv\Scripts\python.exe -m ruff check server tests
# 运行自动化测试 / Run automated test suite
.\.venv\Scripts\python.exe -m pytest tests -rs -q
# 在交互式桌面上运行 tkinter 端到端测试 / Interactive desktop E2E test
$env:CU_E2E = "1"; .\.venv\Scripts\python.exe -m pytest tests\test_e2e_tk.py -rs -q
tests/仅保留在源代码仓库中,不会被install.ps1复制到已安装插件目录。
常见问题排查 / Troubleshooting FAQ
1. 目标窗口提示 UIPI / 提权被拦截([BLOCKED] ... higher integrity level)
Windows UIPI(用户界面特权隔离)会阻止中等权限进程向以管理员身份运行(High Integrity)的窗口注入键鼠事件。agy-computer-use 会主动检测并直接返回 [BLOCKED](同时 screen_info() 会返回 server_elevated 状态)。请将目标应用以普通用户权限运行,或由用户手动操作管理员窗口。
2. Python 版本不匹配或 .venv 无法启动
mcp_config.json 使用 py -3 启动,若系统升级了默认 Python 次版本导致与 .venv/pyvenv.cfg 不一致,launch.py 会输出明确的重建提示。请运行:
powershell -ExecutionPolicy Bypass -File .\setup.ps1 -Recreate
# 或重新部署并重建已安装插件的 .venv / Or reinstall and rebuild:
powershell -ExecutionPolicy Bypass -File .\install.ps1 -Recreate
# 指定特定 Python 3.10+ 路径 / Or pin a specific Python 3.10+ executable:
powershell -ExecutionPolicy Bypass -File .\setup.ps1 -Recreate -Python "C:\Path\To\python.exe"3. 中文 / CJK 输入法问题
type_text 在 Windows 上使用 SendInput KEYEVENTF_UNICODE,直接发送 Unicode 字符而不经过 IME 候选词转换;但若目标输入框(如浏览器地址栏)当前正处于未提交的 IME 组合态,随后的 Enter 可能仅确认候选词而非提交表单。建议配合 clear_first=True、press_enter=True 与 wait_for_title 确认跳转。
4. 锁屏、沙盒或非交互式桌面(desktop_session / 截屏失败)
在锁屏、远程桌面断开、UAC 安全桌面或无头沙盒(如 exebox-*)中,Windows 会拒绝截屏与输入注入。调用 screen_info() 检查 desktop_session(reason 为 "ok"、"secure_desktop_or_locked"、"non_interactive_desktop" 或 "unavailable"),并在已解锁的交互式桌面会话中使用插件。
卸载 / Uninstall
使用 uninstall.ps1 安全移除已安装插件(内置路径保护,拒绝删除磁盘根目录、用户目录或非 agy-computer-use 目录):
# 卸载插件(默认保留审计日志与状态目录 %LOCALAPPDATA%\agy-computer-use)
powershell -ExecutionPolicy Bypass -File .\uninstall.ps1
# 卸载插件并一并清除审计日志与状态目录 / Also purge state & audit logs
powershell -ExecutionPolicy Bypass -File .\uninstall.ps1 -PurgeState文档与开源协议 / Documentation & License
SECURITY.md — 安全模型、红线清单与漏洞报告流程
CHANGELOG.md — 版本更新日志
CONTRIBUTING.md — 贡献指南与 PR 安全检查表
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 AI see and use your own Windows PC with your permission: screen, apps, mouse and keyboard.
Let your AI see your screen, click, type and run commands on your own Windows, Mac or Linux PC.
Remote desktop control, files, and terminal tools for AI assistants on paired Windows PCs.
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to inspect and control allowlisted Windows applications using screenshots, mouse actions, Unicode keyboard input, UI Automation, and an Esc/F12 emergency stop.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables agents to control Windows desktop applications through UI Automation and Win32, supporting window management, mouse/keyboard input, element inspection, screenshots, OCR, macro recording, and autonomous multi-app missions. It also provides an HTTP/stdio MCP interface, an operator UI, and optional telemetry and safety controls.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI clients to operate Windows desktops through native UIA control, OCR text targeting, screenshots, and 54 tools for window, process, input, clipboard, file, registry, and document tasks with pause, observe-only, and privacy safeguards.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Antigravity agents to control Windows desktops through native UI Automation, Set-of-Mark numbered overlays, zoomed regions, multi-monitor support, and batched actions.2MIT