Skip to main content
Glama

DesktopOS — AI-to-Windows Bridge

An MCP server for Windows that gives AI agents a persistent PowerShell session, real desktop perception & input injection, and Playwright-powered browser automation.

The core difference from "spawn a new PowerShell for every command": after cd, the directory persists. Environment variables persist. venv state persists. The agent works like a human at a terminal — continuously, not from zero on every call.


Status

Phase

Scope

Status

Shell Worker

Persistent session, verified execution, self-healing

✅ Done

Perception

Dual-channel (Win32 window tree + screen capture, cross-validated)

✅ Done

Execution

Real input injection (click/type/key/scroll, Chinese-safe)

✅ Done

Browser automation

Playwright engine (replaces the former UIA element tree + hand-rolled CDP)

✅ Done

Memory layer

Operation timeline + dHash window index + reference resolution

✅ Done

Diagnoser

Rule-based error triage wired into every tool failure

✅ Done

MCP wrapping + open source

33 tools over stdio

✅ Done


Related MCP server: Windows-MCP

Quick Start

Requirements: Windows 10/11 + Node ≥ 22. A Chromium-based browser (Edge/Chrome preinstalled on Windows works out of the box).

git clone https://github.com/boring-hong/desktopos.git
cd desktopos

npm install
npm test          # 327 assertions, all green before anything ships
npm start         # run as an MCP server (stdio)

npm test really spawns PowerShell, really launches a headless browser, and really moves your mouse (read-only actions). Not mocks.

Register with an MCP client

Merge this into your client config (template: examples/mcp-config.json):

"desktopos": {
  "type": "stdio",
  "command": "node",
  "args": ["C:/path/to/desktopos/src/mcp-server/index.js"],
  "cwd": "C:/path/to/desktopos"
}
  • DSH: C:\Users\<you>\.dsh\dsh-mcp-manager.json

  • Claude Desktop: %APPDATA%\Claude\claude_desktop_config.json

  • Cursor: %USERPROFILE%\.cursor\mcp.json

Whichever file already exists is the one to edit. Use forward slashes to dodge JSON backslash escaping. Restart the client afterwards.

First time? Read docs/QUICKSTART.md — a five-minute one-pager with copy-paste client config, a one-minute self-check, typical usage, and known limits.

Want to judge whether it's trustworthy? Read docs/REVIEW.md — review guide with a 5-minute verification path, directory navigation, known boundaries, and security notes.


Exposed Tools

Tool

What it does

shell_exec

Run a command in the persistent session

shell_cd

Change working directory (Chinese paths supported)

shell_cwd

Get current directory

shell_env_set / shell_env_get

Environment variables that persist across calls

shell_exec_verified

Execute + independently verify the result + retry with backoff (self-healing)

shell_reset

Restart the PowerShell session when it goes sideways

desktop_list_windows

Structure channel: enumerate windows (title/process/rect/focus/minimized)

desktop_screenshot

Vision channel: screen capture, PNG/JPEG (maxWidth / format control payload size)

desktop_perceive

Dual-channel + cross-validation (the core capability)

desktop_cursor

Read mouse position (read-only)

desktop_move

Move the mouse (no click)

desktop_click

Click / double-click / right-click (optional verify + verifyRegion)

desktop_type

Type text, Chinese-safe (clipboard + Ctrl+V)

desktop_key

Key combos like ctrl+c / alt+tab

desktop_scroll

Mouse wheel

desktop_focus_window

Bring a window to the foreground (restores if minimized)

pw_launch

Launch (or reuse) a Playwright-driven Chromium instance

pw_navigate

Navigate the current page

pw_snapshot

Aria snapshot (YAML) of the page — every interactable node carries a [ref=eN]

pw_click

Click by ref (most reliable), or by name/role fallback

pw_type

Type text — native Unicode, Chinese/emoji lossless, no clipboard involved

pw_press

Key combos to the page

pw_evaluate

Run JavaScript in the page, return JSON

pw_screenshot

Page-level screenshot (optional full-page)

pw_wait

Wait for text / selector / fixed ms

pw_tabs

List or switch browser tabs

pw_close

Close the browser, clean up the throwaway profile

memory_recall

Resolve a reference ("that window from before" / "WeChat") into coordinates

memory_timeline

Recent operation timeline

