UI代理MCP
给AI代理 完成UI访问 --查看屏幕、阅读文本、单击、键入、滚动、拖动。
🚀 一个命令安装
curl -fsSL https://raw.githubusercontent.com/4shil/ui-agent-mcp/main/quickinstall.sh | bash或手动:
git clone https://github.com/4shil/ui-agent-mcp.git
cd ui-agent-mcp
bash install.sh🧠 模型
| 型号 | 尺寸 | 用途 |
|---|---|---|
| 佛罗伦萨-2 (微软) | ~0.9GB | UI理解、元素检测 |
| GLM-OCR (Z.AI) | ~0.7GB | 文本、表格、公式提取 |
安装过程中两者都会自动下载。建议使用GPU(NVIDIA CUDA),但CPU可以工作。
🎮 TUI仪表板
安装后启动交互式仪表板:
cd ~/ui-agent-mcp
source .venv/bin/activate
python dashboard.py特征:
- 🔥 实时GPU监控(利用率条、内存、温度)
- 💻 系统统计数据(CPU、RAM、正常运行时间)
- 🤖 模型下载状态
- 📊 行动分析(总计、每小时、错误、顶级行动)
- 🖥️ 实时MCP服务器日志流
- 📥 一键式模型下载
- 🔍 健康检查
- ⌨️
q=退出,r=刷新
🔌 MCP 服务器
启动MCP服务器(25个AI代理工具):
source .venv/bin/activate
python server.pyMCP配置
{
"mcpServers": {
"ui-agent": {
"command": "python3",
"args": ["server.py"],
"cwd": "/home/USER/ui-agent-mcp"
}
}
}🛠 25工具
屏幕截图
screenshot · screenshot_region · get_screen_info
视觉(Florence-2)
describe_ui · describe_ui_detailed · locate_element · locate_all · detect_all
OCR(GLM-OCR)
read_text · read_text_region · read_table · read_formula · read_form
老鼠
click · double_click · right_click · hover · scroll · drag · get_mouse_position
键盘
type_text · press_key · hotkey · type_and_enter
复合
find_and_click · type_into · wait_for_element
应用程序和安全
open_app · close_app · get_focused_window · get_safety_stats
📋 代理循环模式
1. screenshot() → see
2. describe_ui() / read_text() → understand
3. locate_element() → find
4. click() / type() → act
5. screenshot() → verify🔧 命令
bash install.sh # Full install (deps + venv + models + config)
bash scripts/health_check.sh # Verify everything
bash scripts/download_models.sh # Re-download models
bash scripts/uninstall.sh # Remove everything
python dashboard.py # Launch TUI dashboard
python server.py # Start MCP server📁 项目结构
ui-agent-mcp/
├── install.sh # One-command installer
├── quickinstall.sh # curl | bash installer
├── server.py # MCP server (25 tools)
├── dashboard.py # TUI dashboard
├── vision.py # Florence-2 vision engine
├── ocr_engine.py # GLM-OCR text extraction
├── screen_capture.py # Screenshot via mss
├── ui_controller.py # Mouse/keyboard actions
├── element_finder.py # Smart find + click
├── safety.py # Rate limits, audit log
├── config.py # Settings
├── requirements.txt # Python deps
├── requirements-tui.txt # TUI deps
├── mcp_config.json # OpenClaw config
├── scripts/
│ ├── setup_deps.sh # System packages
│ ├── setup_python.sh # Venv + pip with progress
│ ├── detect_gpu.sh # GPU detection
│ ├── download_models.sh # Model downloader
│ ├── setup_mcp.sh # MCP config generator
│ ├── setup_service.sh # Systemd service
│ ├── health_check.sh # Status checker
│ └── uninstall.sh # Cleanup
├── tests/
│ └── test_all.py
└── models/ # AI models (downloaded)📦 需求
- Python 3.10+
- Linux(x11)/macOS/Windows
- GPU可选(建议使用NVIDIA CUDA)
许可证
麻省理工学院
