Pular para o conteúdo principal
Y

omni-desktop-mcp

yangdw2024/omni-desktop-mcp

Mounts omni-desktop-mcp over stdio for Windows desktop automation: COM UIA tree diffs, PrintWindow background capture, RapidOCR/WinRT OCR, OpenCV icon templates, SoM grid, Macro v2 playbooks, rich clipboard, HTTP Bearer auth, and JSONL audit logs.

Instalar

dsh plugin --profile web add github:yangdw2024/omni-desktop-mcp

README

Omni-Desktop-MCP

An industrial MCP server that lets an AI agent observe and operate desktop applications reliably through three stable tools (desktop_observe, desktop_act, desktop_status) — protecting prompt caches across DeepSeek Harness (DSH), Antigravity (agy), Codex, Trae CN, and Doubao.

Platform status

PlatformStatus
Windows 10/11Implemented and tested (18 automated tests including live Windows E2E & HTTP auth).
macOSExperimental stub: window listing and screenshots only; input actions return unsupported_on_current_host. Not tested on macOS hardware.
LinuxExperimental stub using wmctrl/xdotool when present. Not tested on a Linux desktop.

This is alpha software (0.3.0). It can click, type, paste files, and close windows on your machine. Read Safety first.

Highlights (v0.3.0)

  • 3–4× faster Windows UIA: single-RPC COM IUIAutomation.FindAllBuildCache on a dedicated STA thread (with BFS fallback) plus live COM element handle caching for fast background L1 actions.
  • Background capture without stealing focus: PrintWindow(PW_RENDERFULLCONTENT) reads obscured Windows apps cleanly (with automatic correction for DPI-unaware windows under >100% scaling and black-frame screen fallback).
  • Adaptive dual-engine OCR + frame-hash cache: offline RapidOCR (pip install "omni-desktop-mcp[full]") with zero-dependency WinRT OCR (Chinese + English) fallback and ~1–2 ms identical-frame cache hits.
  • Visual grounding for icon-only & canvas apps:
    • OpenCV multi-scale icon template matching (capture_template + template_path) with NMS deduplication (~15–40 ms, 0 vision tokens).
    • Set-of-Mark (SoM) grid (grid=true → target="grid:C4") and localized zoom_scale magnification.
    • wait_until_stable: polls background frame hashes until slow renders/exports finish.
  • Rich system clipboard (CF_HDROP / CF_DIB): action="clipboard" supports get_text, set_text, get_files, set_files (paste multiple files directly into WeChat/Explorer/Origin via Ctrl+V), and set_image.
  • Macro v2 playbooks: macro_record_start / macro_record_stop / macro_save / macro_run / macro_delete with {{var}} templates, dry_run, condition (exists_window / exists_query / not_exists_query), retries, and on_error="continue".
  • Remote security & structured audit:
    • Streamable HTTP enforces Bearer token authentication by default (--token / OMNI_DESKTOP_TOKEN, or ephemeral auto-generated token) plus CIDR IP allowlist (--allow-ips 127.0.0.1,100.64.0.0/10 for Tailscale).
    • Rotating JSONL audit log (~/.omni-desktop/audit/actions.jsonl, inspected via desktop_status(command="audit")); typed text is length-masked, never stored raw.

Install

# Core (zero-dependency Windows WinRT OCR)
pip install omni-desktop-mcp

# Recommended: full bundle (RapidOCR + OpenCV icon template matching)
pip install "omni-desktop-mcp[full]"

Requires Python 3.10+ and mcp 2.x (installed automatically). Windows dependencies (pywin32, uiautomation) install automatically on Windows.

Run directly:

# stdio (default for local clients)
omni-desktop-mcp

# Streamable HTTP with Bearer token + Tailscale CIDR allowlist
omni-desktop-mcp --http --host 0.0.0.0 --port 8765 --token YOUR_SECRET --allow-ips 127.0.0.1,100.64.0.0/10

Register with your clients

omni-desktop-mcp-install          # dry-run preview (nothing written)
omni-desktop-mcp-install --apply  # backs up existing configs (*.bak-*) before writing

Supports Antigravity (~/.gemini), Codex (~/.codex/config.toml), Trae CN, and installs the bundled omni-desktop-control skill. Generic snippets are in clients/doubao-mcp.json.

DeepSeek Harness (DSH) Bundle

Install the companion npm bundle @yangdw2024/omni-desktop-mcp (zero external npm runtime dependencies; includes a native Plugins configuration card using DSH theme tokens):

pip install -U "omni-desktop-mcp[full]"
dsh plugin add @yangdw2024/omni-desktop-mcp

If python on DSH's PATH is not the environment you installed into, set command in the MCP client row to the absolute path of that python.exe.

Tools

  1. desktop_observe(mode, window, diff, max_elements, ocr_lang, ocr_engine, include_image, annotate, background_capture, region, template_path, threshold, grid, grid_cols, grid_rows, zoom_scale)
  2. desktop_act(action, ...)
    • Actions: click, double_click, right_click, move, drag, scroll, type, press_key, hotkey, window_focus, window_state, launch_app, wait_for, wait_until_stable, find_and_act, capture_template, clipboard, batch, macro_record_start, macro_record_stop, macro_save, macro_run, macro_delete.
    • observe_after: "none" | "diff" | "tree" | "ocr" | "hybrid" | "screenshot" merges post-action state after settle_ms.
  3. desktop_status(command): health, policy, macros, audit, reset_guard, clear_snapshots.

Safety

This is not a sandbox. Anything the logged-in user can do with mouse and keyboard, an agent connected to this server can do.

  • Dangerous hotkeys (Ctrl+Alt+Del, Win+L, Shift+Del, Alt+F4) and closing protected windows (DSH, Explorer, core Windows processes) are refused by default — including inside batch and macro_run — unless allow_dangerous=true is explicitly passed.
  • Holding Esc aborts the current action, drag, batch, or macro between steps. No global mouse hooks are installed.
  • Streamable HTTP enforces Bearer token auth by default (--no-auth disables it only when explicitly requested).
  • Windows UIPI: a non-elevated server cannot drive an elevated window (foreground_unavailable).

Testing

pip install pytest
pytest -v

18 automated tests cover snapshot diffs, OCR routing & caching, OpenCV template matching, SoM grid, Macro v2 conditions/retries/error handling, HTTP Bearer auth & IP allowlist, rotating JSONL audit logs, and live Windows E2E (tests/test_windows_e2e.py).

License

MIT. See LICENSE.

Plugins relacionados