memory_stats / memory_clear

Index stats / wipe

desktop_diagnose

Translate any error text into "why + what to do + can it auto-fix"

Typical shell flow:

shell_cd   → <some directory with Chinese characters>
shell_exec → git status          ← runs in that same directory

Self-healing flow (never trust a command's own exit code — verify for real):

shell_exec_verified
  command: New-Item -ItemType Directory -Path 'D:\新目录' -Force | Out-Null
  expect : { "isDir": "D:\\新目录" }
  retries: 2

expect supports: pathExists / pathNotExists / isDir / isFile / fileContains:[path, text] / cwd. Verification goes through Node's fs (native UTF-8 paths), not through the shell — equally reliable on Chinese paths.

Browser flow (the Playwright loop):

pw_launch  { url: "https://example.com" }   → browser up
pw_snapshot {}                              → YAML with refs: button "Sign in" [ref=e5]
pw_click   { ref: "e5" }                    → click it, no coordinates involved
pw_type    { text: "你好世界", ref: "e3" }   → type into a textbox, lossless
pw_evaluate{ expression: "document.title" } → ask the page anything
pw_close   {}                               → done

Tool-surface trimming (for multi-server setups)

The problem isn't having many tools — it's that overlaps go unarbitrated.

Mainstream MCP clients only toggle whole servers, not individual tools. Install another desktop-automation server alongside a browser-automation server, and a fair share of this server's 33 tools now answer the same question twice: two ways to "click that control", three ways to "take a screenshot". The model guesses every call, and guess-error rate scales with overlap. This degradation is real once you install enough servers.

Can't fix the client, so fix it server-side: trim the overlapping part at startup and the decision point disappears.

# by group
DESKTOPOS_TOOLS=shell,diagnose node src/mcp-server/index.js

# by tool name, mixable
DESKTOPOS_TOOLS=shell_exec,shell_cd,desktop_perceive node src/mcp-server/index.js

# or exclusion (exclude wins)
DESKTOPOS_TOOLS=shell,desktop DESKTOPOS_TOOLS_EXCLUDE=desktop_screenshot

# CLI equivalents
node src/mcp-server/index.js --only=shell,diagnose

Groups:

Group

Tools

When to trim

shell

shell_exec / _verified / _cd / _cwd / _env_get / _env_set / _reset

Almost never — the most irreplaceable part

desktop

list_windows / perceive / screenshot / cursor / move / click / type / key / scroll / focus_window

When you already run another desktop automation

pw

pw_launch / navigate / snapshot / click / type / press / evaluate / screenshot / wait / tabs / close

When you already run the official Playwright MCP

memory

memory_*

When you don't need desktop state memory

diagnose

desktop_diagnose

Pure knowledge; keep it

Three behavioral guarantees (covered by test/toolfilter.test.js):

  1. No filter set = everything exposed — the default OSS experience stays intact;

  2. After trimming, tools/list only contains the selected tools;

  3. Call-time enforcement too — trimming only tools/list is not enough: the client's tool table may be cached, and the model may remember old names. Those calls must be rejected, not silently executed.

Companion: overlap audit

Trimming is human judgment, so there's a script that quantifies "overlap" into numbers:

npm run audit:overlap

It connects to every MCP server in your config, pulls each tools/list, and outputs cross-server near-duplicate pairs by name and description similarity. Use it as a candidate list, not a verdict:

  • Same name, different semantics is common (windows-mcp/Click clicks OS windows; playwright/browser_click clicks page DOM elements — those should not merge);

  • Mixed Chinese/English descriptions make description-similarity unreliable — name similarity + human judgment is all you get;

  • It only sees MCP servers, not client-native tools (built-in shell, file I/O), so real overlap is larger than the reported number.

Run it every time you install a new server. That's the entire reason this script exists.


Self-healing: the diagnoser

Earlier self-healing was half-built: execute → verify → retry. But "retry" is meaningless for most failures: a mistyped command fails ten more times. The missing step was understanding why it failed.

Every failure now goes through a rule-based diagnoser that produces:

category    failure class (access-denied / cmd-not-found / missing-parent / ...)
reason      plain-language explanation
hint        actionable hint
suggestion  concrete next step (command or tool call)
retryable   whether retrying-as-is makes any sense
fix         auto-fix command, when a safe one exists

retryable is the key judgment here. Most AI desktop tools blindly retry on failure. "Access denied", "command not found", "bad parameter" — retrying those a thousand times is wasted time. The diagnoser says so directly and points at the real next action.

Auto-fix has boundaries

Only purely additive fixes run by default (currently one class: creating a missing parent directory). Everything else requires explicit opt-in. Two hard constraints:

  1. The parent must actually not exist — otherwise the target itself is missing and creating the parent is pointless;

  2. The command must be a creating verb — building a directory for a Get-ChildItem read fabricates a path that shouldn't exist. That's not healing, that's hallucinating.

Real example (green in tests):

New-Item -ItemType File -Path '...\a\b\x.txt'      ← parent a\b missing
  ↓ diagnose: missing-parent (retry is meaningful)
  ↓ auto-fix: New-Item -ItemType Directory -Path '...\a\b' -Force
  ↓ re-run, verification passes, file really exists

Rules deliberately avoid LLMs

Pure string matching: millisecond latency, testable, regression-proof. The cost is only known categories get covered — on a miss it honestly says "unclassified" and passes the raw error through so the rule table can grow.

Covered: encoding corruption / file locks / access denied / command not found / parameter errors / type conversion / syntax errors / timeouts / target exists / path missing / missing parent / element not found / ambiguous element / window minimized / invalid handle / browser not launched.

Every tool error carries a diagnosis automatically — not just shell. It's hooked in the MCP catch-all.


Architecture

Node (MCP Server, stdio)
   ├─ HTTP 127.0.0.1:<random> ──▶ PowerShell 5.1 workers (shell / sensor / actor)
   │     header: X-DOS-Token: <random per process>   one long-lived runspace each
   │     body:   { command: base64(UTF-8) }          → Win32 / screen capture / input injection
   └─ playwright-core ──▶ Chromium (ms-playwright cache or system Edge/Chrome)
         persistent context, aria snapshots, aria-ref locators

Why even a loopback port must authenticate

"Bound to 127.0.0.1" does not mean private. The attack path is concrete:

  1. A malicious page calls fetch('http://127.0.0.1:<port>/exec', { method: 'POST', body: '<json>' });

  2. The default Content-Type: text/plain is a CORS-safelisted value — this is a "simple request", no preflight, the browser sends it directly;

  3. The response is unreadable (CORS blocks it), but the side effect already happened. The port is random but only has ~16k candidates — a page blind-scans them in seconds.

Conclusion: without auth, visiting any web page hands your PowerShell, mouse, and keyboard to it.

Current design:

  • Node generates a 32-byte random token per worker, passed to PowerShell via argv;

  • Every request must carry X-DOS-Token; mismatch → 403;

  • Any request with an Origin header → 403 (our own Node client never sends one).

The linchpin is the custom header: not safelisted, so cross-site requests must preflight, and the browser blocks them outright. Regression tests in test/resilience.test.js cover cross-site Origin + text/plain, missing token, wrong token, correct token.

The token travels via argv, readable by other local processes — but an attacker with local code execution doesn't need our token. Outside the threat model.

Why not stdin pipes + markers

The first implementation was powershell.exe -Command -: write commands to stdin, detect command end via a marker string. Four unavoidable pits (all confirmed by measurement):

  1. Encoding: powershell.exe decodes piped stdin with [Console]::InputEncoding — CP936/GB2312 on Chinese Windows. UTF-8 bytes from Node become mojibake → Chinese paths 100% broken. Measured: InputEncoding : gb2312 (codepage 936).

  2. Stream interleaving: stdout and stderr interleave; markers drown in command output or get falsely matched by residual buffers.

  3. Process exit: terminating errors make PowerShell exit(1) — the marker never arrives.

  4. Error loss: Invoke-Expression doesn't reliably merge non-terminating errors into the caller's error stream.

Fixes:

  • HTTP transport: commands base64-encoded in the body, responses explicitly written as UTF-8 bytes — console encoding is never touched;

  • Scriptblock dot-sourcing + redirection (. $sb 2>&1): captures non-terminating errors while keeping variables/cwd in the same runspace.

worker.ps1 is deliberately pure ASCII; all non-ASCII data travels as base64 — which also sidesteps PowerShell's default ANSI decoding of .ps1 files.

War story: watch out for AMSI when editing these .ps1 files. Adding JPEG quality parameters to perception.ps1 (ImageCodecInfo::GetImageEncoders() + EncoderParameters) made Windows Defender classify the whole script as "contains malicious content" and refuse to run it. The snippet alone was fine; combined with "screen capture + base64 + HttpListener" it tripped a composition heuristic. The plain ImageFormat::Jpeg overload passes. Test before committing any "capture-then-encode" code.


Recovering from a wedged session

A PowerShell 5.1 runspace is single-threaded: one stuck command (an interactive prompt, an npm install without -y, a hanging network call) blocks GetContext() forever — every subsequent request times out.

The early stop() awaited a /shutdown with no timeout — the peer was already wedged, so the escape hatch hung too, and shell_reset never returned. Restarting the MCP client was the only way out.

Current layering:

Layer

Mechanism

Command

Timeout throws; hard-restarts the worker automatically, then replays remembered cwd + env vars

Request

_request has its own timeout (command timeout + 5s) — no layer can hang the one above it

Stop

Short timeout (1.5s) graceful shutdown, then unconditional kill and wait for real exit

Start

The startup promise is cached; concurrent callers share one spawn (_spawnOnce retries up to 3 times)

So the cost of one wedged command is "restart + state replay", not "the whole session is dead". To be precise about the cost: variables not recorded via shell_env_set, and non-cwd runscape state (function definitions, imported modules) do get lost. test/resilience.test.js verifies cwd and shell_env_set variables survive.


Dual-channel perception

Most AI desktop tools do "screenshot → OCR → guess". Wrong architecture. Here, two channels run side by side:

Channel

Implementation

Output

Structure

Win32 P/Invoke: EnumWindows / GetWindowRect / GetWindowText / GetForegroundWindow

handle, title, process, PID, rect, focus, minimized

Vision

System.Drawing full-screen capture, per-window pixel std-dev sampling

whether that region actually renders content

Cross-validation: a window the structure channel calls "visible" must, in the vision channel, (1) intersect the screen and (2) actually contain rendered content. Otherwise it's flagged inconsistent, with three causes:

minimized  parked by Windows at -32000/-21333 coordinates
offscreen  outside the screen
blank      no content in region (e.g. 1x1 hidden windows)

Measured on this machine: 17 windows, 5 consistent, 12 inconsistent (8 minimized / 2 offscreen / 2 blank). The key fact: IsWindowVisible returns true for minimized windows — window-list-only perception misjudges; the two channels must check each other.


Execution layer (UI actor)

Real input injection: focus / move / click / scroll / type / key.

Chinese input is a pit: SendKeys doesn't support Unicode and silently mangles CJK. Typing goes through the clipboard (SetText, full Unicode) + Ctrl+V — same project-wide principle: non-ASCII never travels naked through shell/console encoding.

Built-in verification: any action can request verify, capturing before/after screenshots and returning a sampled diffRatio. "Act → verify" is infrastructure, not something every caller reassembles.

Verification can be region-scoped: verifyRegion: { x, y, w, h } (usually the target window's rect). Without it you compare the full screen — and full-screen comparison answers "did anything on screen change", not "did MY action change the thing I acted on". A ticking clock or blinking caret will count as a change. The response carries scope: "region" | "screen" so the strength of the conclusion is visible.

Typical loop:

desktop_perceive                          → target window handle + rect
desktop_click {x, y, verify, verifyRegion → click it, compare only within that window
              : <rect>}
desktop_screenshot                        → eyeball confirmation

⚠️ Clicks and typing really steal your mouse and keyboard focus. Automated tests only cover read-only / side-effect-free actions (cursor / move). Real click / type / key: use test/_dbg-actor.js manually or call via MCP explicitly.

node test/_dbg-actor.js cursor
node test/_dbg-actor.js click 500 300        # really clicks; 5s built-in countdown
node test/_dbg-actor.js type "中文输入测试"

Browser automation (Playwright engine)

v0.3 replaced the two former browser paths — a hand-rolled CDP client and the UIA element tree — with one Playwright engine (src/playwright/). Why:

  • UIA is blind inside Chromium/Electron apps (measured: 0 elements enumerated on an Electron app);

  • The hand-rolled CDP worked, but every capability (AX tree, click, typing, screenshots) meant hand-assembling protocol messages;

  • Playwright ships all of it, maintained by Microsoft, and adds auto-waiting, strict locators, and retry semantics we'd otherwise reimplement poorly.

The ref-based interaction loop

The engine follows the same layout as the official Microsoft Playwright MCP — not a copy, but the same core insight: locate by stable ref, not by coordinates.

  1. pw_snapshot captures an aria snapshot in mode: "ai" — a YAML outline of the page where every interactable node carries a [ref=eN];

  2. Pass that ref to pw_click / pw_type — the internal aria-ref selector engine resolves it to the exact element;

  3. No ref? Name/role fallback still works (fuzzy match against role names, labels, placeholders, and visible text — Chinese-friendly).

Refs stay valid across calls until the page navigates; on a stale ref the tool says so and points at pw_snapshot for a fresh one.

Design notes

  • Persistent context, throwaway profile. Each launch gets a unique user-data-dir under ~/.desktopos/, deleted on close — no profile-lock fights with your running browser. Pass userDataDir explicitly to keep logins.

  • Browser resolution order: local ms-playwright cache → system Edge → system Chrome → Playwright's own lookup. npx playwright-core install chromium pre-installs if you want a pinned browser.

  • Chinese input is native. fill()/keyboard events go through Unicode directly — no clipboard, no IME, no layout issues.

  • One engine instance per server; pw_launch reuses a live browser instead of spawning another.


Memory layer

Solves the most painful part of agents operating a computer: not remembering what was done or seen. With it, references like "click that button from before" resolve.

Three parts:

Part

Implementation

Operation log

One timestamped entry per perceive / act / shell call

Feature index

8×8 dHash (difference hash) of windows — real "screenshot → vector", re-recognizable by Hamming distance

Context manager

Focus window history / navigation stack

Persisted at ~/.desktopos/memory.json, surviving process restarts.

Measured:

"刚才那个窗口"  -> 微信 [WeChat]        (853,509)   matched by recency
"explorer"      -> Program Manager      (854,534)   matched by keyword
"Excel"         -> exists but minimized — restore first via desktop_focus_window (handle 68036)

The last line is the key design: distinguishing "really absent" from "present but minimized". Calling it "not found" would mislead the agent, so the response carries an actionable hint + the handle.

The perceptual hash is an 8×8 grayscale difference hash — no ML model involved, still re-recognizes windows after moves and resizes.

Why not aHash: aHash only records "brighter or darker than average", discarding all gradient direction and color. Measured on 33 local windows, aHash computed the exact same 64-bit fingerprint (distance 0) for File Explorer and an unrelated web page; findByHash exists precisely to turn "that window from before" into coordinates — a wrong match means a real click on the wrong target. With dHash, 105 window pairs measured: only 2 at distance 0 (both flat small windows), 98 pairs > 12. Enough separation.

Even so, the hash is a weak signal: findByHash(hash, { expect: { title, process } }) should cross-check title/process before trusting a match; default threshold tightened from 10 to 6. Identical hashes on solid-color/blank regions are expected degradation.


Test coverage

npm test = 6 encoding guard + 13 shell worker + 15 resilience/security + 13 tool filtering + 20 perception + 11 actor + 128 diagnoser + 38 memory + 10 Playwright engine + 73 MCP end-to-end — 327 assertions.

The Playwright block is true end-to-end: really launches a headless Chromium, really types Chinese into a textbox via ref, really clicks, asserts the DOM actually changed, checks the screenshot is a valid PNG. Auto-SKIPs (not fails) if no browser is available.

Resilience/security (resilience.test.js) covers three classes of real past incidents:

  • Auth: cross-site Origin + text/plain, missing token, wrong token → 403; correct token executes

  • Wedge recovery: session auto-recovers after command timeout; cwd and shell_env_set variables replayed; stop() returns in bounded time even when wedged

  • Concurrent cold start: 5 concurrent start() spawns exactly one process

  • Request body cap: 5 MB body → 413, not an unbounded ReadToEnd()

Encoding guard (ascii-guard): enforces pure-ASCII .ps1 files. PowerShell 5.1 reads BOM-less .ps1 as ANSI/CP936; a stray Chinese comment decodes to mojibake and silently corrupts the next line (this once broke an entire $min = if (...) {...} line, producing JSON like "minimized":,). This test is the enforcement arm of that rule.

Key regression points:

  • cd into a Chinese-character path (...\代码\desktopos) — the old design always broke here

  • Chinese window titles round-trip through perception with no U+FFFD

  • Directory/env persistence across MCP calls

  • Non-terminating errors, terminating errors, and native-command stderr all captured

  • Session stays alive after errors (no hangs)

  • Cross-validation self-consistent: consistent + inconsistent = total, matching the boolean fields

  • Clicking a nonexistent element returns isError and mis-clicks nothing

  • Diagnoser's retryable: false verdicts actually stop retries (not just in the hint text)

  • C:\Users\Administrator\... paths don't get misdiagnosed as access-denied

  • Every tool the dispatcher handles is declared in tools/list (otherwise the agent can't see it)

Debug tools (not tests)

  • test/_dbg-exec.js — inspect command output/error/exitCode one by one

  • test/_dbg-perception.js — print dual-channel details and timings

  • test/_dbg-actor.js — manually trigger real click / type / key (excluded from automated tests)

  • test/_dbg-pw3.js — minimal Playwright engine interaction loop


File layout

src/
├── mcp-server/index.js      MCP server (stdio transport, 33 tools)
├── http-worker/index.js     Shared transport for the three PS workers: token auth / layered timeouts / port retries / unconditional kill
├── verifier/index.js        Execute→verify→diagnose→fix→retry (self-healing loop, retryable wired)
├── diagnoser/index.js       Error diagnoser: rule table, produces reason/hint/suggestion/fix
├── playwright/index.js      Playwright engine: persistent context, aria snapshots, aria-ref locators, name/role fallback
├── sensor/
│   ├── index.js             Node side: perception worker wrapper (listWindows/screenshot/perceive)
│   └── perception.ps1       PowerShell side: structure channel + vision channel + cross-validation + dHash
├── actor/
│   ├── index.js             Node side: actor worker wrapper (focus/click/type/key/scroll)
│   └── actor.ps1            PowerShell side: Win32 input injection + region-scoped screenshot diffing
├── memory/index.js          Memory layer: op log / feature index / context stacks
└── shell-worker/
    ├── index.js             Node side: session wrapper + auto-restart and state replay after wedges
    └── worker.ps1           PowerShell side: HttpListener + token check + execution engine
test/
├── ascii-guard.test.js      .ps1 pure-ASCII guard (encoding regression)
├── shell-worker.test.js     Shell worker unit/integration
├── resilience.test.js       Auth / wedge recovery / concurrent singleton / body cap
├── perception.test.js       Dual-channel perception
├── actor.test.js            UI actor (safe subset)
├── diagnoser.test.js        Diagnoser: classification + real self-healing integration
├── memory.test.js           Memory layer (temp storage, never touches real memory)
├── playwright.test.js       Playwright engine end-to-end (headless)
├── mcp-e2e.test.js          Full MCP protocol end-to-end
├── _dbg-*.js                Manual debug tools (not in npm test)
└── _probe-*.js              Review-period repro scripts (not in npm test)

License

MIT — see LICENSE.

Available Tools

33 tools
desktop_browser_launchA

启动一个"可被 CDP 调试"的浏览器实例(Edge / Chrome)。 带 --remote-debugging-port 和一次性的 --user-data-dir(不传时每个实例独立目录, 关闭时自动删除),不会抢你正在用的浏览器 profile。 端口只监听 127.0.0.1。返回端口号,之后用 desktop_cdp_open 连它。 headless=true 时不弹窗口,适合自动化;headless=false 时窗口会真的跳出来。

Inputs: url, waitMs, headless, browserPath, +1 more.

desktop_cdp_clickA

按名称点击页面里的控件(走 CDP 注入真实鼠标事件)。 先定位控件矩形中心再点,所以不需要你猜坐标。同名多个时会报错并列出候选。

Inputs: name (required), role, session.

desktop_cdp_closeA

关闭 CDP 会话,并杀掉由 desktop_browser_launch 启动的浏览器进程。 用完记得调用,否则无头浏览器会留在后台。

Inputs: session, killBrowser.

desktop_cdp_elementsB

列出当前页面内的控件(CDP 无障碍树)。 返回角色(button/link/textbox/...)、名称、层级深度。中文名称完整保留。 已自动去重:AX 树给一个按钮同时产出 button/StaticText/InlineTextBox,这里只留能操作的那个。

Inputs: role, limit, session.

desktop_cdp_evalA

在当前页面执行 JavaScript 并返回结果(JSON 化)。 这是 CDP 相对 UIA 的杀手锏:拿不到的信息可以直接问页面要。

Inputs: expression (required), session, awaitPromise.

desktop_cdp_openA

连上一个浏览器的页面,建立 CDP 会话(后续 cdp_* 工具都作用于它)。 可按 title / url 子串或下标选页面;带 url 时会先导航过去。 这是操作 Chromium 系应用(Chrome / Edge / Electron)的入口 —— UIA 看不见它们的内部,CDP 能。

Inputs: url, port, index, title, +1 more.

desktop_cdp_screenshotA

截取当前页面(不是整屏)。返回 PNG。 页面级截图比全屏截图更适合判断"浏览器里现在是什么状态"。

Inputs: session.

desktop_cdp_targetsA

只读:扫描本机所有开放的 CDP 调试端点及其页面,不做任何修改。 用来判断"现在能不能连浏览器"。 如果为空,说明没有浏览器开调试端口 —— 用 desktop_browser_launch 启动一个。

Inputs: no named parameters.

desktop_cdp_typeB

向页面输入文本。走 CDP 的 Input.insertText, 不经过键盘布局,中文 / emoji 天然无损(比 SendKeys 和剪贴板都干净)。 可用 target 先聚焦到某个输入框。

Inputs: text (required), clear, target, session.

desktop_clickA

在指定坐标点击鼠标。会真实操作你的桌面 —— 调用前请确认目标位置。 坐标可从 desktop_perceive 得到的窗口矩形推算(例如取其中心)。

Inputs: x (required), y (required), count, button, +2 more.

desktop_click_elementB

元素级执行:按可见文本定位控件并触发它。 优先用 UI Automation 的 InvokePattern(对按钮最可靠),不支持时退回点击其中心。 会真实操作界面,调用前请确认控件名称。

Inputs: name (required), handle (required), verify, verifyRegion.

desktop_cursorA

读取当前鼠标光标坐标(只读,安全)。

Inputs: no named parameters.

desktop_diagnoseA

把一条报错文本翻译成"为什么 + 怎么办"。 任何工具返回错误时都会自动附带诊断;这个工具用于手动诊断任意一段报错。 规则匹配、毫秒级返回,不调 LLM。

Inputs: error (required), output, command.

desktop_elementsA

元素级结构通道:枚举一个窗口内的 UI 控件(UI Automation)。 返回控件名称、类型(Button/Edit/...)、AutomationId、坐标矩形、是否可 Invoke。 适合定位"确定按钮"这类具体控件,比只按坐标猜可靠得多。 注意:Electron / Chromium 类应用默认不暴露控件树,会返回很少或 0 个 (这类需要用 CDP,即路线图 Week 5-6)。原生 Windows 应用正常。

Inputs: handle (required), maxElements.

desktop_focus_windowA

把指定句柄的窗口切到前台(最小化时会先还原)。句柄来自 desktop_list_windows / desktop_perceive。

Inputs: handle (required), verify.

desktop_keyB

发送组合键,如 ctrl+c / ctrl+v / alt+tab / enter / tab / f5。会作用于当前焦点窗口。

Inputs: combo (required), verify, verifyRegion.

desktop_list_windowsA

结构通道:枚举当前所有可见窗口。 返回句柄、标题、进程名、PID、屏幕矩形、是否聚焦、是否最小化。 用它可以知道"屏幕上有什么",以及目标窗口的位置。

Inputs: no named parameters.

desktop_moveA

移动鼠标到指定坐标(不点击)。副作用小,可用于定位或配合 verify 观察界面反应。

Inputs: x (required), y (required), verify.

desktop_perceiveA

双通道感知 + 交叉验证(核心能力)。 结构通道枚举窗口,视觉通道对每个窗口区域采样,判断它是否真的可见、真的有内容。 返回每个窗口的一致性结论,并列出不一致原因(minimized / offscreen / blank)。 结果会自动写入记忆层,之后可用 memory_recall 按指代定位。

Inputs: format, maxWidth, includePng.

desktop_screenshotA

视觉通道:截取主屏幕。返回 PNG/JPEG(base64)与尺寸。 用于看布局、颜色、图标等结构通道拿不到的信息。 需要控制消息体积时传 maxWidth(如 1280)+ format:"jpeg"。

Inputs: format, maxWidth, includePng.

desktop_scrollC

在指定坐标滚动滚轮。delta 为负向下、正向上,通常 120 为一格。

Inputs: x (required), y (required), delta, verify, +1 more.

desktop_typeA

在当前焦点处输入文本,支持中文。 实现走剪贴板 + Ctrl+V(SendKeys 不支持 Unicode,会把中文打成乱码)。 注意:会改动你的剪贴板内容,并输入到当前焦点窗口。

Inputs: text (required), verify, verifyRegion.

memory_clearB

记忆层:清空时间线与窗口索引。

Inputs: no named parameters.

memory_recallB

记忆层:把一句指代解析成可点击的坐标。 支持 "刚才那个窗口"、"钉钉"、"WorkBuddy" 这类说法,返回窗口中心坐标, 可直接拿去 desktop_click。 支持窗口级与元素级两种命中("刚才那个按钮" 会定位到控件)。

Inputs: query (required).

memory_statsA

记忆层:查看索引规模与最后更新时间。

Inputs: no named parameters.

memory_timelineB

记忆层:查看最近的操作时间线(感知/点击/输入/命令)。

Inputs: limit.

shell_cdA

修改持久化会话的工作目录(cd),后续 shell_exec 都在新目录执行。

Inputs: path (required).

shell_cwdB

获取持久化会话的当前工作目录。

Inputs: no named parameters.

shell_env_getB

获取持久化会话中的环境变量值。

Inputs: name (required).

shell_env_setA

在持久化会话中设置环境变量。后续所有 shell_exec 都能读到。

Inputs: name (required), value (required).

shell_execA

在持久化 PowerShell 会话中执行命令。 核心创新:这是一个长期存活的 Shell 进程,不是每次开新进程。 效果:cd 之后目录保持、set 的环境变量保持、Python venv / node -e 等状态保持。 适用于:需要连续操作的场景(先 cd 再 git status、先激活 venv 再 pip install)。

Inputs: command (required), timeout.

shell_exec_verifiedA

执行命令,并用文件系统 API 独立验证结果;验证不过自动带指数退避重试(自愈雏形)。 不轻信命令自身的返回值:例如 mkdir 之后,真的去确认目录存在。 expect 支持:pathExists / pathNotExists / isDir / isFile / fileContains:[路径,内容] / cwd

Inputs: expect (required), command (required), retries, timeout.

shell_resetA

重置持久化会话(重新启动 PowerShell)。用于会话状态异常时恢复。

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 33 tools

    Disambiguation4/5

    The tool set is large but mostly split into clearly explained channels: persistent shell, window/UIA perception, CDP browser control, and memory. There is still meaningful overlap between shell_exec/shell_exec_verified/shell_cd, desktop_elements/desktop_cdp_elements, and desktop_click/desktop_click_element/desktop_cdp_click, though descriptions give guidance on when to use each.

    Naming Consistency4/5

    Almost all tools use snake_case with subsystem prefixes (shell_, desktop_, memory_), which makes grouping predictable. Minor deviations exist: some names are verb_noun (desktop_list_windows, shell_env_get) while others are noun-only or verb-only (shell_cwd, shell_reset, memory_timeline).

    Tool Count3/5

    33 tools is heavy for one server and exceeds the comfortable range, but it is spread across several genuinely distinct subsystems (shell, UIA desktop, CDP browser, memory, diagnostics). It is borderline: more than ideal, but not arbitrary bloat.

    Completeness4/5

    Coverage is strong for a desktop automation agent: persistent shell with env/CD, verified execution, window enumeration/perception, mouse/keyboard, UIA element interaction, full CDP lifecycle, memory recall, and diagnostics. Gaps remain for window manipulation (move/resize/close), richer mouse actions (right-click/double-click/drag), and file-level operations, but core workflows are covered.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to interact with Windows operating systems through native UI automation, file navigation, application control, and system commands. Provides seamless integration between LLMs and Windows environments for tasks like clicking, typing, launching apps, and capturing desktop state.
      MIT