
shotbox
io.github.mishan由 GitHub 账号 mishan 发布v0.11.0更新于 Nov 6, 2026
Sealed X11/Wayland sessions to see, drive and check real GUI programs: a11y, pictures, sound.
概览
在封闭的 X11 或 Wayland 会话中运行图形程序,让助手通过 MCP 查看、操作并测量它们。
- 可以做什么
- 启动封闭会话,并从 NAME = COMMAND 白名单中启动程序
- 读取无障碍树并截图,截图以图像形式返回
- 按节点名称点击、按键、输入文字、移动指针并操作虚拟手柄
- 等待窗口出现、画面静止、无障碍播报或节点出现
- 检查无障碍问题、测量对比度、遍历 Tab 顺序,并与参考图比较像素差异
- 录制会话的视频和声音,并检查音频中断的位置
- 适用场景
- 适合助手需要在真实图形界面中验证自己的改动、试玩测试游戏、审查屏幕阅读器能听到什么,或在可重复的会话中复现缺陷,同时不让窗口和声音出现在用户桌面上。
- 运行要求
- 以本地 stdio 进程运行(PyPI 包 shotbox),需要 Linux 桌面。依赖 Xvfb、xauth、dbus-daemon、ImageMagick、AT-SPI 相关库、ffmpeg、bubblewrap 等系统工具;Wayland 会话还需 sway、grim 和 wf-recorder。mcp 命令需用 --allow 指定允许助手启动的程序清单。未声明任何 API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 shotbox,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
shotbox
[图片]Eyes, ears and hands on a real graphical program, for an AI agent, a script or CI.
An agent working on a program with a window can't see it or hear it.
shotbox runs the program in a sealed session of its own, X11 or Wayland,
and lets whatever is driving it look, listen and act: read the accessible
tree, take screenshots, record what it plays, click by a button's name,
type, hold keys and gamepad buttons, and wait until the program is
actually ready. Then measure what it finds: names a screen reader can't
say, contrast, the Tab order, pixels changed against a reference, where
it flickers, how fast it follows the pointer, where its sound drops out,
and what it used.
Nothing it runs reaches your desktop or speakers by accident, and with
--net loopback, not your network either.
Made with shotbox: each scene is a play script in a sealed
session, recorded by shotbox record. With sound.
Without an agent, it's the same session from the command line:
Worked examples, from checking a change to a game's smoke test: docs/recipes.md. How it differs from other tools that drive a GUI: docs/comparison.md.
For agents
shotbox mcp --allow PROGRAMS gives an agent sealed sessions over the
Model Context Protocol (stdio). It can start a session, spawn programs
from the list in PROGRAMS (NAME = COMMAND a line, and nothing else),
and then:
- read the accessible tree, and take screenshots, which come back as images;
- click by a node's name, press keys, type and work a gamepad;
- wait for windows, stillness and announcements;
- lint, measure contrast and walk the Tab order;
- record what a session plays, and hear where it dropped out.
That's enough for an agent to check its own change in a GUI, test a game by playing it, audit what a screen reader hears, or reproduce a bug report in a session that's the same each time. The accessible tree is the cheap way to look, a thousand or two tokens of text; a screenshot is for what only pixels say. An agent can't run anything off the list, and its sessions stop when the server does.
What it's for, the tools, and how it's built: docs/mcp.md.
An agent that runs a program itself, from its shell, runs it on your
desktop: a window opens on your screen, a sound plays through your
speakers, a browser run under xvfb-run finds your Wayland display all
the same. To keep it in a session, put this in the project's CLAUDE.md
or AGENTS.md, or your own:
Why
An agent checking its change, a screenshot for a README, and a test in CI all want the same things, and every project was growing its own copy:
- Sealed. Nothing of yours leaks in by accident, and nothing the program does reaches your desktop or speakers, where bubblewrap can make a sandbox (it says when it can't): What's sealed.
- Ready, not slept. Waits are for things: a window mapped, a port open, a
file written, text on a terminal's screen, or the picture holding still.
No
sleep 6and hope. - Deterministic. X11 on Xvfb, GTK's software renderer,
LANG=C.UTF-8,TZ=UTC, text carets that don't blink (GTK's, Qt 6.5's, browsers'; and GTK's animations off), GTK 4's text drawn at its color, as its manual font rendering does, not fainter by however much a GTK release's automatic one draws it (more), and PNGs with no timestamps in them. It's the same every time, not the same as a desktop: differences from a desktop. - Cleaned up. Every program runs in its own process group, and the group is killed on the way out: signalling a wrapper script alone leaves its children running.
Install
On Debian, with what every command and option can use:
--system-site-packages lets it see the system's PyGObject, which
shotbox term and --a11y use; pip install shotbox works too. Or run
it from a checkout: ln -s "$PWD/bin/shotbox" ~/.local/bin/shotbox.
shotbox doctor says what's here and what's missing, a line each, and
how to get it. What each command and option needs:
Needs.
No Python packages: it's the standard library and those tools. Wayland sessions need more; see Wayland.
In a GitHub Actions job on Ubuntu, the Action installs it and what it runs, as of the release (or branch) it's used at, with what each feature needs asked for by name (all off unless set), and lets bubblewrap make its sandbox, which Ubuntu's AppArmor holds back:
A quick tour
Commands
The options sessions take, --wayland, --a11y, --audio,
--gamepads, --net loopback, --identity, --clock, --dark and
the rest: Session options.
What's sealed
A session keeps a program from reaching your desktop by accident, not one that sets out to:
- Its environment is rebuilt from an allowlist;
HOMEand every XDG directory are a scratch dir. - Its display, session bus and system bus, and with
--a11yand--audioits accessibility bus and sound server, are its own; the sound server plays to nowhere. It has no printers (but CUPS on localhost:631, unless--net loopback).--machine-busgives it the machine's system bus and printers. - Where bubblewrap can make a sandbox (it says when it can't), nothing reaches the machine's sound devices or your desktop's Wayland, PulseAudio, PipeWire and bus sockets.
- Your network is reachable unless
--net loopback, your user and host name show unless--identity, and the real time unless--clock. - Not sealed: the files outside the scratch home, your X server, and other processes.
All of it, and what each option covers and doesn't: docs/sealed.md.
Accessibility
--a11y starts an accessibility (AT-SPI) bus of the session's own, so
what a screen reader would hear can be read and checked. Without it, a
session has none: GTK is told not to look. Your desktop's bus is never
touched either way.
shotbox a11y prints the tree, lints it for what has no name to say,
walks the Tab order, clicks by name and measures contrast, shotbox wait announce waits for what's announced, and shotbox wait node for a
node to show; for GTK, Qt, AccessKit's
toolkits and Chromium. The commands, how it's put together, and what
each check can and can't tell: docs/accessibility.md.
Wayland
--wayland makes a session a Wayland one: the program runs under a
headless sway, drawing in software, instead of on Xvfb. --xwayland adds
an Xwayland to it, and DISPLAY, so an X client runs the way it does on a
Wayland desktop, GTK programs made to with --env GDK_BACKEND=x11.
Needs sway and grim, Xwayland for --xwayland, and wf-recorder
for record: sudo apt install sway grim xwayland wf-recorder. Why
sway, how it fits, and what differs from X11:
docs/wayland.md.
Docs
- Commands: every command and session option, what each needs, resource use and the clock
- What's sealed
- Recipes: worked examples
- How it compares with other tools that drive a GUI
- MCP: the tools an agent gets, and how they're built
- Accessibility
- Wayland
- Differences from a desktop: drawing, window manager, animations, language, scale, input, measurements
- Gamepads
- Python:
shotbox.Sessionandhere(), for a script that drives the display itself - Node: helpers for browser checks with Playwright
- Mutation testing:
shotbox mutate, its changes, verdicts and limits - Contributing: the tests
- Code of conduct, security and accessibility
- Releasing
- Changelog
License
MIT. See LICENSE.
来源:README.md,提交 3e642e9
工具
0版本历史
7- v0.11.0最新Nov 6, 2026
- v0.10.0Oct 23, 2026
- v0.9.0Oct 19, 2026
- v0.8.0Oct 18, 2026
- v0.7.1Oct 17, 2026
- v0.7.0Oct 17, 2026
- v0.6.0Oct 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分