kde-desktop-mcp
Provides screenshot-free control of a Hyprland session: reads application UI elements through AT-SPI (apps, tree, find, get_text), performs element actions (act, set_text, focus, click), sends keyboard input via /dev/uinput, moves the cursor with hyprctl dispatch movecursor, types text with wtype (or wl-copy), and focuses/activates windows through hyprctl clients and focuswindow, restricted by a per-app allowlist.
Provides screenshot-free control of a KDE Plasma (Wayland) desktop: reads running applications' UI elements from the AT-SPI accessibility tree (apps, tree, find, get_text), acts on individual elements (act, set_text, focus, click), sends keyboard input through /dev/uinput, writes text via wl-copy/Ctrl+V, and manages windows with KWin scripts, all restricted by a per-app allowlist.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
kde-desktop-mcp
A screenshot-free desktop control MCP server for KDE Plasma (Wayland), Hyprland and Windows. It lets MCP clients such as Claude Code read the inside of applications through the accessibility tree and act on elements directly. Written in Rust; a single executable.
Verified on a real KDE Plasma desktop. Hyprland was verified in a nested session inside KDE. On Windows, keyboard, mouse and screenshots were tried under Wine; tree reading (
tree,find,get_text,focus,click) has not yet been tried on real Windows. Please share results fromtools/mcp_smoke_test.py.
How it works
Instead of looking at the screen, Claude reads the elements of a window as a
list like [55] button "Save" and acts on an element by its number.
Layer | KDE Plasma (Wayland) | Hyprland | Windows |
Reading | AT-SPI (D-Bus) | AT-SPI (D-Bus) | UI Automation cache requests |
Element actions | AT-SPI actions, EditableText | AT-SPI actions, EditableText | Invoke, Toggle, ExpandCollapse, SelectionItem, Value patterns |
Keyboard |
|
| Win32 |
Mouse | Absolute uinput pointer | Hyprland |
|
Typing text | Direct insertion via AT-SPI into Qt multi-line fields (clipboard untouched); elsewhere in-process clipboard + Ctrl+V, after which the previous clipboard text is put back |
| Clipboard + Ctrl+V, after which the previous clipboard contents (all formats) are put back; a single character as a |
Windows | KWin scripting (D-Bus) | Hyprland socket: |
|
Screenshot (fallback) | KWin |
| GDI |
The code lives in rust/src/: main.rs holds the MCP protocol, the
allowlist, element ids and the tools; render.rs the tree and search output;
backend.rs defines the platform interface. Platform code is in linux/
(KDE and Hyprland share an AT-SPI layer) and windows/. Claude sees the same
tools on every platform.
The desktop is chosen automatically: Windows on Windows; on Linux, Hyprland if
HYPRLAND_INSTANCE_SIGNATURE is set, otherwise KDE. To choose by hand on
Linux, set DESKTOP_MCP_BACKEND to kde or hyprland.
On Hyprland the active window is matched to its AT-SPI application by process id (pid), so the toolkit's focus flag does not have to be trusted.
focus first asks the accessibility layer for focus. If the app refuses (common
with Qt), it clicks the centre of the element for real.
Why it is fast:
It talks to AT-SPI over D-Bus directly, without libatspi, and pipelines requests: all attributes of an element, and every level of the tree, are requested at once, so the time is bound by the app's response speed rather than by round-trip latency.
On Windows a window's whole subtree, with the properties needed, arrives in a single UI Automation cache request (
BuildUpdatedCache).KWin scripts go over D-Bus instead of
qdbus6processes, Hyprland commands over Hyprland's socket instead ofhyprctlprocesses.Start-up takes 2 ms; the virtual keyboard and mouse are prepared in parallel at start-up.
On KDE the waits were measured and shortened (uinput events are processed in order);
focusremembers focus methods that do not work in an app and skips them;type_textstarts no process; screenshots come straight from KWin instead ofspectacle.Output is short, so Claude reads less: one space of indent per level, sibling leaves with the same role and actions share one line (
list item ×3: [8] "a" [9] "b" [10] "c"), and the "Set Focus" action Qt gives almost every element is not listed. A Dolphin + Katetreewent from 15,182 to 7,092 characters.In browsers too: Firefox's "clickAncestor" action on every element and the embedded-object placeholder (U+FFFC) of web pages are not listed; real action names are read instead of Firefox's broken batched names (
;;).tree(document=true)shows only the active tab's page (found in one call through the window's EMBEDS relation). The same Firefox page went from 5,943 to 1,421 characters.In Chromium and Electron apps, the
showContextMenuaction every element carries is not listed either, and the genericdoDefaultof their frame, panels and pages counts as implied: it no longer keeps nameless panels as lines. A Ferdium (WhatsApp) tree went from 19,906 characters, cut at 300 nodes behind six nested panels, to 7,759 for the whole window; withinteractive: truefrom 19,924 to 2,586, the chat list's rows included (see below).actwithoutactionnever picksshowContextMenu: an element with no other action is an error that says to useclick, oraction: "showContextMenu"when the menu is what is wanted.Actions a role implies are left out (a link's jump, a button's press, a tab's switch, a web section's click); a button or link without any says
actions=none. Nameless, text-free wrappers (landmarks, forms, scroll panes) are left out with their children lifted, as are empty nameless leaves (separators, images inside buttons) and labels around a same-named button. A Google results page in Firefox went from 6,976 to 5,702 characters. A static text or label leaf that only repeats what its parent's line shows (a heading's or link's own text node, a status bar's count) is left out oftree, and offindwhen the parent is listed as high; asked for withrole, it is listed. A YouTube page'stree(document=true)went from 3,792 to 3,327 characters.get_textin Chromium no longer reads such leaves a second time after the text of the element that holds them (a WhatsApp page: 3,035 instead of 5,010 characters, the same text), and the U+FFFC in a container's text goes to the child object it stands for (an avatar, an emoji image) rather than to a text leaf whose words the text already holds.On Linux, a
find,treeof an app, or element picked byapp+queryreuses the app's tree read by an earlier call while the app provably did not change: it sent no AT-SPI change event since (children, name, text, any state, visible data, windows), no app or window came or went, no tool sent input or activated a window, the user did not touch the keyboard or mouse, and the read is under 2 s old. Only apps known to send these events (Qt, Firefox, Chromium, or any app once it sent one) and no page still loading. An element taken from such a read is checked to still be there (one call) before it is used. Aget_textby query in Firefox went from 8.7 ms to 1.1 ms. Clicking by query also measures the element in the same round trip as the lookup, from the window found in the read.appslists blocked apps by name on one line and skips untitled windows.An AT-SPI call waits at most 2 s; an app that does not answer cannot lock the server. Actions that open a menu (Qt does not reply until the menu closes) count as sent after 400 ms.
Tool calls are handled concurrently: a pending
wait_foror a slow app does not hold uppingand other calls. If Claude cancels a call (notifications/cancelled), it is stopped. Tools that send keyboard or pointer input still run one at a time, so keystrokes never interleave.Popup menus and overlays of web pages are part of
tree/findoutput. Firefox does not mark these layers as SHOWING; containers that are visible and lie inside the window are entered as well, and so are elements without a layout box (display: contents, -1 extents): YouTube wraps its whole page in one, which hid every element of the page fromfindandquery. Content scrolled out of view is skipped. Example: Gemini's upload menu ("Dosya yükleyin") is now found without a screenshot.Matching (
find,query,wait_for) compares names and text case-folded (Turkish İ/ı as i), with whitespace runs, no-break spaces and the placeholders of web containers as one space and soft hyphens and zero-width characters left out; up to 1000 characters of an element's text are searched. When nothing matches that way, an element whose name or text holds every word of the query, in any order and accents aside, does ("cozum yontemleri" for "Çözüm Yöntemleri"). When still nothing visible matches,find(and the error of a tool givenquery) lists up to five matches scrolled out of view in the web page, with ids (actandget_textwork on them as they are;actwithaction: "scroll_to"brings one into view forclick), else up to five visible elements with the closest names (no matches; closest: …), so the next call can use an id instead of a screenshot.Read tools (
apps,tree,find,get_text,wait_for,wait_idle,screenshot,pause,clipboard_get,windows,doctor) carry MCP'sreadOnlyHint; Claude Code runs several of them in parallel when asked for in one message. The others carrydestructiveHint: true forclose_windowand the input tools (which can do whatever the user could), false foractivate_window,move_windowandlaunch.
Related MCP server: AgentDeskLink
On-screen indicator
While the agent uses the keyboard or mouse, the screen edges glow orange, a
label at the top says what it is doing (e.g. "Claude · typing") and a ring
marks each pointer target. All of them are layers that pass clicks through to
the window below (wlr-layer-shell; KDE Plasma and Hyprland). They disappear
2.5 s after the last action and are hidden before a screenshot is taken. The
server starts the indicator on the first action as desktop-mcp --indicator;
it exits with the server. To turn it off, set the environment variable
DESKTOP_MCP_INDICATOR=0 in the MCP configuration.
Was the input sent?
Every reply and error of an input tool (act, click, focus, key,
type_text, set_text, mouse, drag, scroll, hold, menu,
close_window, file_dialog, activate_window, move_window, launch,
clipboard_set) says whether its input reached the desktop, so the agent
knows whether repeating the call can click, type or toggle twice:
nothing sent: refused or failed before anything was written: the allowlist, a tier, a declined confirmation, the user taking over before it (paused,stopped by the user,interruptedbefore a batch step), a stale id, no element or window matching, an ambiguous target, a bad argument, or a verified action already in the asked state. Safe to retry.maybe sent: look before retrying: an error after input was written: an action whose reply did not come (AT-SPI DoAction timeout), text partly typed, a pointer or key event failing, a drag or repeated key the user interrupted part way (... after 2 of 5 presses of down), aset_textthat retyped and did not take, a verified action that reads otherwise afterwards, aselectthat opened a menu and then found its entry disabled.No marker: it succeeded and sent its input;
verifiedwhere the result was read back (set_text,act's check, expand and select).
A reply carries one marker, decided by the whole call: once anything was
written, a part that sent nothing (a key fallback refused after a Selection
was tried) says nothing more sent, never nothing sent.
This is decided where the input is written, not from the message: the server
reaches the desktop only through a wrapper of the backend that notes every
write of the running call (an action, a text write, a key, a pointer event, a
window change). A backend that rejects a write before sending (an unknown key
name, no window matching) says so. Bringing a tool's window to the front
does not count: repeating it is harmless.
A stopped batch says which steps sent input and which a retry still has to
run: stopped; sent: [1..2]; maybe sent: [3]; not sent: [4..5]. The step
that stopped it is under maybe sent when it wrote anything (it failed), else
under not sent, with the steps after it: stopped; sent: [1]; not sent: [3..4]. When no step sent anything, it says stopped; nothing sent: the
whole batch can run again. The server instructions carry one rule: retry an
input only when its reply says nothing sent (a stopped batch: only its not sent steps); otherwise look first.
When the user takes over
The agent and the user share one keyboard and mouse. Input tools (act,
set_text, focus, click, drag, scroll, key, type_text, mouse,
activate_window, file_dialog, move_window, launch, and any tool given
window) wait for the user:
Pause. While the user typed or moved the pointer in the last 1.5 s, an input tool waits, sending nothing, for the user to stop: when the pause ends within 2.5 s all told (say, the call came right after the user pressed Enter in their terminal) it then goes ahead and its reply starts with
waited N ms for the user's input to stop;. While the user keeps going, it fails withpaused: the user is using the keyboard ... (last input N ms ago; waited M ms for them to stop); nothing sent; the agent retries once the user stops (a retry is safe only afternothing sent). Cancelling the call ends the wait. User input during a batch (once it sent input), a drag or a repeatedkeystops the remaining input at once (interrupted: ..., thennothing sentormaybe sentwhen part of it went out): those steps were planned for the screen as it was. User input while a batch only read so far pauses its first input like a call of its own. Read tools and the clipboard tools keep working.Stop shortcut: Meta+Alt+Esc. It ends a running drag or batch and refuses every input tool with
stopped by the useruntil the agent callsactivate_windowon its own (not as a batch step and not throughwindow); the agent is told to ask you first. The indicator shows "paused" or "stopped" when it refuses. (Plasma 6 already uses Meta+Esc for System Monitor.)
How it is seen (doctor shows it under "takeover detection"):
With read access to
/dev/input(the user is in theinputgroup), the server reads the real keyboards and pointers there: read-only, never grabbed, its owndesktop-mcp-*devices left out. This is exact, and the stop chord is seen on every compositor. Note that theinputgroup lets every program of the user read all keystrokes.Otherwise it follows the compositor's idle notifications (
ext-idle-notify-v1, KDE and Hyprland). They count the agent's own input too, so user input is only noticed outside of it (between steps, or when it lasts longer than the agent's).KDE registers the stop shortcut with KGlobalAccel: it appears under System Settings > Shortcuts > Desktop MCP, where it can be changed. On Hyprland the stop shortcut needs
/dev/input.
Settings (environment variables in the MCP configuration):
DESKTOP_MCP_TAKEOVER_MS (default 1500; 0 turns the pause off) and
DESKTOP_MCP_STOP_KEY (default meta+alt+esc, key names as for the key
tool; off turns it off). Not available on Windows yet.
Tools
apps,tree,find,get_text: reading and searching. Withdocument: true,treelists only the document of the active window (in a browser, that tab's page without tabs and toolbars).get_texton a web page or another container returns the text of everything in it in reading order (web containers' own text is only a placeholder per child element). It returns at mostlimitcharacters (default 10,000, about 2,500 tokens) fromoffset(default 0); a cut reply ends with… cut at character N; get_text with offset=N reads on. Whole web pages used to come back as 20,000 characters while the part wanted was near the top. Atree/findline shows up to 80 characters of an element's text with its line breaks (text="Shopping list\nmilk\nbread\n"), so a short document's lines and final newline are visible withoutget_text;…after the closing quote marks a text that goes on.Large trees:
tree(interactive: true)lists only elements one can operate (actions, editable/checkable/selectable/expandable, and on Linux focusable named table rows, cells, list and tree items: a web app's chat list whose rows say onlyclickAncestor/showContextMenu) under their nearest named ancestor; on a GitHub issues page in Firefox it was 15,339 instead of 24,687 characters and still listed all 259 links, buttons and fields. A reply is capped atmax_chars(default 20,000) andmax_nodes; a cut one ends with… N more nodes; continue with tree(…, after=ID), which lists the rest after that element (ids are stable, so pages join up exactly).to_file: truewrites the whole tree (max_nodesdefault 3,000) to a new file only the user can read and replies with its path, size and first lines; the ids in it work like any other. Linux:$XDG_RUNTIME_DIR/desktop-mcp/trees(else~/.cache/desktop-mcp/trees), directories 0700, files 0600, never written through an existing file or symlink. Windows:%LOCALAPPDATA%\desktop-mcp\trees, which keeps the profile's ACL (the user, SYSTEM, Administrators). The newest 10 are kept.screenshot: trueadds the image of the app's window when it is in front.set_textreads back what it wrote: the reply says "verified", or it fails saying what the field holds (a length limit, other text). A field that only formatted the text (the same letters and digits, spaced, punctuated or cased:0555 123 45 67) or dropped characters of a kind it takes none of (the letters in a phone number) is no error: the reply gives the value it holds. Firefox's input fields report accessibility writes as successful and do nothing, so when single-line text does not take, it focuses the element, selects all with Ctrl+A and types it (empty text: Ctrl+A, BackSpace). On Linux, Firefox's fields are typed into right away: their write never took. An editable element without a text interface (Qt 6's editable combo boxes, such as a KDE file dialog's name field) is typed into the same way and read back from its name. When it could not type (another window in front, no focus) and the field holds what it held before, the reply says why and "nothing changed"; a write the field ignored then counts as nothing sent. Password fields cannot be read back.scroll: turns the wheel over an element (a list, a page, a panel).Verified actions of
act(one tool rather than new ones:actis loaded up front, so they cost no tool-search turn, and the schema grew by about 570 characters instead of three new tools of 1,700 each). Each reads the state back and replies with it (Toggle -> checked (verified)), or fails saying what it sent and what it reads instead (sent Toggle, but it reads unchecked afterwards); one already in the asked state sends nothing and says so (already checked; nothing sent), so it is safe to repeat:action: "check"/"uncheck": a check box, check menu item, radio button (only checked: another one of its group unchecks it), toggle button or switch, or anything the platform marks checkable. Runs its check, uncheck, toggle, press or click action. A checkable list or tree row (Qt's item views, GTK's toggle cells) only through an action named check/uncheck, or toggle outside Qt (Qt's Toggle selects the row); otherwise focus through accessibility and Space (fulltier)."toggle"flips it, or the expansion of an element that is expandable, not checkable, and has no action named Toggle (one that has it, a Qt row, runs that action as before).action: "expand"/"collapse": a tree item, disclosure button, accordion or combo box through an action named for it (expand,collapse, GTK'sexpand or contract); buttons and combo boxes may use their press. A list or tree row is never pressed for it (that opens a file in Dolphin): an element with no such action (Qt's tree items) gets focused through accessibility and sent Right or Left, which needs thefulltier; when it cannot be focused that way the reply says to click it and press the key.option: "UTF-8"(withaction: "select", or alone): picks the entry with that label (matched likemenulabels: case,&markers, ellipses aside; a unique part is enough) in a combo box, list, tab list or menu button, from its entries in the tree even while it is closed. In order, each only while the one before is not verified: the list's AT-SPI Selection (SelectChild, afterClearSelectionin a multi-selection list; skipped in Firefox and Chromium pages, whose scripts would not see it), the entry's own select/click/press action (not Qt's Toggle, which only marks a row), then for a closed combo box (with thefulltier) focus through accessibility and as many Down/Up presses as entries lie between the shown one and the wanted one. Verified by the value a combo box is named after (Qt, GTK), else the entry'sselectedstate (Firefox); a list where other entries stay selected too says how many. A control that lists no entries is opened through its action only when it opens a popup (a combo box, a menu, a button marked as having a popup or with a Show Menu/open/expand action) and the entry is taken from the popup menu; anything else (a plain button, a row) fails with nothing sent.action: "scroll_to": brings an element scrolled out of view (an id from the off-screen list of a miss) into view through AT-SPIComponent.ScrollTo(on the element, else its nearest ancestors); when that is missing or does not show it, turns the wheel over its scrollable container (5 notches a turn, at most 10, toward the element) until it is showing, and says that the pointer moved. The wheel turns over the part of the container inside its window (in a web page over the page, not a<ul>or<table>in it), and stops when the user takes over. An element that is hidden (not visible: in a closed popup or a collapsed branch; a Qt row scrolled out of a showing list counts as scrolled away) gets no wheel.
None of them opens a Firefox menu or
<select>popup through accessibility (seemenu): such a call fails with nothing sent and says to click the control. Their key fallbacks stop when the user takes over, and the act call's confirmation covers them. On Windows (roles compared without spaces:checkbox,listitem), check/uncheck/expand/collapse use the UI Automation Toggle and ExpandCollapse actions andselectthe entry's SelectionItem;scroll_touses ScrollItemPattern.ScrollIntoView, else the wheel over the nearest scrolling ancestor (verified in Edge); Selection is not supported there. Verified so far with unit tests only; not yet tried against Kate, Dolphin or Firefox.Modifier clicks:
click,mouseandscrolltakemodifiers(ctrl,shift,alt,meta), pressed before the pointer action and released in reverse order afterwards, also when it fails (ctrl+click adds to a selection, shift+click selects a range, ctrl+scroll zooms).clicks: 2is a double andclicks: 3a triple click (select a line);buttonisleft,rightormiddle.hold: presses a key, chord or mouse button and leaves it down across calls (down: falsereleases it; withoutkey/buttonit releases everything). Every input reply ends with what is still held (; held: shift, left). Everything held is released when a call fails, when a call is cancelled (notifications/cancelled) and when the server exits (end of input, SIGTERM/SIGINT/SIGHUP); on Linux the kernel also releases the keys of the virtual devices when the process dies. Meant for modifiers and buttons: a held letter auto-repeats like a real key.cursor_position: where the cursor is, in the coordinatesmousetakes (KDE:workspace.cursorPosthrough a KWin script; Hyprland:cursorpos; Windows:GetCursorPos). Read-only.drag: presses, moves in steps and releases (drag and drop, sliders, selections). Each end is an element id (from_id/to_id), a screen coordinate, or withimage: truea pixel of the last screenshot.act,set_text,focus,click: act on an element. The element is picked by itstree/findnumber (id) or in one call byapp+query(+role): a visible element whose name or text equalsquery(a button named "Artır" showing "+"), else one whose name or text contains it. Window, tab and page titles (frame, window, page tab, and a web page's document) count only when nothing else matches orrolenames that role;wait_forskips them unlessrolenames them. Last come elements holding every word of the query, accents aside. When nothing matches, a visible field (an editable element) whose label (the AT-SPI labelled-by relation, UIA LabeledBy), placeholder text or description the query names is taken, if exactly one fits best; the reply says so ((labelled 'Red gerekçesi')). A web form's entry is often named after something other than the label beside it. The other way round, a query that names a label (an HTML<label for>) stands for the field it labels inset_text,focusandact(unlessrolenames the label).role(infind,wait_forand theapp+querytargets) compares without case, spaces,_or-(Push_Button,pushbuttonand UIA'scheckboxforcheck box). A role that matches nothing is tried again as the platform roles it stands for, and the reply says so (role 'row' matched as 'table row'):row(table row, list item, tree item),cell/gridcell(table cell),button(push button, toggle button),textbox/input/entry/field(entry, text, password text),checkbox(check box, check menu item, switch),dropdown/select(combo box),tab(page tab),menuitem/option/listitem(menu item, list item),h1…h6(heading),link(UIA hyperlink) and more (ROLE_SYNONYMSinrender.rs). An input tool never takes a synonym's element while one of the role itself is only scrolled out of view in the web page: that is a miss offering it. A miss with a role lists, first found first: matches of the role (else its synonyms) scrolled out of view in the page; visible elements of other roles the query names, with their roles (it matches elements of role 'link' (pass that role, or none)); then off-screen ones of other roles (off-screen, scrolled out of view, of role 'link' …).Ties: when several elements match equally well (the best of those tiers), these tie-breaks apply in turn, while the matches are in several windows of the app: (1) a window whose title contains the call's
windowargument beats the others (before the active window, whose ACTIVE state can lag just afterwindowraised another); (2) the app's active window beats its background windows; (3) a dialog (dialog, alert, file chooser) beats the app's other windows, and of stacked dialogs the one opened last (listed last) wins. Then, wherever they are: (4) an element one operates (a button, entry, list item: an interactive role or state) beats one that only shows the name (a label, a heading, a list named the same); (5) an enabled element beats a disabled one; (6) in a browser window (one with a tab strip), an element of the web page beats the browser's own tool bars and tabs, and the reply says(picked over N browser-chrome matches); (7) the focused element beats the others; (8) one in a dialog inside the window (a web page's modal) beats the others; (9) for input tools, an element with an on-screen area beats one without (zero size), whether its window is in front or not (checked for up to 12 candidates). A tie left after that is refused by the input tools (act,click,focus,set_text,scroll), which send nothing and list at most 6 candidates with ids, so the next call passes oneid(orrole, orwindow):ambiguous: 2 elements in 'firefox' match 'Kapat'; nothing sent. pass one id: [3] push button "Kapat" at 3440,0 [4] push button "Kapat" at 3440,22The position is shown when the window is in front; the window title is added when the candidates are in several windows. Read tools take the first:
get_textnotes it ([5] … (first of 2 matches):),wait_formatches on it,findlists them all. Matches are counted over one read of the app, made afresh for a refusal.Effect and
observeon input tools (act,menu,close_window,click,key,type_text,mouse,drag,scroll,set_text): withobserve(and by default foract,menuandclose_window) the reply ends with aneffect:line comparing the active window before and after the input (its title, the focused element, and on Linux the accessibility change events of the app the input went to: the oneapp/idnames, else the active window's, besides the focused element's):changed,no visible change, orwindow changed to '<title>'(a dialog opened, a window closed). When that app is a browser (Linux: Firefox, Chromium and Electron apps), the web page of its active window (else of its only showing window; none is compared when several show and none is active) is compared too: the showing document there, astree(document=true)finds it, remembered while that window is the one and it shows, by title and address (DocURL):page changed to '<title>'(the address added when the title stayed the same). A page loading (BUSY) after the input adds(still loading: wait_idle before reading it); one that started loading ischanged: the page started loading (wait_idle before reading it); one that was loading before the input already isno visible change (the page was already loading: …), ornot known: …when the app sent events, since they may be the load's. It waits for the app to react up tosettle_ms(default 150), returning as soon as it reported a change, and for a web page up to 400 ms more when nothing came yet and input was sent (a link or a web app's row starts loading after a round trip of its own). The fingerprint costs about 1 ms, plus for the app the input goes to a walk of the apps (alongside, whenapp/idnames it) and, for a browser, a read of its windows' states and the remembered page (one round trip each); a search of the window (up to 20000 nodes) when that window changed, at most every 5 s for a window found without a page. Where the backend hears no change events (Windows), the visible part of the app's windows is also hashed before the input and read again about every 50 ms until it differs or the wait is over, so a display that changed while focus and title stayed (Calculator) readschanged; this costs one subtree read before the input and one or more after. A canvas that draws without accessibility events may reportno visible change.observeadds a view in the same reply:focus(the focused element),tree(compact tree of the active window, or ofapp's, at most 6000 characters) orscreenshot(inline image). Withoutobserve, the other input tools still note, without waiting, when another window is in front after the input (; active window now '<title>') or came to the front since the previous input (; before it, '<title>' had come to the front: a dialog that opened after that reply); about 3 ms per input.Waiting for a web page (Linux, apps that send accessibility change events): after a press (
actwith the element's own action), a plain leftclickon an element, orkeyEnter, alt+left, alt+right or F5, in an app that shows web pages (Firefox, Thunderbird, Chromium, Electron apps), the reply waits for the page to change in place (a next page, a tab, search results, a mail opened): up tosettle_ms(default 1500 here; 0 turns it off) for the first change, then until its events are quiet for 150 ms (350 ms when the first change came within 100 ms, as a placeholder or spinner before a network round trip does) and no page of the app is loading, within the same limit. While no page loads, the wait ends at most 500 ms after the first change: change events are per app, so other tabs and live pages (a clock, a video) count and may never go quiet. The reply says; page changed (settled after N ms),; page changed, still loading after N ms(orstill changing) or; no page change seen in N ms. When the app already sent change events between the call's start and the input, the first change says nothing: the wait goes straight to the quiet and says; app was already changing; quiet after N ms(orstill changing/still loading), so check the new content before relying on it. The nextget_textorfindreads the new content (reads kept from before the input are dropped when it starts and ends, and a read kept afterwards is dropped by the app's next change event). Not for clicks into text fields or other editable elements, check boxes, radio and toggle buttons, switches, check and radio menu items (their state change is no change event), combo boxes, menus, sliders or a whole document, nor for Enter in a terminal or a multi-line field, nor for other keys or apps: there it costs nothing beyond one cached toolkit lookup (and on a web page one state read). When the page does not change, the call takes the wholesettle_ms.mouseclicks at coordinates do not wait.What an input opened (Linux; Windows: menus): after
act,menu,close_windowand the input tools givenobserve, and afterclick,key,mouseandtype_textwithout it, the reply lists the menus, popup menus, combo box lists, dialogs and alerts of allowed apps that opened, one line each, with their entries' ids, so the next call acts on them directly:opened: popup menu (8 entries): [51] "Kopyala" [52] "Yapıştır" [53] check menu item "Satır Sarma" {checked} … opened: dialog 'Değişiklikleri kaydet?': "Belge değiştirildi." [60] push button "Kaydet" [61] "Kaydetme" [62] "İptal"A role is named where it changes (a menu's
menu items and a list'slist items go without); a dialog's buttons come first, after its first label (the question it asks), those of its last button group (OK, Save, Cancel) before the others, then its other controls; its lists, tables, trees, documents and tool bars are not read. A KDE file dialog thatfile_dialogfills is named asopened: file dialog 'Open File' (use file_dialog), without entries. At most 12 entries and about 600 characters a line (the rest is counted:… +5 more), 3 surfaces a reply; a surface listed once in a call (byclose_window) is not read or listed again in its effect line. What showed after a reply (a dialog a button opened a few ms after the click) is listed by the next input's reply asbefore it, opened: …; what one reply listed is not again. A surface is listed only when its app's name reads as an allowed app's. The AT-SPI eventsobject:state-changed:showingandwindow:createsay what showed since the input: when none came, this costs nothing (no round trip); otherwise the role of each shown element is read (one round trip for all of them), and only menus, dialogs and lists under a combo box are read further. A right click (click,mouse), a click on a combo box or menu entry, and keys that usually open a menu or dialog (menu,shift+f10,f10,alt+a letter,alt+down,alt+f4,ctrl+o/s/p/w/q,ctrl+shift+s) wait up to 150 ms for something to show, ending as soon as it did; other inputs only list what showed already. When registering those events failed, those likely openers andact,menuandclose_windowlook at the active app's top-level windows instead, and a surface one such look listed is not read or listed again while it stays open. On Windows only menus are listed: UI Automation's roles do not name dialogs this way (a dialog is awindow;close_windowstill lists the one it opened). With no show events there, after those likely openers, and afteractorclickon a menu entry or a drop-down button (one that expands), the app's windows are searched for a menu showing in them (a XAML flyout sits in a popup inside the window), up to 150 ms; other inputs do not look. Only menus already open are read: nothing here opens a menu through accessibility (Firefox can crash when one does).Failures say what is on screen: when
findfinds nothing, oract,click,focus,get_text,set_text,scroll,drag,wait_for,wait_idle,menu,key,type_textormousefails (or abatchstep fails and the batch does not end withscreenshotortree), the reply ends withnow: active window '<title>' [app]; focus: <element>, so the next call needs no screenshot to see why. Titles in such notes (now:,activated '…',active window now '…') are cut at 80 characters like element names, with the…after the closing quote so the quoted part still works aswindow, and a focus line leaves out thefocusedstate. Not for refusals by the allowlist, confirmations, an ambiguous target or the user taking over. A miss byqueryalso lists off-screen matches or the closest names with ids (seefind).Stale ids: every use of an
idreads the element's role and name again (one round trip). If the element is gone, or its role or name changed (the page was redrawn, the object path now belongs to another element), nothing is done and the reply isstale id N (was <role> "<name>", now ...); call tree/find again. When elements of the same role and name are visible in the app now (a page that re-rendered), the reply lists up to 3 of them with fresh ids instead; none is acted on. For elements whose name follows their content or title (windows, tabs, documents, labels, status bars, text fields, combo boxes, editable elements) and for unnamed elements, only the role is compared.wait_for: waits until an element appears or disappears (checks every 50 ms, at most 10 minutes); for dialogs opened by a key or click, a long load or a build. A longer timeout is cut to 10 minutes and the reply says so.state(enabled, focused, checked, selected) waits until the element has that state (withgone, until it no longer does).windowinstead ofquerywaits for a window of an allowed app whose title or app name contains it to open, or withgoneto close (KDE and Hyprland window lists, re-read when AT-SPI reports a window change). A timeout names the app's window title and, waiting for an element to appear, lists up to 3 visible elements with the closest names (with ids); when nothing comes close and the query reads as written to time out (zz-never,nonexistent), it says a fixed wait ispause.wait_idle: waits until an app's accessibility tree has not changed forquiet_ms(default 300) and no browser page is still marked busy (loading from the network): after opening a URL or a link, use it instead of a fixedpause. The reply names the app's window title (a browser's page title); a timeout says when a page was still loading.pause: waits a fixed time (ms, at most 10 minutes); for waiting on time only, not on a visible change.windows: lists windows of allowed apps with position, size, state (active, maximized, minimized), output and virtual desktop in screen coordinates, after the screen layout (name, area, scale) and the virtual desktops (KDE: number, name, the current one; Hyprland: the regular workspaces and the monitor each is on) (KDE, Hyprland and Windows, which has no virtual desktops to list).move_window: moves, resizes, maximizes, minimizes or restores a window, and withdesktop(a number or name aswindowslists them) moves it to that virtual desktop (KDE: the window is then on that one only) or workspace (Hyprland: silently, the view stays; a new number makes the workspace); waits (at most 1 s) until the window has its new geometry and reports the real result (KDE, Hyprland and Windows; see the Hyprland and Windows limitations).close_window: closes the one window whose title or app name containsquery(several matches: an error listing them) as its close button does (KWincloseWindow(), Hyprlandclosewindow, WindowsWM_CLOSE), so an app with unsaved changes still asks; the reply then says the window is still open and lists the app's dialog (the save prompt; Windows: a window it owns or a modal one inside it) with its buttons' ids (showing dialog '…': [60] push button "Save" [61] "Discard" …). Always needs the user's consent, as tools on theconfirm:list do (see Tiers, confirmation and password fields).menu: runs a menu bar entry by its labels in one call:pathis a list (["Dosya", "Farklı Kaydet…"]) or one string ("Dosya > Farklı Kaydet"). Labels are matched case-insensitively (Turkish dotted and dotless i alike), without&/_accelerator markers, a shortcut after a tab or a trailing ellipsis; an exact label wins, else a unique part of one. A label that is not there is also tried against KDE's English action names (file,file_save_as,edit_copy), so"File > Save As"works in a Turkish Kate (it saved two turns per task in the e2e benchmark). Withoutpathit lists the top level, and a path ending at a submenu lists that submenu's entries with ids (read-only where the app keeps closed submenus in the tree). Qt and GTK apps keep closed submenus' entries in the tree, so nothing is opened. KDE apps that replace the menu bar with a hamburger button ("Menüyü Aç", which has no accessibility action and no children) keep the hidden menu bar in the tree, and its entries work:menufinds it too (Kate, Dolphin). A submenu filled only when shown on screen (Dolphin's "Create New") is opened with its parent menus, after a shift press and release (Wayland shows a popup only after recent input; it types nothing) while the app's window is in front. Firefox fills a menu only while it is open;menudoes not open Firefox menus itself (doing so through accessibility hung or crashed a fresh Firefox in tests), so open the menu withkeyfirst. On Windows a menu bar entry and a submenu entry are expanded to read their entries (UI Automation's ExpandCollapse; Win11 Notepad and Paint), which open as a flyout elsewhere in the window:menutakes the menu that showed, not the one holding the entry.launch: starts an allowed app (app, e.g.kate) with an optionalargslist (no shell; its.desktopfile first, else the program onPATH) and waits until its window opens (wait_ms, default 15 s, at most 60 s; 0 does not wait). Prints the window aswindowsdoes; also finds launches handed to an already running instance (firefox, kate), also when it opened them as a tab in a window left behind others ("opened in the running instance's window"). Works on KDE, Hyprland and Windows (see the Windows limitations).Terminal windows:
windowsalso lists each terminal tab's pts device, foreground command and directory;activate_windowwithterminal: "pytest"brings forward the terminal running that command (or in that directory), and Konsole switches to that tab over D-Bus (other terminals come forward on whichever tab they show). Input tools take the same aswindow: "terminal:pytest"; they never pick the agent's own tab, and refuse a tab that cannot be brought forward in a window with others. The reply names the tab (pts, command, directory). The terminal must be in the allowlist (e.g.konsole).file_dialog: fills in the file Open/Save dialog in front:path(absolute or~/…) is written into its file name field, the default button (Open, Save) is pressed and the dialog's closing is awaited (Qt 5's name field and Qt 6's editable combo box alike). Works on an allowed app's own KDE dialog and on the portal dialog (xdg-desktop-portal-kde) a browser opens for uploads and downloads; a portal dialog is filled only when the parent window KWin reports for it belongs to an allowed app, and a dialog without a reported parent is refused. The portal is not added to the allowlist; no other element of the dialog is reachable. Foraction: "open"the file must exist, for"save"its folder. On Windows it fills an allowed app's common Open/Save As dialog (see the Windows limitations). It never answers an overwrite confirmation: the call then fails saying the dialog is still open.doctor: checks the setup in one report: version, allowlist, which running apps are allowed, the session, AT-SPI, the virtual keyboard and mouse, KWin scripting, screens and the screenshot path. Its last line is a JSON summary for programs: version, platform, session, the failed checks, theblockers(failed checks nothing works without) and anext_step. The same summary, each check with its detail, comes as MCPstructuredContent(the tool has anoutputSchema).key,type_text: keyboard. The reply names the element that has focus afterwards;type_textwarns when focus is not on an editable field (KDE). In abatch, a step whose focus is the one the previous report described saysfocus: [id] (unchanged)instead of describing it again. A menu or dialog the key opened is listed with ids (see "What an input opened").activate_window: brings a window to the front; fails when no window of an allowed app matches.windowon input tools (key,type_text,click,mouse,scroll,focus,drag,set_text,act,screenshot): a title or app-name substring, matched as byactivate_window. When the window in front is not a matching window of an allowed app, that window is activated first (the reply starts withactivated '<title>';), in the same critical section as the input, so no other call takes the focus in between; when it already is, nothing extra happens. Withoutwindownothing is activated.clipboard_get,clipboard_set: read or write the clipboard as text (Linux and Windows). Because the clipboard can hold anything the user copied anywhere (passwords included), both work only while a window of an allowed app is active.clipboard_getreturns at mostlimitcharacters (default 20,000; the reply says when it was cut); if the clipboard holds an image or files rather than text, it only names the types, and it does not read content a password manager marked as a password (x-kde-passwordManagerHint; on WindowsExcludeClipboardContentFromMonitorProcessing).mouse,screenshot: fallback only.screenshotreturns the image inside the reply, shrinks it so its longer side is 1024 px by default (max_size, at most 2576, and never over 3.7 megapixels: newer Claude models refuse larger images rather than shrink them) and reports which screen area it shows. The inline image is a JPEG (quality 80, full colour resolution, so small text stays sharp) when that takes at most three quarters of the PNG's bytes, else a PNG: a 1024x576 YouTube window took 132 KB instead of 670 KB, a Confluence page 94 KB instead of 246 KB; flat windows stay PNG. Image tokens depend on the size only (about width x height / 750: 786 at 1024x576), so the default size stays: at 896 px a 1080p window's 13 px text shrinks to 6 px. An inline screenshot leaves no file behind and names none;inline: falsesaves a PNG and returns only its path. Captures go to a new file only the user can read, never through an existing file or symlink: Linux$XDG_RUNTIME_DIR/desktop-mcp/shots(else~/.cache/desktop-mcp/shots, directories 0700, files 0600), Windows%LOCALAPPDATA%\desktop-mcp\shots; the newest 20 are kept.save_to(an absolute or~/path to a new.png) saves the image there instead, only in an existing folder under the home folder that the user owns and no one else can write to; an existing file is refused, never replaced. Givenimage_x/image_y,mouseconverts a pixel of the image to a screen coordinate (window position and display scaling, e.g. 125 %, included). Zoom:region: [x, y, w, h]in pixels of the last screenshot captures again and returns only that part, cropped before shrinking, at up to full resolution (max_sizestill applies);image_x/image_ythen refer to the zoomed image.id(from tree/find/marks) instead crops to that element's box and 12 px around it, e.g. to look at a control afteractwithout a whole-window image; an element in a window behind is captured there on KDE (else the reply names its window), one scrolled out of view is refused. The allowlist is checked on the window that is captured: KDE reads KWin's active window (its process, caption and class) once and captures it by its handle;spectacle(older KWin),grim(Hyprland) and the Windows screen copy are only kept when that window was in front before and after. An app without an accessibility name is refused by its caption and class, so the user knows what to allowlist. A failure says why (grimorspectaclemissing or failing with its error, KWin'sScreenShot2error, the temporary file). A screenshot whosewindowis already in front sends no input: it does not wait for the user's typing, and as a batch's last step it is not stopped by the user starting to use the seat. On KDE a screenshot withwindowactivates nothing: KWin captures the windowactivate_windowwould pick (allowlist checked on it) by its handle where it is, behind others too, and the reply addscaptured in background: '<title>' is not in front.image_x/image_yof such an image are refused until that window is in front (windowonmouse). A minimized window, one on another virtual desktop, and Hyprland and Windows are activated first, as before.marks: truedraws the ids of the captured window's visible interactive elements on the image (a thin frame around each, its id on a label beside it; the web page's or document's first, at most 40) and adds a legend linemarks: [12] link 'Home', …; the ids are registered as find's, so the next call isactorclickby id rather thanmouseby pixel. It costs one tree read of the window, done while it is captured, and one box read per element (KDE and Windows; Hyprland draws none yet).batch: runs several tools in order in one call and stops at the first error; reduces Claude's number of turns. A step with"optional": true(typically await_for) may fail without stopping the batch: it is reported as[n] tool failed (optional): …and the remaining steps still run, so a final observation step (find,screenshot) is not lost. A step'sid/*_idargument"$N"is the element step N produced (find's first hit, wait_for's match, the target of a tool given one). A small procedure fits in one batch, with plain JSON control flow:"if": {"step": N, TEST}on a step runs it only when the test holds on earlier step N; otherwise it is reported as[n] skipped (if step N …). TEST is one of"ok": bool(the step succeeded),"found": bool(it succeeded and produced an element;findhad a match) or"contains": "text"(its reply or error, case-insensitive). A skipped step meets no condition."on_fail": [steps]on a step runs those steps (reported as[n.on_fail] …) only when the step failed; the batch then goes on. Not after a refusal by the allowlist (or a tier, or a password field), a confirmation the user declined or was not asked for, or the user taking over: then[n.on_fail] not run (refused). Such a refusal also ends a repeat, even in an optional step.{"repeat": {"steps": [...], "until": TEST, "max": 10}}runs its steps (reported as[n.k] …, last run only) until TEST holds on the last of them, checked after each run; it fails aftermaxruns (1 to 20, default 10) or once it ran 10 minutes, and when a step in it fails that is not optional."$N"and conditions on a repeat mean its last step's result in the latest run. Its input steps withoutobserve(and any such step a condition tests) wait for the app to react, up to 150 ms (ending at its first change events), before their reply is read: the focus akeyreports is the one it moved to.{"stop_if": {"step": N, TEST}}ends the batch there, successfully. Steps are numbered at the top level only; steps insiderepeatandon_failtake onlytool,argsandoptional(no nesting). The whole batch is checked before anything runs (unknown tools or keys, conditions and"$N"that do not name an earlier step or can never hold,maxout of range): a mistake fails it withnot run (nothing sent): [n] …. Its input lock, the takeover check, the allowlist andobservework per step as in a plain batch. Example, scroll Dolphin's view of a folder "Reports" (the view is named after the folder) until a file shows, then click it, once the view stopped moving:[{"repeat": {"steps": [{"tool": "scroll", "args": {"app": "dolphin", "query": "Reports", "role": "list"}}, {"tool": "wait_idle", "args": {"app": "dolphin", "quiet_ms": 150}}, {"tool": "find", "args": {"app": "dolphin", "query": "report.pdf"}}], "until": {"found": true}}}, {"tool": "click", "args": {"id": "$1"}}].
The initialize reply carries instructions (about 3 KB): the workflow,
the targeting rules shared by the tools above, the allowlist and which tools
to load together. Clients that load tool schemas on demand, such as Claude
Code, show it at session start before any schema is loaded; the per-tool
descriptions only point to it.
Allowlist
Re-read on every call; a default list is created on first run.
KDE and Hyprland:
~/.config/desktop-mcp/allow.txt, one AT-SPI application name per line (kate,firefox…). Window tools (windows,move_window,activate_window) match a window by the AT-SPI application name of its process (pid), so apps whose window class differs are found too (Ferdium:electron). Apps without accessibility match by window class (likexterm).Windows:
%APPDATA%\desktop-mcp\allow.txt, one program name per line without.exe(notepad,firefox,chrome…).
Rules:
Elements of apps not in the list cannot be read or acted on.
Keyboard and mouse input is sent only when the window in front belongs to an app in the list.
activate_windowonly brings windows of listed apps to the front.launchrefuses an app not in the list before starting anything.file_dialogfills in the dialog of the (unlisted) portal only when it was opened for a listed app; a dialog opened by another app is refused.
Use the apps tool to see the right names.
Tiers, confirmation and password fields
An app can be limited to a tier with app:tier; a plain name means full, so
files without tiers keep working unchanged:
firefox # full: everything
konsole:view # read tools only
dolphin:click # no typing
confirm: close_window, key:konsole
passwords: keepassxctier | allows |
|
|
| plus |
| plus |
The tier is checked against the app a call reaches: the target element's app
for element tools, the active window's app for keyboard and pointer input
(both for click, scroll and focus). An app listed twice gets the lower
tier; an unknown tier counts as view. A refusal names the tier.
confirm: lists tools (tool) or tools in one app (tool:app) that need
the user's consent per call. When the client supports MCP elicitation the
server asks the user through it; otherwise the call is refused unless it
carries confirm: true (the agent is told to ask the user first).
Password fields (AT-SPI role password text, UIA IsPassword) never show
their text in tree, find or wait_for, and get_text refuses them.
set_text, and type_text while one has focus, refuse them too unless the
app is on a passwords: line (passwords: all for every app) or the server
runs with DESKTOP_MCP_ALLOW_PASSWORDS=1. doctor shows the tiers, the
confirm list and the password setting.
Input never goes to the agent's own client. At start the server reads its
ancestor processes (Claude Code and the terminal it runs in, or Claude
Desktop) and their terminals; keys, typing and pointer input are refused
("nothing sent") while the window in front is the client's window or, for a
terminal, while its tab in front runs the agent. Konsole's tab in front is
read over D-Bus, so the other tabs of the same window stay usable; for other
terminals, whose tab in front cannot be read (kitty, foot's server,
gnome-terminal), the window is refused while any terminal of its process
runs the agent. Pointer input at a point outside the window in front is
refused over the agent's window. Element tools refuse the client's own
elements (Claude Desktop's buttons) and a terminal's entries that send
input into it (Paste, Copy Input To), close_window refuses its window, and
window/activate_window prefer another window that matches as well. Run
in tmux or screen, the agent's terminal window is not known (the
multiplexer's server left it), so the guard cannot see it; doctor warns. On
Windows only the foreground window's process is compared: a console window
whose shell runs the agent is refused, but Windows Terminal's and editors'
tabs cannot be told apart, so those windows are not. A
self-client: allow line turns the guard off; doctor names the client it
found.
Installation
Each GitHub release
comes with prebuilt binaries, so no Rust is needed; building from source needs
Rust. Either way, the system packages listed per desktop
below are needed. After installing, open a new Claude Code session and check
with /mcp that the desktop server is connected.
Quick install (prebuilt)
Linux (x86_64):
curl -fsSL https://raw.githubusercontent.com/ahmetadakli/kde-desktop-mcp/main/tools/install.sh | bashIt downloads the latest release, checks it against the release's SHA256SUMS,
installs ~/.local/bin/desktop-mcp and adds the desktop server to Claude Code
when there is none (VERSION=…, INSTALL_DIR=… and NO_CLAUDE_ADD=1 change
that; see the script). Arch Linux: AUR recipes for desktop-mcp (source)
and desktop-mcp-bin are in packaging/aur (not on the
AUR yet).
Windows: download desktop-mcp-v…-x86_64-windows.zip from the release, unpack
it and run claude mcp add --scope user desktop -- "C:\path\to\desktop-mcp.exe".
The Windows build is cross-compiled and has not been run on real Windows yet.
The sections below build from source.
Claude Code plugin
The repository is also a Claude Code plugin marketplace. In Claude Code:
/plugin marketplace add ahmetadakli/kde-desktop-mcp
/plugin install desktop-mcpOn Windows install desktop-mcp-windows instead. The plugin adds the
desktop server; the system packages listed per desktop below are still
needed. Its launcher
(packaging/claude-plugin) runs a desktop-mcp
found on PATH (installed with install.sh, an AUR package or cargo).
Otherwise it downloads the release build of the plugin's version once into
the plugin's data directory (~/.claude/plugins/data/…), checks it against
the release's SHA256SUMS and runs it; an archive that does not match is
deleted, never run. Linux needs curl (or wget), sha256sum and tar;
the Windows launcher uses PowerShell and has not been run on real Windows yet.
Updating:
/plugin update desktop-mcp(or the marketplace's auto-update) moves to the next version, whose launcher downloads that release. Adesktop-mcponPATHis updated the way it was installed.Plugin servers have their own tool names:
mcp__plugin_desktop-mcp_desktop__findinstead ofmcp__desktop__find, so the permission rule under "Speed: skipping the permission prompt" ismcp__plugin_desktop-mcp_desktop(Windows:mcp__plugin_desktop-mcp-windows_desktop).A
desktopserver already added withclaude mcp addkeeps running next to the plugin's; remove one of them (claude mcp remove --scope user desktop).
KDE Plasma (Wayland)
Requirements:
KDE Plasma 6, Wayland session
System packages (Arch):
at-spi2-core,libkscreen,wl-clipboard,spectacleKWin 6.8 or later for fast screenshots. On older KWin,
screenshotfalls back tospectacle; enabling KWin'sScreenShot2interface takes installing a.desktopfile by hand once (details in theSHOT_NOT_AUTHORIZEDcomment inrust/src/linux/kwin.rs)Write access for the user on
/dev/uinput(getfacl /dev/uinput)
git clone https://github.com/ahmetadakli/kde-desktop-mcp.git
cd kde-desktop-mcp/rust
cargo build --release
claude mcp add --scope user desktop -- "$PWD/target/release/desktop-mcp"Hyprland
Requirements:
A Hyprland session (the
movecursordispatcher)System packages (Arch):
at-spi2-core,wl-clipboard; recommended:wtype(typing without touching the clipboard),grim(screenshots;doctorwarns when it is missing)A working AT-SPI bus in the session. Qt apps may need
env = QT_LINUX_ACCESSIBILITY_ALWAYS_ON,1in the Hyprland configuration.Write access for the user on
/dev/uinput
The installation commands are the same as for KDE. Start Claude Code from
inside the Hyprland session so HYPRLAND_INSTANCE_SIGNATURE reaches the
server.
Windows
Requirements: Windows 10 or 11. In PowerShell:
git clone https://github.com/ahmetadakli/kde-desktop-mcp.git
cd kde-desktop-mcp\rust
cargo build --release
claude mcp add --scope user desktop -- "$PWD\target\release\desktop-mcp.exe"Building for Windows on Linux also works (mingw-w64-gcc and
rustup target add x86_64-pc-windows-gnu, then
cargo build --release --target x86_64-pc-windows-gnu).
Updating
Claude Code runs the binary you installed; reconnecting (/mcp) restarts that
same file, so a new version has to be installed first. doctor says when a
newer release is out.
Installed with install.sh: run the same command again. With an AUR package:
your usual system update. Built from source: in the clone (no need to clone
again or to run claude mcp add again; the path stays the same):
cd kde-desktop-mcp
git pull
cd rust
cargo build --releaseThen reconnect the server in Claude Code (/mcp, select desktop, reconnect)
or restart Claude Code. On Windows the same commands work in PowerShell
(cd kde-desktop-mcp\rust). The version is in rust/Cargo.toml and in the
server's initialize reply (serverInfo.version). New versions are announced
as GitHub releases;
to be notified, watch the repository with "Custom → Releases".
Speed: tools loaded up front
Claude Code defers MCP tools behind a tool search, which costs a model turn at
the start of every desktop task. The server marks the ten tools nearly every
task starts with (batch, find, act, activate_window, key,
type_text, wait_for, wait_idle, screenshot, apps) with
_meta: {"anthropic/alwaysLoad": true}, so Claude Code loads them with the
session (about 11.5k characters of schema); the others stay deferred. To load
every tool up front instead, add "alwaysLoad": true to the server's entry in
the MCP config.
Speed: skipping the permission prompt
Claude Code sends every MCP call that is not in its allow list to a prompt or,
in auto mode, to its safety classifier; that adds roughly 0.7–2.5 s per call.
If you trust all of the server's tools, add one rule to
~/.claude/settings.json:
{ "permissions": { "allow": ["mcp__desktop"] } }Testing
Unit tests need no real desktop (the pure part of the Windows logic runs on Linux too):
cd rust && cargo test --releaseThey also check the tool list itself: every tool's annotations, description
and schema (required arguments, defaults, enums), its stable order, and a byte
budget for what every session loads up front (the instructions and the
always-loaded tools). CI also runs cargo audit on rust/Cargo.lock, weekly
too; accepted advisories and why are in rust/.cargo/audit.toml.
The "KDE (headless)" CI job tests against a real KWin 6 and AT-SPI without a
screen: in an Arch Linux container it starts kwin_wayland --virtual in its
own D-Bus session, opens a small Qt window (tools/ci/qt_app.py) and drives it
over MCP (tools/ci/kde_headless_test.py): apps, tree, find, set_text,
get_text, act, activate_window, focus, type_text, key and the allowlist's
refusals. KWin's virtual backend reads no input devices, so key and pasting
are reported skipped there, with the reason. The scripts refuse to run outside
CI: a second session bus and compositor next to a running desktop can break
its accessibility bus.
tools/mcp_smoke_test.py tests end to end on the real desktop over the real
MCP protocol (Linux, Kate): it opens the editor with a temporary file, finds the
element, refocuses it after focus moved elsewhere, types text with Turkish
characters through batch, tries rapid consecutive typing and key repeat,
saves with Ctrl+S, reads the file back from disk, launches Kate with launch,
and checks that the allowlist blocks an unknown app. It prints the duration of
every call. Only the Python standard library is needed. Do not touch the
keyboard and mouse while it runs.
python3 tools/mcp_smoke_test.py rust/target/release/desktop-mcptools/mcp_bench.py measures one or more servers with the same calls and
prints a table of median ms (the window must be open):
python3 tools/mcp_bench.py --app kate --window notes.txt \
--server "Rust=rust/target/release/desktop-mcp"End-to-end task benchmark
Tool calls take milliseconds; what makes a desktop task slow is the number of
model turns and the size of what the model reads. tools/e2e_bench.py measures
that on real tasks: it runs Claude Code headless (claude -p, only this
server's tools; built-in tools, the user's settings, plugins, hooks and skills
left out) once per task × model × server binary and records model turns,
desktop tool calls, wall time up to the final result split into startup,
model and tool time (calls of one turn that run at once count once), the
exit after the result on its own, reply characters and images, tokens, the
model actually used, and whether the task got done. default in --models
means Claude Code's own default model, not the one in your settings. The tasks
in tools/e2e_tasks.json each open their own window on a fresh temp file
(Kate: append a line and save, Save As to a new path, search and replace, read
a value; Firefox: fill and submit a local form in a new window; Dolphin:
create a folder), state the goal as a user would, check the
outcome on disk, in the final answer or with a read-only query, and close only
what they opened (the PID their setup recorded, or the one window carrying the
run's unique tag).
python3 tools/e2e_bench.py --list
python3 tools/e2e_bench.py --tasks kate_append,kate_replace --models default,claude-haiku-5-5 \
--server "old=/path/to/old/desktop-mcp" \
--server "new=rust/target/release/desktop-mcp" --repeat 3 --results /tmp/e2eIt prints a Markdown table of medians and writes results.json (with every
tool call, its time and reply size), table.md and each run's raw stream to
--results (default: a new temp dir; never inside the repository). The agent
types into the windows the tasks open (each run makes its window the active
one first): do not use the keyboard or mouse while it runs. Firefox and
Dolphin open the task's window in their running instance; close your own
windows of them first, or pass --exclusive to skip those runs (each run
notes other open windows of its app). Ctrl+C stops the agent with its whole
process group before cleanup. python3 -m unittest tools/test_e2e_bench.py
tests the measuring and the process handling without a desktop.
Measurements: KDE speed-up
tools/mcp_bench.py, KDE Plasma 6.8, Kate; median of 5 rounds (ms). "Before"
is 2f2e5df (the version that removed Python), "After" this version:
Operation | Before (ms) | After (ms) | Speed-up |
| 4.4 | 3.3 | 1.4x |
| 3.8 | 4.2 | 0.9x |
| 8.5 | 10.3 | 0.8x |
| 12.0 | 10.0 | 1.2x |
| 10.1 | 9.9 | 1.0x |
| 0.3 | 0.3 | 0.9x |
| 19.5 | 6.4 | 3.0x |
| 34.9 | 2.9 | 12x |
| 103.5 | 12.1 | 8.5x |
| 78.1 | 11.1 | 7.0x |
| 29.3 | 4.9 | 6.0x |
| 258.8 | 12.1 | 21x |
The ~2 ms in activate_window is reading the active window title so act can
report a window change. The real gain lies beyond milliseconds: short output,
targeting with app + query in one call, wait_for and batch reduce the
number of Claude's turns and the text it reads.
Measurements: compared with the old Python version
The server used to be written in Python; its last state is commit 4cd2632 in
the git history. The Rust version offers the same tools with the same output:
1,499 lines of output on KDE and 2,025 on Hyprland were compared with the
Python version, with no difference. The values were taken with
tools/mcp_bench.py applying the same call sequence to both servers in turn;
median of 5 rounds (ms, in a Kate window, same machine).
KDE Plasma 6 (Wayland):
Operation | Python (ms) | Rust (ms) | Speed-up |
| 400.5 | 2.2 | 181x |
| 48.8 | 4.2 | 11.6x |
| 22.7 | 7.4 | 3.1x |
| 66.6 | 11.5 | 5.8x |
| 40.8 | 9.4 | 4.3x |
| 5.0 | 0.3 | 15x |
| 61.3 | 19.4 | 3.2x |
| 197.0 | 35.6 | 5.5x |
| 339.2 | 102.8 | 3.3x |
| 165.5 | 78.4 | 2.1x |
| 66.4 | 28.8 | 2.3x |
| 269.0 | 254.3 | 1.1x |
Hyprland 0.56 (nested session inside KDE):
Operation | Python (ms) | Rust (ms) | Speed-up |
| 394.5 | 2.2 | 178x |
| 145.6 | 4.3 | 34x |
| 225.0 | 3.1 | 73x |
| 120.9 | 18.5 | 6.5x |
| 75.9 | 16.1 | 4.7x |
| 4.5 | 0.3 | 13x |
| 60.5 | 19.2 | 3.1x |
| 28.6 | 11.1 | 2.6x |
| 319.5 | 77.7 | 4.1x |
| 168.7 | 78.0 | 2.2x |
| 69.1 | 28.3 | 2.4x |
| 38.1 | 24.2 | 1.6x |
Windows (Notepad inside Wine 11.20; not a real Windows measurement):
Operation | Python (ms) | Rust (ms) | Speed-up |
| 1998.6 | 62.8 | 32x |
| 43.0 | 1.4 | 32x |
| 5.9 | 0.9 | 6.4x |
| 54.8 | 19.3 | 2.8x |
| 7.1 | 1.1 | 6.5x |
| 55.6 | 30.5 | 1.8x |
| 82.3 | 8.3 | 9.9x |
Wine's UI Automation client does not support cache requests, tree walking and
most properties (E_NOTIMPL), so tree, find, get_text, focus and
click do not work under Wine on either server; the apps and
activate_window figures in the table are for returning without finding a
window. Most of the difference in the input steps comes from Rust's shorter
waits.
The gap grows with larger trees: a 2,000-element tree of Dolphin including
hidden elements takes 507 ms in Python and 48 ms in Rust. screenshot time is
mostly the spectacle and grim programs themselves.
In nested Hyprland, Ctrl/Alt shortcuts from uinput get lost on their way through the outer KWin (on both servers), so no shortcut tests were run there. In a real Hyprland session uinput goes straight to Hyprland.
Known limitations
KDE:
The server turns on the accessibility bus at run time. Apps started before that need one restart.
Chromium, Chrome and Electron apps show their tree only when started with
--force-renderer-accessibility.type_textpastes through the clipboard into fields other than Qt's multi-line editors (such as Kate). It first saves the clipboard text and puts it back once the target app has read the paste (seen through Wayland data-control). The typed text does not enter Klipper's history (it is offered with the password hint). The clipboard is not put back when it held an image, files or text over 4 MiB, nor when the app does not read the paste within 1 s (so that a late reader does not paste the user's clipboard); the reply says so in both cases. Rich text (HTML) comes back as plain text only.Direct insertion differs slightly from pasting: replacing selected text is two undo steps, with multiple cursors only the primary cursor gets the text, overwrite mode and Kate's vi mode are bypassed, and auto-indent and bracket completion do not run as they would on a paste.
Hyprland:
Client-side shadows of GTK apps can shift
clickandfocusclicks by a few pixels.Two windows of the same process with the same title cannot be told apart.
Without
wtype,type_textpastes through the clipboard as on KDE and puts the clipboard text back afterwards.Hyprland has no minimize:
move_windowwithstate: "minimize"moves the window to the special workspacespecial:minimized, andwindowsreports windows on a special workspace no monitor shows as minimized.restorebrings it back to the workspace its monitor shows (not necessarily the one it came from).Maximize is Hyprland's maximized fullscreen mode (
fullscreenstate 1 1);windowsreports any fullscreen mode as maximized. Hyprland applies fullscreen states only to the focused window, somaximizeandrestoreof a maximized window also focus it.Moving or resizing a tiled window makes it floating first (
setfloating); it stays floating afterwards.Hyprland 0.57 takes only Lua dispatchers over its socket (
hyprctl dispatch Xbecamehl.dispatch(X)). The server notices the first Lua error and from then on sends the Lua form of every dispatcher it uses (hl.dsp.focus,hl.dsp.window.move/resize/float/fullscreen_state/close,hl.dsp.cursor.move); verified against a nested Hyprland 0.57. Named workspaces have no number there;windowslists them by name.
Windows:
Input cannot be sent to windows running as administrator from a server that is not (Windows UIPI).
Microsoft Store apps run inside a frame window of ApplicationFrameHost;
apps,windows,find/actand the input checks name such a window after the app it hosts (calculatorapp,systemsettings), also while it is minimized.applicationframehostin the allowlist still allows every Store app it hosts, running or not (installed ones are read from their manifests at start), with its tier (an app's own line wins), and itsconfirm:items apply to those apps too (passwords:items naming it do not carry over). A frame is reached only by its app's name:app: "applicationframehost"finds just frames that host no app, so an app's own lower tier and confirm rules cannot be passed by naming the frame.Window tools: positions and sizes are physical pixels (as for
mouse) of the visible frame, without the invisible resize borders; the screen areasscreenshotreports include them. Virtual desktops are not listed andmove_windowcannot change them (desktopis refused). A minimized window reports where it goes back to; while minimized since before the server saw it, that rectangle still includes the borders. The desktop and taskbar (explorer'sProgman,Shell_TrayWnd) are never listed.launchlooks for the program in App Paths (msedge), onPATH(including the Store's execution aliases such asmspaint), in System32 and the Windows folder, then among the user's Store apps by executable or package name (calculatorappstartsMicrosoft.WindowsCalculator); only.exeprograms are started, never a script. Starters that pass the request on and end (System32'scalc.exe,explorer <folder>, which exits with code 1,msedge <url>while Edge runs) count as a hand-off; other exit codes are failures. A Store app's window shows under the app's own name, aswindowslists it. Notepad's own starter process stays running without a window after handing a file to the open Notepad.Key names follow the US keyboard layout positions; use
type_textfor text.type_textpastes through the clipboard (a single character is typed as a key). It saves the clipboard first, every format whose data is a memory block (text with its HTML/RTF formatting, Office formats, images as DIB, copied files), and puts it back once the app in front has read the paste: the text is offered with delayed rendering, so the read shows as the app's request for it. Formats that cannot be kept (metafiles, owner-drawn or private ones) are named in the reply; contents over 16 MiB are not kept and the clipboard is emptied instead. The typed text is kept out of the clipboard history (Win+V) and marked for clipboard monitors, and it never stays on the clipboard: when the app does not read the paste within 1 s the clipboard is put back and the call fails (the text was probably not typed). A paste cancelled half-way, or cut short by the server's exit, also puts the clipboard back. While another app holds the clipboard open, the text is typed key by key instead. Typing stops, with an error, when another window comes to the front.A menu bar entry or submenu entry acts by expanding (its first action is
expand);actlists the menu it opened asopened: menu (…). A button whose only action isinvokebut opens a menu (Explorer's "Diğer seçenekler") is not looked after:findthe entries.file_dialogworks on the common Open/Save As dialog (a#32770window in front, of the app that opened it), found by control ids rather than by its language: the file name field (1001 in Save As, 1148 in Open) and the default button.~stands for%USERPROFILE%unlessHOMEis set (~\works too). When the dialog asks to confirm overwriting a file, the error names that prompt and leaves it unanswered. An app's own file picker of another kind is not a file dialog to it.set_texton a single-line Win32 edit control writes as typing over a selection would (EM_REPLACESEL), not with UI Automation's SetValue: the common file dialog ignores a name set that way and saves under the old one.In very large windows (browsers, Word)
treeandfindcan be slow because they fetch the whole subtree at once.UI Automation sends the server no change events: the effect line of an input reads the app's windows before and after it (see
observe), andwait_idlepolls them. In Chromium browsers (Edge, Chrome) and Electron apps the page is the document on screen: its title and address (the document's value) name a page change, and MSAA's busy state is taken as loading. A link below the fold is off screen as Chromium says (no visible match);act action=scroll_toon its id brings it into view.
All:
Games and canvas-based interfaces mostly show up empty in the accessibility tree.
Security
The server runs with your user's permissions. The allowlist is a safety layer, not operating-system level isolation. Think twice before adding terminals, the file manager or system settings to the list.
License
MIT
Inline screenshots are encoded with the jpeg-encoder crate; this software
is based in part on the work of the Independent JPEG Group.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
Remote desktop MCP: let AI see, click, type and run terminal commands on your own Windows or Mac.
Remote MCP server to control your Android phone from AI assistants with per-app permissions.
Melaya is a remote MCP server. It gives an assistant hands on your own Android phone and browser: it reads the screen through the accessibility tree, then taps, types and navigates inside the apps and sites you allow-list, with no per-app API. It also builds, schedules and runs agent pipelines across 6k+ connected tools. OAuth 2.1, nothing to install.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables MCP-capable AI agents to control Windows desktops through UI Automation element trees, native screenshots, app launching, batched action sequences, smart waits, and safety gates using normalized coordinates.MIT
- AlicenseBqualityBmaintenanceEnables AI agents to observe and control local browsers and desktop applications over MCP, including reading UI elements and differences, capturing images, and performing permitted clicks, typing, selections, scrolling, and multi-window operations.162MIT
- AlicenseCqualityBmaintenanceEnables MCP clients to inspect desktop windows through accessibility trees and screenshots, perform actions on resolved UI elements, and verify expected conditions after those actions.731Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to inspect and control ordinary Windows desktop applications through UI Automation, SendInput, and GDI screen capture, with tools for window discovery, accessibility snapshots, screenshots, clicking, typing, key presses, scrolling, dragging, text selection, value setting, and advertised accessibility actions.MIT