简介
GUI Automation
原始描述
Control the desktop via CUA computer server API running on port 8000
通过你的 Agent 添加
安装目录:desktop-control/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
Desktop Control 是一款基于 CUA(Computer Use Agent)架构的桌面自动化技能,通过本地 HTTP API 实现对计算机的精细控制。用户需先在本地安装并运行 cua-computer-sdk 服务器(默认端口 8000),Skill 本身为纯文档型,提供完整的 RESTful API 调用指南。
核心功能包括:屏幕截图捕获、鼠标点击(左键/右键/双击)、键盘输入与快捷键、光标移动与滚轮操作、应用启动与窗口管理、文件及 URL 打开等。所有操作均通过向 localhost:8000/cmd 发送 JSON 指令完成,返回结果包含执行状态及截图等数据。
该技能采用"临时会话"设计理念,推荐仅在需要时启动 CUA 服务器,用完后立即停止,最大限度降低持续暴露风险。
显著优点
-
功能全面:覆盖桌面自动化的完整场景,从基础截图到复杂表单填写、浏览器导航均可实现,支持坐标精确点击与键盘热键组合。
-
架构安全:默认绑定 127.0.0.1,仅限本地访问,无需管理员权限即可运行,避免网络层面的未授权访问风险。
-
透明可控:提供从 PyPI 安装与源码安装两种途径,鼓励用户先行审查代码;调试模式可实时监控服务器行为,增强可控性。
-
零侵入设计:Skill 本身不含可执行代码,纯文档指导用户自行部署服务器,用户完全掌握运行时机与生命周期。
-
多平台兼容:支持 macOS、Linux 及 Windows 系统,提供针对性的故障排查指南(如 Linux 输入组权限、DISPLAY 变量设置等)。
潜在缺点与局限性
-
依赖外部服务:必须独立安装维护 CUA 服务器,增加了部署复杂度,且第三方组件(tryCUA 组织维护)的安全更新依赖用户主动跟进。
-
坐标硬编码风险:示例中的点击坐标(如 640,360)需根据实际屏幕分辨率调整,缺乏自适应布局能力,跨设备迁移成本较高。
-
无视觉反馈闭环:虽然支持截图,但 Skill 本身不提供图像分析或 OCR 能力,无法自动识别 UI 元素位置,需人工预设坐标或反复调试。
-
会话状态脆弱:CUA 服务器为无状态设计,进程重启后需重新建立连接,长时间自动化任务可能因意外中断而失败。
-
个人开发者维护:来源可信度为 T3 级(个人开发者),非企业级背书,长期维护稳定性存在不确定性。
适合的目标群体
- QA 测试工程师:需要自动化执行 GUI 测试用例、回归验证多平台桌面应用兼容性。
- RPA 开发者:构建轻量级机器人流程自动化,处理跨应用数据录入、报表导出等重复性任务。
- AI Agent 研究者:为 LLM 提供计算机视觉与操作反馈闭环,探索多模态 Agent 的桌面交互能力。
- 效率极客:希望通过脚本自动化日常办公操作(如定时截图监控、批量文件处理)。
- 教育演示场景:编程教学中的自动化示例、远程协助演示等需可视化操作记录的环境。
使用风险与注意事项
功能全面:覆盖桌面自动化的完整场景,从基础截图到复杂表单填写、浏览器导航均可实现,支持坐标精确点击与键盘热键组合。
架构安全:默认绑定 127.0.0.1,仅限本地访问,无需管理员权限即可运行,避免网络层面的未授权访问风险。
透明可控:提供从 PyPI 安装与源码安装两种途径,鼓励用户先行审查代码;调试模式可实时监控服务器行为,增强可控性。
零侵入设计:Skill 本身不含可执行代码,纯文档指导用户自行部署服务器,用户完全掌握运行时机与生命周期。
多平台兼容:支持 macOS、Linux 及 Windows 系统,提供针对性的故障排查指南(如 Linux 输入组权限、DISPLAY 变量设置等)。
-
依赖外部服务:必须独立安装维护 CUA 服务器,增加了部署复杂度,且第三方组件(tryCUA 组织维护)的安全更新依赖用户主动跟进。
-
坐标硬编码风险:示例中的点击坐标(如 640,360)需根据实际屏幕分辨率调整,缺乏自适应布局能力,跨设备迁移成本较高。
-
无视觉反馈闭环:虽然支持截图,但 Skill 本身不提供图像分析或 OCR 能力,无法自动识别 UI 元素位置,需人工预设坐标或反复调试。
-
会话状态脆弱:CUA 服务器为无状态设计,进程重启后需重新建立连接,长时间自动化任务可能因意外中断而失败。
-
个人开发者维护:来源可信度为 T3 级(个人开发者),非企业级背书,长期维护稳定性存在不确定性。
适合的目标群体
- QA 测试工程师:需要自动化执行 GUI 测试用例、回归验证多平台桌面应用兼容性。
- RPA 开发者:构建轻量级机器人流程自动化,处理跨应用数据录入、报表导出等重复性任务。
- AI Agent 研究者:为 LLM 提供计算机视觉与操作反馈闭环,探索多模态 Agent 的桌面交互能力。
- 效率极客:希望通过脚本自动化日常办公操作(如定时截图监控、批量文件处理)。
- 教育演示场景:编程教学中的自动化示例、远程协助演示等需可视化操作记录的环境。
使用风险与注意事项
安全风险方面,该技能授予了 AI 对本地桌面的完整控制能力,包括读取屏幕内容、模拟键盘输入(可输入密码等敏感信息)、操作任意应用程序。虽然默认仅限 localhost,但若用户误配置 --bind 0.0.0.0 或处于多用户共享环境,可能导致未授权访问。建议在虚拟机、Docker 容器或专用测试机中运行,避免在生产环境或包含机密数据的设备上使用。
性能与稳定性方面,CUA 服务器持续运行会占用系统资源,且频繁的截图操作可能消耗较多内存与磁盘空间。网络延迟或服务器响应超时可能导致自动化流程中断,需在脚本中加入适当的错误重试与异常处理机制。
供应链风险方面,核心依赖 cua-computer-sdk 来自 PyPI 及 GitHub 上的 tryCUA 组织,虽经过基础审计,但仍建议用户从源码安装并定期审查更新日志,防范潜在的恶意版本替换。
合规与隐私方面,自动化操作可能涉及处理包含个人信息的界面(如邮件、文档),需确保符合 GDPR、CCPA 等数据保护法规,建议在自动化流程中屏蔽或模糊处理敏感区域。
技能正文
name: desktop-control
description: Control the desktop via CUA computer server API running on port 8000
version: 1.0.0
Desktop Control via CUA Server
This skill allows OpenClaw to control the desktop using the CUA computer server API.
⚠️ Security Notice
This skill requires installing and running a third-party server (cua-computer-sdk) that has full control over your desktop.
Before using this skill:
- The server can simulate keyboard, mouse, and take screenshots
- Only run on systems where you trust all users and processes
- The server runs with your user privileges (no sudo/admin required)
- By default, only accessible from localhost (safe for local use)
Prerequisites
- Python 3.12+ installed on your system
- CUA computer server running on port 8000 (see installation below)
- Access to localhost:8000 only (network exposure not recommended)
Installation
Recommended: Temporary Session (Safest)
Recommended: Temporary Session (Safest)
Run the server only when needed, in a terminal you can monitor:
# Install the Computer SDK (official CUA package)
pip install cua-computer-sdk
# Verify package (optional but recommended)
pip show cua-computer-sdk # Check publisher and version
# Run temporarily (Ctrl+C to stop)
cua-server start --port 8000 --bind 127.0.0.1
# In another terminal, verify it's running locally only
curl http://localhost:8000/status
netstat -an | grep 8000 # Should show 127.0.0.1:8000
This is the safest approach - the server only runs when you explicitly start it and stops when you close the terminal.
Alternative: Install from Source
For transparency, you can review and run from source:
# Clone and review the code first
git clone https://github.com/trycua/cua-computer-server
cd cua-computer-server
# Review the code before running
ls -la
cat requirements.txt # Check dependencies
# Install and run
pip install -r requirements.txt
python -m cua_server --port 8000 --bind 127.0.0.1
Running the Server
Option 1: Manual Start (Recommended)
# Start in foreground - you can see what it's doing
cua-server start --port 8000
# Stop with Ctrl+C when done
Option 2: Background Process (Temporary)
# Run in background for current session only
cua-server start --port 8000 &
# Note the process ID
echo "Server PID: $!"
# Stop when done
kill <PID>
Note: This skill does NOT require persistent/system service installation. Running the server temporarily when needed is the recommended approach.
Scope & Limitations
This skill:
- ✅ Controls YOUR desktop when the server is running
- ✅ Runs with YOUR user privileges (no admin/sudo needed)
- ✅ Only accessible from localhost by default
Security Best Practices
- Run Temporarily: Start the server only when needed, stop when done
- Localhost Only: Keep default binding to 127.0.0.1
- No Network Exposure: Avoid
--bind 0.0.0.0 unless absolutely necessary
- Monitor Activity: Run in foreground to see what commands are executed
- Limited Scope: The server can only do what your user account can do
Quick Test
--bind 0.0.0.0 unless absolutely necessaryAfter starting the server, verify it works:
# Simple health check
curl http://localhost:8000/status
# Should return: {"status": "ok"}
# Take a screenshot (safe test)
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "screenshot"}' \
-o screenshot.json
# If successful, you'll get a JSON response with base64 image data
Troubleshooting
Port Already in Use:
# Check what's using port 8000
lsof -i :8000 # macOS/Linux
netstat -ano | findstr :8000 # Windows
# Solution: Use a different port
cua-server start --port 8001
Permission Denied (Linux):
# You may need to add your user to the input group for keyboard/mouse control
sudo usermod -a -G input $USER
# Log out and back in for changes to take effect
Display Not Found (Linux):
# Check your display variable
echo $DISPLAY
# Set it explicitly
DISPLAY=:0 cua-server start --port 8000
Server Not Responding:
# Check if the process is running
ps aux | grep cua-server # Linux/macOS
tasklist | findstr cua-server # Windows
# Try running in foreground to see errors
cua-server start --port 8000 --debug
Available Commands
Take Screenshot
Capture the current screen:
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "screenshot"}' \
| jq -r '.result.base64' \
| base64 -d > screenshot.png
Click at Coordinates
Click at specific x,y coordinates:
# Click at center of 1280x720 screen
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "left_click", "params": {"x": 640, "y": 360}}'
Right Click
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "right_click", "params": {"x": 640, "y": 360}}'
Double Click
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "double_click", "params": {"x": 640, "y": 360}}'
Type Text
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "right_click", "params": {"x": 640, "y": 360}}'
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "double_click", "params": {"x": 640, "y": 360}}'
Type Text
Type text at the current cursor position:
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "type_text", "params": {"text": "Hello, World!"}}'
Press Hotkey
Press a key combination:
# Ctrl+C
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "hotkey", "params": {"keys": ["ctrl", "c"]}}'
# Ctrl+Alt+T (open terminal)
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "hotkey", "params": {"keys": ["ctrl", "alt", "t"]}}'
Press Single Key
Press a single key:
# Press Enter
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "press_key", "params": {"key": "enter"}}'
# Press Escape
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "press_key", "params": {"key": "escape"}}'
Move Cursor
Move cursor to specific position:
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "move_cursor", "params": {"x": 100, "y": 200}}'
Scroll
Scroll up or down:
# Scroll down 3 units
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "scroll_direction", "params": {"direction": "down", "amount": 3}}'
# Scroll up 5 units
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "scroll_direction", "params": {"direction": "up", "amount": 5}}'
Launch Application
Launch an application by name:
# Launch Firefox
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "launch", "params": {"app": "firefox"}}'
# Launch Terminal
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "launch", "params": {"app": "xfce4-terminal"}}'
Open File or URL
Open a file or URL with default application:
# Open URL
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "open", "params": {"path": "https://example.com"}}'
# Open file
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "open", "params": {"path": "/home/cua/document.txt"}}'
Get Window Information
Get current window ID:
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "get_current_window_id"}'
Window Control
Maximize window:
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "maximize_window", "params": {"window_id": "0x1234567"}}'
Minimize window:
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "minimize_window", "params": {"window_id": "0x1234567"}}'
Demo Workflows
Browser Navigation Demo
Open Firefox and navigate to a website:
# Take initial screenshot
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "screenshot"}' -o initial.json
# Launch Firefox
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "launch", "params": {"app": "firefox"}}'
sleep 3
# Focus address bar (Ctrl+L)
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "hotkey", "params": {"keys": ["ctrl", "l"]}}'
sleep 1
# Type URL
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "https://example.com"}}'
# Press Enter
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "press_key", "params": {"key": "enter"}}'
sleep 5
# Take final screenshot
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "screenshot"}' -o final.json
Text Editor Demo
Open text editor and type content:
# Open terminal
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "hotkey", "params": {"keys": ["ctrl", "alt", "t"]}}'
sleep 2
# Type command to open text editor
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "mousepad"}}'
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "press_key", "params": {"key": "enter"}}'
sleep 2
# Type some text
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "Hello from OpenClaw!\nThis is automated desktop control."}}'
# Save file (Ctrl+S)
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "hotkey", "params": {"keys": ["ctrl", "s"]}}'
sleep 1
# Type filename
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "openclaw-demo.txt"}}'
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "press_key", "params": {"key": "enter"}}'
Form Filling Demo
Fill out a web form:
# Assuming browser is open with form visible
# Click on first input field (adjust coordinates)
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "left_click", "params": {"x": 400, "y": 300}}'
# Type name
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "John Doe"}}'
# Tab to next field
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "press_key", "params": {"key": "tab"}}'
# Type email
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "john@example.com"}}'
# Tab to next field
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "press_key", "params": {"key": "tab"}}'
# Type message
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "type_text", "params": {"text": "This form was filled automatically by OpenClaw!"}}'
# Submit form (click submit button)
curl -X POST http://localhost:8000/cmd -H "Content-Type: application/json" -d '{"command": "left_click", "params": {"x": 400, "y": 500}}'
Helper Functions
Check Server Status
curl http://localhost:8000/status
List All Available Commands
curl http://localhost:8000/commands | jq
Get Screen Size
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "get_screen_size"}'
Get Cursor Position
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "get_cursor_position"}'
Environment Variables
CUA_SERVER_URL: Base URL for CUA server (default: http://localhost:8000)
Tips
- Wait Between Commands: Add
sleep between commands to allow UI to update
- Check Coordinates: Screen is 1280x720, center is at (640, 360)
- Screenshot for Debugging: Take screenshots before and after actions to verify
- Use Variables: Store coordinates and text in variables for reusability
Example OpenClaw Usage
curl http://localhost:8000/commands | jq
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "get_screen_size"}'
Get Cursor Position
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "get_cursor_position"}'
Environment Variables
CUA_SERVER_URL: Base URL for CUA server (default: http://localhost:8000)
Tips
- Wait Between Commands: Add
sleep between commands to allow UI to update
- Check Coordinates: Screen is 1280x720, center is at (640, 360)
- Screenshot for Debugging: Take screenshots before and after actions to verify
- Use Variables: Store coordinates and text in variables for reusability
Example OpenClaw Usage
curl -X POST http://localhost:8000/cmd \
-H "Content-Type: application/json" \
-d '{"command": "get_cursor_position"}'
CUA_SERVER_URL: Base URL for CUA server (default: http://localhost:8000)
Tips
- Wait Between Commands: Add
sleep between commands to allow UI to update
- Check Coordinates: Screen is 1280x720, center is at (640, 360)
- Screenshot for Debugging: Take screenshots before and after actions to verify
- Use Variables: Store coordinates and text in variables for reusability
Example OpenClaw Usage
sleep between commands to allow UI to updateOnce this skill is loaded, you can use it in OpenClaw conversations:
User: "Take a screenshot and open Firefox"
OpenClaw: *executes the screenshot and launch firefox commands*
User: "Type 'Hello World' in the current window"
OpenClaw: *executes the type_text command*
User: "Click at the center of the screen"
OpenClaw: *executes click command at 640,360*
Troubleshooting
- Connection Refused: Make sure CUA server is running on port 8000
- No Response: Check if you're in the container or have SSH tunnel set up
- Commands Not Working: Verify with
curl http://localhost:8000/status
- Wrong Coordinates: Remember screen is 1280x720, adjust coordinates accordingly
curl http://localhost:8000/status正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。