DEV Community

Trung Thanh Tran
Trung Thanh Tran

Posted on

Driving Windows Apps Without Sending 10 Screenshots per Task (turbo-desktop-mcp)

Most desktop computer-use agents work by taking a full screenshot after every click. On a 1280x720 desktop capture, one image costs 1,229 input tokens under Anthropic's width * height / 750 formula. A 6-step form fill burns 7,374 vision tokens before the model writes a single word.

I just released turbo-desktop-mcp v0.1.0 on PyPI (uvx turbo-desktop-mcp), a standalone Windows 10/11 MCP server that drives native desktop apps through Windows UI Automation (UIA) first and only falls back to real input or Windows OCR when a control has no UIA pattern.

GitHub: https://github.com/Tthanh2k6/turbo-desktop
PyPI: https://pypi.org/project/turbo-desktop-mcp/

How the control tree and deltas work

Instead of returning raw XML or PNGs, inspect_compact flattens a window into one line per interactive control:

<<<SCREEN_CONTENT w1 TurboFixture>>>
[w1:e1] <Edit> "Full name" = ""
[w1:e2] <ComboBox> "Country" = "Vietnam"
[w1:e3] <CheckBox> "I agree to terms" [unchecked]
[w1:e4] <Button> "Submit"
<<<END_SCREEN_CONTENT>>>
Enter fullscreen mode Exit fullscreen mode

Refs stay stable across calls. On subsequent calls, onlyChanged=true returns only added (*), changed (~), and removed (-) lines. Multi-step sequences run inside batch_actions and stop on the first error.

When an app exposes no UIA tree (custom-drawn canvases, games), inspect_compact sets treeEmpty: true and runs Windows built-in WinRT OCR, returning clickable lines like [w1:o3] text "Save" @412,230.

Measured numbers: UIA deltas vs screenshots

I ran a reproducible 4-task benchmark (desktop-mcp/tests/field/bench_uia_vs_screenshot.py) on Windows 11 against three native C# WinForms fixtures (turbo_fixture.exe, turbo_editor.exe, turbo_canvas.exe). UIA text tokens were counted with tiktoken (o200k_base). Screenshot baselines captured real PNGs on the same windows and measured both exact window crops (460x420 to 620x440) and standard 1280x720 desktop captures.

Task turbo-desktop-mcp (UIA + delta) Window-crop PNGs 1280x720 desktop PNGs Payload bytes (UIA vs PNG)
1. WinForms form fill (3 fields + Submit + verify) 760 tok (4 calls) 1,548 tok (6 shots) 7,374 tok 2.1 KB vs 55.2 KB
2. 5-step stateful UI loop (click + delta diff) 862 tok (12 calls) 1,548 tok (6 shots) 7,374 tok 2.5 KB vs 40.5 KB
3. Native editor multi-line Unicode write + readback 456 tok (4 calls) 1,092 tok (3 shots) 3,687 tok 1.3 KB vs 17.4 KB
4. Custom-drawn canvas (empty UIA tree, WinRT OCR) 235 tok (2 calls) 125 tok (1 shot) 1,229 tok 0.7 KB vs 3.4 KB
Total (4 tasks) 2,313 tok 4,313 tok 19,664 tok 6.5 KB vs 116.4 KB

Two honest takeaways from that table:

  1. On standard WinForms controls (tasks 1 to 3), UIA + deltas cut token usage by 8.1x to 9.7x compared to 720p full-desktop captures, and by 1.8x to 2.4x even against tiny tightly cropped fixture windows.
  2. On Task 4 (360x260 custom canvas with no UIA tree), a cropped PNG (125 tokens) is smaller than the WinRT OCR text output (235 tokens). OCR still helps if you want clickable coordinates without passing images to a vision model, or if the full screen is large.

In an earlier 30-task field run with claude -p --model haiku driving the real MCP server, 29 of 30 tasks passed (173 calls, 203 turns, $0.2513 total). The single failure was UWP Calculator on an isolated exebox desktop where Windows forces UWP activation onto WinSta0\Default.

Things that broke on real Windows before v0.1.0

Three Windows quirks bit me during testing:

  • WinForms modal dialogs hang UIA Invoke. Calling UIA Invoke on a WinForms menu item like File -> Save As... blocks the UIA call until the modal dialog closes. turbo-desktop-mcp returns pending: true / blocked: true instead of hanging, and recommends sending press_keys (Ctrl+S) whenever a shortcut exists.
  • UIPI blocks input to elevated windows. If a normal-privilege server tries to click an admin window, Windows drops the input silently. turbo-desktop-mcp checks process elevation against its own token (is_elevated_above_us) and marks those windows elevated: true, actionable: false.
  • Sharing a live PC with an agent. When falling back to real mouse/keyboard input, turbo-desktop-mcp waits until you stop moving the mouse, holds a low-level hook (WH_KEYBOARD_LL / WH_MOUSE_LL) during the action, draws an orange edge glow around the monitor, and releases immediately on Esc x3 or emergency Ctrl+Alt+Shift+K. Windows with titles matching .env, secret, token, password, or password managers are always hidden and denied.

Quick start (Windows 10/11, Python 3.12+)

claude mcp add turbo-desktop -e PYTHONUTF8=1 -- uvx turbo-desktop-mcp
Enter fullscreen mode Exit fullscreen mode

Or install directly:

pip install turbo-desktop-mcp
Enter fullscreen mode Exit fullscreen mode

The standalone MCP server (desktop-mcp) is MIT-licensed and has 245+ automated Windows tests running on GitHub Actions. If you test it against Electron, WPF, or Qt apps and hit weird UIA trees, open an issue on the repo.

Top comments (0)