Repository navigation
v0.1.0
The first release: an MCP server over stdio that lets an AI agent read and act on a niri 26.04 desktop.
Upgrading
- If you run a source build of
main, end every runningniri-computer-useprocess (servers, bridges and shared engines) before installing this one, then start your clients again.pgrep -a '^niri-computer-u'lists them. Older builds ofmainkept their runtime directory underXDG_RUNTIME_DIR, so an old and a new server on one niri would share neither the lease nor the stop flag. Tools were also merged and renamed during development; link or copyskills/niri-computer-useagain so your agents read the current names.
Added
niri-computer-use serve, an MCP server over stdio, and the commandsstatus,stop,resume,recoverand--version.- 22 tools. Reading, with no lease:
status,desktop_state,screenshot,elementsandwait_for. The lease:acquire_desktopandrelease_desktop. Under the lease:clipboard_read, and the tools that act,focus,launch,close_window,niri_action,pointer_move,click,drag,scroll,key,type_text,activate_element,set_element_text, and with Noctalia installedshell_panel, andnoctaliawhenunrestrictedis on as well.elements,activate_elementandset_element_textare listed when the session has an accessibility bus. desktop_state: windows, workspaces, focus, the overview, keyboard layouts and outputs from niri's event stream, and with Noctalia installed its status asshell.screenshot: one output or a region inside one, throughgrim, as JPEG or PNG, at most 1280 pixels wide unlessmax_widthsays otherwise. A region of an earlier screenshot, named by itsscreenshot_ref, is captured again at full resolution to read small text.save_pathwrites a PNG under~/Pictures/niri-computer-use, or the policy'scapture_dir, never through a symlink and never over an existing file.elements: one window's accessible elements over AT-SPI, one line each with anelement_ref, role, name, states, actions and box in layout coordinates.activate_elementruns an element's own action andset_element_textreplaces a field's text, both through the accessibility bus. The pointer tools take anelementin place of screenshot pixels.wait_for: waits for a window to appear, close or change its title, or for the screen to stop changing, for up to 30 seconds.focusa window or workspace,launchan app from a policy preset, optionally reusing an open window, andclose_window.niri_actionsends any niri action in niri's IPC JSON, such as fullscreen, floating or a column's width, and returns the window's state after it.- Pointer input through niri's virtual pointer (
pointer_move,click,drag,scroll), aimed at a screenshot's pixels through ascreenshot_refthat expires after 60 seconds or when its output changes. - Keyboard input through
wtypeinto the window named inexpect:keypresses up to 16 combinations, andtype_texttypes up to 1000 characters in parts of 100, with focus and the lock state checked again before each part.submit: truepresses Enter only once all of the text went out.via: "paste"pastes up to 1 MiB through the clipboard and puts the clipboard back afterwards.NIRI_COMPUTER_USE_KEYBOARD=nativeselects an experimental backend on niri's virtual keyboard that checks focus before every key. - Every action result says whether niri
acceptedthe action and what wasobservedafter it.changeslists what niri saw change, such as windows opened, closed or moved and focus moving, andelement_changeslists the accessible elements that changed.screenshot: trueadds a screenshot taken once the screen stopped changing. clipboard_read: the clipboard's text, under the lease.shell_panelopens and closes the Noctalia panelscontrol-center,wallpaperandtray-drawer.noctaliasends any Noctalia command and is listed only withunrestrictedon.- A policy file at
$XDG_CONFIG_HOME/niri-computer-use/policy.tomlwith launch presets ([[preset]]withname,argv,app_idandenv),deny_input_app_ids,capture_dir,unrestricted,confirm_lease,sharedandtools.NIRI_COMPUTER_USE_UNRESTRICTED,NIRI_COMPUTER_USE_CONFIRM_LEASE,NIRI_COMPUTER_USE_SHAREDandNIRI_COMPUTER_USE_TOOLSset the same for one client. - Tool profiles:
tools = "observe"lists only the five reading tools,"act"leaves outniri_action,noctaliaandshell_panel, and"full", the default, lists every tool. - A shared engine per niri instance, on by default: each client's
serverelays to oneniri-computer-use engine, started in its own systemd user scope where systemd allows it. Policy, keyboard backend,PATHand working directory stay per client. - Session discovery: with no
XDG_RUNTIME_DIR,NIRI_SOCKETorWAYLAND_DISPLAYfrom the client, the server takes them from the user's only running niri, so no client needs environment settings. - The
niri-computer-useskill inskills/, which tells agents how to use the tools, with tool and error tables inreferences/. - An audit log of every tool call at
$XDG_STATE_HOME/niri-computer-use/audit.jsonl, with argument metadata and outcomes but no typed text, clipboard, window titles or images, moved aside at 10 MiB with three old logs kept. - Failures carry a stable error name and the upstream detail; the skill's
references/errors.mdand the documentation site list them. - The documentation site, with
llms.txtand a Markdown address for every page. - Release tarballs for x86_64 and aarch64 Linux with the binary, the skill and the licenses of the crates built in, and
install.sh, which installs the binary and the skill from one of them.
Security
- One server at a time holds the lease on a niri instance, an exclusive
flockin a runtime directory beside niri's socket. Only the holder acts; another session'sacquire_desktopfails withlease_held. niri-computer-use stop, meant for a niri bind, cancels the running action and takes the lease back untilniri-computer-use resume. It doesn't connect to niri, so it works while niri hangs.- Every action goes out within 250 ms of a read of the lock state, from Noctalia and logind, that said unlocked. A locked or unknown state fails with
screen_locked, and a read that got too old before the call could go out fails withlock_stale. - With
confirm_leaseon,acquire_desktopwaits for you to choose Allow on a desktop notification sent withnotify-send. A denial, a dismissal or no answer within 60 seconds fails withlease_declined. - An input-dirty marker is written before input and removed once the input is released. A crash mid-input leaves
recovery_requireduntil you runniri-computer-use recover. A crash guardian beside each server releases held native keys and pointer buttons when the server dies. - Keyboard and pointer input refuse with
app_deniedwhile an app on the deny list has focus, and element actions andclose_windowrefuse on its windows.set_element_textandactivate_elementrefuse fields marked as passwords withsecret_field. launchonly starts presets, and a preset can't start a program that runs whatever follows it, such astmux,ssh,flatpak-spawnordocker.niri_actionrefuses actions that run programs, write files or reach past the layout, such asSpawnandDoScreenTransition, withunrestricted_required.unrestricted, off by default, allows both, and listsnoctalia.clipboard_readreturns only what was copied while the lease was held (copied_before_leaseotherwise), and never text its owner marked secret for clipboard managers, such as a password copied from KeePassXC (secret).- The name an MCP client gives itself is cut to 64 characters of ASCII letters, digits, spaces and
._-+@before it labels the audit log, the lease holder and theconfirm_leaseprompt.