dsh-plugin-linux-computer-use
Automates the GNOME desktop: captures screenshots through the portal, reads the AT-SPI UI tree, injects mouse/keyboard input, manages clipboard/processes/settings, and reports display and lock-screen state.
Provides Linux desktop computer-use tools, including screenshots, UI tree inspection, input injection via /dev/uinput, clipboard access, process management, gsettings, notifications, and display information.
Automates Ubuntu desktop sessions, especially Ubuntu 24.04/GNOME Wayland, with screenshot, UI tree, mouse/keyboard, clipboard, process, system settings, and notification capabilities.
Automates Wayland desktop sessions using xdg-desktop-portal for screenshots and /dev/uinput for input injection; also supports X11 sessions but is optimized for Wayland.
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.
dsh-plugin-linux-computer-use
Computer Use for Ubuntu / GNOME Wayland, bridged into DeepSeek Harness as MCP tools.
给 DeepSeek Harness 装上"手和眼睛":截屏、UI 树、鼠标键盘、剪贴板、进程、系统设置,全部以 mcp__linux__* 工具暴露给模型;外带一个 linux_mcp_doctor 诊断工具。默认关闭,在插件面板里手动打开。
English summary at the bottom.
它能做什么
能力 | 后端(为何) |
截屏 |
|
UI 树 / 找元素 / 点击元素 | AT-SPI2( |
鼠标 / 键盘注入 | 直写 |
剪贴板 |
|
进程 |
|
"注册表"类比 |
|
通知 |
|
显示器信息 | Mutter |
窗口操作 |
|
等待条件 |
|
33 个工具,分组见 docs/DETAIL.md。模型调用方式:mcp__linux__screenshot、mcp__linux__click、mcp__linux__ui_find ……
Related MCP server: claude-workman
安装
# 1. 装插件(npm 包名 / GitHub 仓库均可)
dsh plugin --profile web add dsh-plugin-linux-computer-use
# 2. 一次性准备系统权限(需要 sudo,幂等,可 --uninstall 回滚)
sudo ./linux-computer-use-prep.sh
sudo ./linux-computer-use-prep.sh --verify # 不需要 sudo
# 3. 重启 dsh(不需要注销重登,见下方说明)准备脚本做四件事:
udev 规则给
/dev/uinput加上uaccess,并立刻setfacl授予你rw(这是主路径:进程身份不变);顺带把它设成
input组、0660(备用路径,给没有 logind 的场景);装
wl-clipboard(必需)和ydotool(可选兜底;Ubuntu 24.04 的 ydotool 包里没有ydotoold守护进程,所以兜底路径默认不可用——主路径/dev/uinput不依赖它);装一个固定路径启动器
/usr/local/bin/dsh-linux-desktop-mcp。
不需要注销重登:权限走 ACL(u:cheng:rw),不靠进程的组身份,所以哪怕宿主进程是很久以前启动的、哪怕 systemd --user 因为 Linger=yes 一直没重启,注入依然可用——只要重启一次 dsh 让 MCP 子进程重新拉起。
为什么不用
sg input换组:sg会把真实 gid 也切成input组的 995,而xdg-desktop-portal要用/proc/<pid>/root识别调用者身份,内核的 gid 检查会直接EACCES,截屏就废了(实测报Portal operation not allowed: Unable to open /proc/<pid>/root)。ACL 不碰进程身份,两条路都通。
打开
设置 → 插件 → Ubuntu 桌面自动化 (Computer Use) → 打开开关 → 刷新页面。
开着插件但没开 Computer Use 时也可以先跑 linux_mcp_doctor(不需要 MCP 在线),它会逐项告诉你缺什么、怎么补。
第三招:一次调用跑一整段流程
sequence 把多个工具合成一次调用:{"steps": [{"op": "window_activate", "args": {"title": "嘉立创"}}, {"op": "click", "args": {"text": "保存"}}, {"op": "screenshot", "args": {"region": {...}, "scale": 1}}]}。
回复是每步的 {step, op, ok, ms, error?} 加最后一步的输出(含图片),所以上面这段从 4 次模型往返变成 1 次。注入类步骤不必逐个写 allow_active_input,在最外层给 true 即可;某步允许失败就设 stop_on_error: false。
省钱与提速的两招
ui_tree先过滤再读:roles: ["push button", "entry"]只保留你要的节点类型,祖先会折叠成ref/role/name的路径;再加compact: true去掉 rect/states/text。实测同一屏 140 节点/10.2 KB → 20 节点/0.85 KB。screenshot用region+scale: 1.0:先在 4480×1440 原图上裁剪再缩放,小字才清楚,token 也只有整屏的三分之一。看不清哪个能点就用
marks: true:截图会围上带编号的框,同时返回marks: [{id, ref, role, name, x, y, width, height}](坐标已经是截图像素)。之后click_ref {"ref": "e42"}直接点,不需要自己算坐标。注意(GNOME Wayland 实测):GTK 4 与 Chromium 的窗口不向 AT-SPI 报告屏幕矩形,这时画不出框,
marks会是空数组,改为返回clickable: [{ref, role, name}]。对这些元素click_ref走的是无障碍的「点击」动作(不需要坐标);没有动作的控件只能靠screenshot+ 坐标点击。Chrome 更是只暴露application与frame,网页里的元素请优先用browser_*(DOM)。
已知限制(重要,别踩坑)
Chromium / Electron / Qt 应用(Chrome、VS Code、微信、WPS、Bitwarden)暴露的 UI 树是空的——这是平台事实,不是 bug。它们只能靠"截屏 + 坐标点击",窗口一动就得重新截图。原生 GTK 应用用
ui_find+ui_action很稳。AT-SPI 全量枚举约 3–4 秒(某个无响应应用会拖慢),所以应用列表有 5 秒缓存。
截屏必须走 portal:第一次会弹一次系统授权框(GNOME 记住你的选择),之后每次截图静默、约 0.5 秒。ScreenCast 流式路径(
DSH_LINUX_CU_SCREENCAST=1可强制)在 GNOME 46 上画面静止时不产帧,只当兜底。锁屏时只截图、不注入:服务器会向
org.gnome.ScreenSaver.GetActive查询锁屏状态,处于锁屏时click/key/type_text等全部拒绝执行(锁屏焦点在密码框上,误打就会往密码里塞字符),screenshot仍可用。desktop_status的session.locked会告诉你当前状态。你在用电脑时也不注入:服务器用
org.gnome.Mutter.IdleMonitor.GetIdletime查空闲时间,最近 60 秒内有键鼠动作就拒绝点击/输入(否则自动化会和你抢光标)。这一条可以放行:工具参数带allow_active_input: true(模型在你明确让它代操作时会带),或设环境变量DSH_LINUX_CU_ALLOW_ACTIVE_INPUT=1;阈值用DSH_LINUX_CU_IDLE_GUARD_MS调(默认60000)。截图、读 UI 树、读文件不受影响。desktop_status的session.idle_ms就是当前空闲毫秒数。原生 Wayland 窗口没法被 X11 抬起:Chrome、GNOME 自家应用在
xdotool search里完全不存在,window_activate对它们会用 Alt+Tab(本应用内切窗口)与 Super+Tab(切应用)循环,需要 uinput 键盘可用。如果三条路都失败,返回activated: false与tried明细,而不是假装成功。截图要看清小字就用
region:整屏 4480×1440 缩到 1400 宽,11px 的小字会糊成一团;传{"region": {"x":120,"y":140,"width":900,"height":620}, "scale":1.0}只截那块、按原尺寸返回,既清楚又省 token。space: "screenshot"会自动加回偏移,不用自己算。只能工作在当前登录的图形会话里;SSH / 无头环境下没有桌面可控制。
安全模型
打开
input组 +/dev/uinput之后,该账户下任何进程都能控制键鼠。这就是这个能力的本质,没有免费午餐。缓解:MCP 桥接默认
disabled;/dev/uinput只对input组开放;ydotooldsocket 0600;所有工具调用走 DSH 的审批体系。日志在
~/.cache/dsh-linux-cu/server.log(超 1 MB 轮转)。不联网、不上报、不含遥测。
无人值守与锁屏
锁屏是这台机器的安全基线,插件默认不试图绕过它:/dev/uinput 注入的是真实内核输入事件,在锁屏界面上它与物理键盘没有区别——正因为如此,默认配置下锁屏时插件拒绝一切注入。
锁屏时能做:截图(画面是锁屏本身,通常没用)、读文件、跑命令、写代码、git / npm 等一切非 GUI 工作。
锁屏时不能做:点击、拖拽、滚轮、按键、输入文字、UI 树操作。
desktop_status的session.locked和linux_mcp_doctor的screen-lock项会告诉你当前状态。想让"人不在场"也能做 GUI 任务,干净的方向是给自动化一块独立的虚拟显示器(
org.gnome.Mutter.RemoteDesktop的 virtual monitor,GNOME 46 起可用),由 RemoteDesktop 接口往虚拟屏注入,物理屏保持锁定、你的桌面不被共享。这条路尚未实现,属于后续计划;不会走"关掉自动锁屏"或"存一份登录密码"这两条捷径。
解锁开关(默认关闭)
如果确实希望模型能自己解锁屏幕,有一个显式开关,默认关闭;关闭时 unlock_screen 工具根本不会出现在模型面前(工具列表里没有它,模型也就不知道有这个能力)。
MCP=~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py
python3 -u $MCP --set-unlock-password # 在你自己终端里输入一次,隐藏回显,存进 GNOME 钥匙环
python3 -u $MCP --unlock-status # 查看开关与是否已存密码
python3 -u $MCP --unlock-policy off # 关掉(推荐随手关)
python3 -u $MCP --clear-unlock-password # 从钥匙环删除规则只有三条,但都是硬的:
密码不经过对话、配置文件和日志。它存在 GNOME 钥匙环(libsecret)里,由你本人的终端
getpass写进去;服务器只在unlock_screen被调用的那一瞬间读取,用完立刻丢引用,日志里只有"第几次尝试成功"。解锁是唯一的例外。开关打开后,其它注入工具在锁屏时照旧拒绝;只有一次明确的
unlock_screen调用(还必须带confirm: "unlock"参数)才会去敲密码,成功后会话就是解锁状态,后续操作照常。打开它意味着什么,要说清楚:锁屏从此只挡"坐在键盘前的人",不再挡"以你身份运行的软件"。任何以你账户跑的进程都能从钥匙环读到那个密码——而这本来就是插件已经给你的能力范围。这就是为什么默认关闭、为什么建议用完随手
--unlock-policy off。
密码里如果有中文或其它非 ASCII 字符,注入会失败(/dev/uinput 的键盘设备只能敲有限字符集);这种情况请继续用"回来自己解锁"。
故障排查
Pointer events are ignored
On rare sessions GNOME keeps the virtual pointer device open but stops honouring its motion: keyboard and scroll still work, clicks do nothing.
desktop_statuswithreset_input: truerecreates the devicesif that does not help, reboot the machine (a logout/login is not always enough, because
dsh webcan survive it through systemd user lingering)dsh webitself must run inside the current desktop session: itsDBUS_SESSION_BUS_ADDRESSis inherited, so an old process cannot reach the accessibility bus or the portal any more
python3 -u ~/.local/share/dsh-linux-computer-use/linux_desktop_mcp.py --selftest或在对话里让模型调用 linux_mcp_doctor。逐项报告:会话类型、Python/GI/Atspi/Gst、/dev/uinput、启动器、wl-clipboard、portal 版本、pipewiresrc、截屏授权、显示器、AT-SPI 应用数、GNOME 窗口切换键位绑定(Alt+Tab / Super+Tab 哪个有效),以及正在运行的 server 副本是否与安装的包一致。
兼容性
Ubuntu 24.04 / GNOME 46 / Wayland(主要目标,实测环境)
需要
python3-gi、gir1.2-atspi-2.0、gstreamer1.0-pipewire、gstreamer1.0-plugins-base(Ubuntu 桌面版默认自带)X11 会话可以工作(注入与截屏另有路径),但不是本插件的优化目标
License
MIT
English
Linux desktop automation for DeepSeek Harness on Wayland. Screenshots go through the xdg-desktop-portal Screenshot interface (the only Wayland-legal path, ~0.5s per capture after one granted approval); pointer and keyboard input go straight to /dev/uinput so applications cannot tell them from a real user; the UI tree comes from AT-SPI2. 30 tools are published as mcp__linux__*, plus a linux_mcp_doctor host tool that diagnoses the environment even while the bridge is off. Ships disabled: enable it in Settings → Plugins.
Install: dsh plugin --profile web add dsh-plugin-linux-computer-use, run sudo ./linux-computer-use-prep.sh, restart dsh, then flip the switch.
Known limit: Chromium, Electron and Qt windows expose an empty accessibility tree, so they need screenshot-and-coordinates clicking rather than semantic element actions.
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.
Use a person's computer after they approve it there: files, Terminal, browser, local MCP.
- ezremoteDeprecatedlol.masti.tunnel
Use a person's computer after they approve it there: files, Terminal, browser, local MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables full Linux desktop control including windows, mouse, keyboard, clipboard, audio, screenshots, OCR, accessibility, and system management through MCP-compatible AI agents.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to control a Linux/X11 desktop like a human: see the screen, move the mouse, click UI elements via the accessibility tree, type text, and manage windows.MIT
- AlicenseAqualityDmaintenanceEnables LLMs to capture desktop screenshots and control the mouse and keyboard on Linux, including Wayland, through MCP.111MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to automate a Linux desktop natively on Wayland, with 68 tools for screen capture, input simulation, browser automation, OCR, accessibility, media, audio, clipboard, notifications, filesystem, system, memory, and network operations through the MCP protocol.MIT