DesktopOS
This server gives an AI agent persistent control over a Windows desktop: a durable PowerShell session, screen perception, real mouse/keyboard input, UI Automation, browser (CDP) automation, error diagnosis, and a memory layer.
Persistent shell: run commands in a long-lived PowerShell session where
cd, environment variables, and venv state survive across calls; also change directory, get/set env vars, and reset when wedged.Verified execution:
shell_exec_verifiedre-checks results through the filesystem API (pathExists/isDir/isFile/fileContains/cwd) and retries with backoff instead of trusting exit codes.Desktop perception: enumerate windows (handle/title/process/rect/focus/minimized), take PNG/JPEG screenshots, and run dual-channel cross-validation to flag minimized/offscreen/blank windows.
Input injection: move the cursor, click/double/right-click, type Chinese-safe text via clipboard, send key combos, scroll, and focus windows — optionally verifying with before/after screenshot diffs, scoped to a region.
UI Automation: enumerate a window's controls and click an element by its visible text (InvokePattern first, center-click fallback).
Browser automation over CDP: launch a debuggable Edge/Chrome with an isolated profile, discover endpoints, attach to pages, list accessibility-tree elements, click by name, type text losslessly, run JavaScript, and screenshot the page.
Error diagnosis: translate any error into category/reason/hint/suggestion/retryable/auto-fix via rule matching (no LLM), also auto-attached to tool failures.
Memory layer: recall references like "that window from before" or "WeChat" into clickable coordinates, view an operation timeline, inspect stats, and clear the index.
Enables automation of Electron applications through the Chrome DevTools Protocol (CDP), allowing AI agents to enumerate and interact with page elements, click controls, type text, execute JavaScript, capture screenshots, and manage CDP sessions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@DesktopOS cd to my project folder and run git status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.jsonClaude Desktop:
%APPDATA%\Claude\claude_desktop_config.jsonCursor:
%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 |
| Run a command in the persistent session |
| Change working directory (Chinese paths supported) |
| Get current directory |
| Environment variables that persist across calls |
| Execute + independently verify the result + retry with backoff (self-healing) |
| Restart the PowerShell session when it goes sideways |
| Structure channel: enumerate windows (title/process/rect/focus/minimized) |
| Vision channel: screen capture, PNG/JPEG ( |
| Dual-channel + cross-validation (the core capability) |
| Read mouse position (read-only) |
| Move the mouse (no click) |
| Click / double-click / right-click (optional |
| Type text, Chinese-safe (clipboard + Ctrl+V) |
| Key combos like |
| Mouse wheel |
| Bring a window to the foreground (restores if minimized) |
| Launch (or reuse) a Playwright-driven Chromium instance |
| Navigate the current page |
| Aria snapshot (YAML) of the page — every interactable node carries a |
| Click by |
| Type text — native Unicode, Chinese/emoji lossless, no clipboard involved |
| Key combos to the page |
| Run JavaScript in the page, return JSON |
| Page-level screenshot (optional full-page) |
| Wait for text / selector / fixed ms |
| List or switch browser tabs |
| Close the browser, clean up the throwaway profile |
| Resolve a reference ("that window from before" / "WeChat") into coordinates |
| Recent operation timeline |
| Index stats / wipe |
| 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 directorySelf-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: 2expect 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 {} → doneTool-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,diagnoseGroups:
Group | Tools | When to trim |
| shell_exec / _verified / _cd / _cwd / _env_get / _env_set / _reset | Almost never — the most irreplaceable part |
| list_windows / perceive / screenshot / cursor / move / click / type / key / scroll / focus_window | When you already run another desktop automation |
| pw_launch / navigate / snapshot / click / type / press / evaluate / screenshot / wait / tabs / close | When you already run the official Playwright MCP |
| memory_* | When you don't need desktop state memory |
| desktop_diagnose | Pure knowledge; keep it |
Three behavioral guarantees (covered by test/toolfilter.test.js):
No filter set = everything exposed — the default OSS experience stays intact;
After trimming,
tools/listonly contains the selected tools;Call-time enforcement too — trimming only
tools/listis 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:overlapIt 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/Clickclicks OS windows;playwright/browser_clickclicks 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 existsretryable 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:
The parent must actually not exist — otherwise the target itself is missing and creating the parent is pointless;
The command must be a creating verb — building a directory for a
Get-ChildItemread 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 existsRules 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 locatorsWhy even a loopback port must authenticate
"Bound to 127.0.0.1" does not mean private. The attack path is concrete:
A malicious page calls
fetch('http://127.0.0.1:<port>/exec', { method: 'POST', body: '<json>' });The default
Content-Type: text/plainis a CORS-safelisted value — this is a "simple request", no preflight, the browser sends it directly;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
Originheader → 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):
Encoding:
powershell.exedecodes 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).Stream interleaving: stdout and stderr interleave; markers drown in command output or get falsely matched by residual buffers.
Process exit: terminating errors make PowerShell
exit(1)— the marker never arrives.Error loss:
Invoke-Expressiondoesn'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
.ps1files. Adding JPEG quality parameters toperception.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 plainImageFormat::Jpegoverload 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 |
|
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 ( |
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: | handle, title, process, PID, rect, focus, minimized |
Vision |
| 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.jsmanually 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.
pw_snapshotcaptures an aria snapshot inmode: "ai"— a YAML outline of the page where every interactable node carries a[ref=eN];Pass that
reftopw_click/pw_type— the internalaria-refselector engine resolves it to the exact element;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. PassuserDataDirexplicitly to keep logins.Browser resolution order: local
ms-playwrightcache → system Edge → system Chrome → Playwright's own lookup.npx playwright-core install chromiumpre-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_launchreuses 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;
findByHashexists 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_setvariables replayed;stop()returns in bounded time even when wedgedConcurrent cold start: 5 concurrent
start()spawns exactly one processRequest 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:
cdinto a Chinese-character path (...\代码\desktopos) — the old design always broke hereChinese 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
isErrorand mis-clicks nothingDiagnoser's
retryable: falseverdicts actually stop retries (not just in the hint text)C:\Users\Administrator\...paths don't get misdiagnosed as access-deniedEvery 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 onetest/_dbg-perception.js— print dual-channel details and timingstest/_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 toolsdesktop_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
Scored across 33 tools
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.
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).
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.
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
Related MCP Connectors
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Connect AI assistants to your approved computer for files, commands, browser and desktop tasks.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables 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
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with the Windows operating system, performing tasks such as file navigation, application control, UI interaction, and QA testing.MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to see and operate a Windows PC through mouse, keyboard, screenshots, OCR, window control, and shell commands.-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to control and interact with the Windows operating system, including file navigation, application control, UI automation, and QA testing.MIT