screen-mcp
An MCP server that gives a model eyes and hands on a Linux Wayland desktop, enabling screenshot capture, mouse/keyboard control, OCR, and icon detection via OmniParser.
README
screen-mcp
An MCP server that gives a model eyes and hands on a Linux Wayland desktop. Screenshots via PipeWire, pointer/keyboard via the RemoteDesktop portal, OCR + icon detection via RapidOCR + an OmniParser ONNX, an ambient sense layer that diffs frames so the agent knows when something opened / nothing changed, a write-through world-model cache so a recognised screen skips OCR, and an opt-in ack gate that blocks close-combos / destructive-keyword clicks until the caller passes a confirmation token.
Current version: 1.3.2.
Requirements
- Linux + Wayland + GNOME (the awareness layer uses a bundled GNOME Shell extension; AT-SPI is the fallback for GTK apps).
- Python 3.10+ (tested on 3.14).
- GStreamer >= 1.28 (uses
leaky-type; the olderdrop=was removed in 1.28). PipeWire +xdg-desktop-portal-gnome. wl-clipboard(for the Unicode paste path inscreen_type).- A DejaVu Sans Bold font (Set-of-Marks labels; falls back to PIL's default).
Install
System packages first — see requirements.txt for the full
pacman / apt one-liners.
# Arch
sudo pacman -S python-gobject gobject-introspection \
gstreamer gst-plugins-base gst-plugins-good gst-libav \
pipewire pipewire-pulse xdg-desktop-portal-gnome \
wl-clipboard ttf-dejavu
# Python deps
pip install -r requirements.txt
Install the GNOME Shell extension (optional but recommended — gives the awareness layer reliable focused-window + window-list data):
gnome-shell-extension/window-info@local/install.sh
# then enable via gnome-extensions enable window-info@local
Wire it into Claude Code
Add to ~/.claude.json under mcpServers:
{
"mcp-screen": {
"command": "python3",
"args": ["/path/to/mcp-screen/server.py"]
}
}
The first run triggers an xdg-desktop-portal consent dialog (pick which
monitor(s) to share). The portal returns a restore token which is persisted to
~/.config/mcp-screen/token — subsequent runs are silent.
Tools
| Name | What it does |
|---|---|
screen_screenshot |
Capture the desktop. region=[x,y,w,h] or monitor=N to zoom. annotate=true overlays numbered Set-of-Marks + lists click coords. use_cache=true (with annotate) reuses learned elements for a known screen (skips OCR). fresh=true forces a current frame on a damage-driven static monitor (defeats the keepalive-resend stale read) — but it nudges the pointer, so it's used sparingly (auto only right after an unconfirmed action), not on every shot; pass it explicitly if a static-monitor read looks stale. |
screen_list_monitors |
Monitors (origin/size/scale), desktop bounds, focused windows. |
screen_move_mouse |
Move pointer to x,y (view-space default; server maps to real px). |
screen_click |
Click at x,y or in place. button: left|right|middle, double: true. |
screen_scroll |
Wheel scroll. direction: up|down|left|right, amount: notches. |
screen_drag |
Press-drag from (x1,y1) to (x2,y2). |
screen_key |
Press a key/combo: "Ctrl+L", "Enter", "Alt+Tab", "F5". |
screen_type |
Type text (Unicode via wl-copy + Ctrl+V; ASCII via keysyms). enter: true presses Enter after. Keys go to the FOCUSED window — pass focus: "app" or call screen_focus first. |
screen_focus |
Raise + give KEYBOARD focus to a window (app/title/id) so injected keys/clicks land in it. Uses the window-info extension's ActivateWindow when loaded, else the GNOME overview. |
screen_do |
Batched ordered actions in one call. |
screen_tour |
Visit several UI states and get a labeled thumbnail of each. |
screen_read_page |
Auto-scroll a scrollable view in one call; accumulates every interactable. |
screen_wait |
Block until the screen settles, then optionally screenshot. |
screen_session |
Recorder: op=start|stop|list|status|replay-path. |
screen_reload |
Hot-reload the server in place after edits (no /mcp reconnect). |
screen_diag |
Health dump: session/geo, cursor, grounding backends, world-model stats. |
Every action takes space: 'view' \| 'desktop' \| 'norm' (default view — coords
as seen in the last screenshot), shot: true to return a screenshot after,
verify: true to warn on no-screen-change misclicks, force: true to bypass
the user-takeover guard, and element: <id> to click an element id returned by
the last annotate=true shot (server resolves exact coords; no guessing).
Environment variables
| Variable | Effect |
|---|---|
MCP_SCREEN_GUARD=1 |
Enable the reliability ack gate. Destructive combos (Ctrl+W, Alt+F4, cmd+q), OCR-matched destructive keywords (delete/pay/submit/...), and out-of-allowlist actions block unless the caller passes ack=<reason>. |
MCP_SCREEN_APPS="firefox,terminal" |
With guard on, restrict actions to this allowlist of focused apps. |
MCP_SCREEN_AUDIT_FRAMES=1 |
Add pre/post frame hash + changed_bbox to every audit log line. ~100-500ms latency per action. |
MCP_SCREEN_AMBIENT=0 |
Disable the ambient SENSE hint block. |
MCP_SCREEN_GUARD_PX=40 |
Threshold for the user-takeover guard (live pointer vs last-commanded). |
MCP_SCREEN_CPU_THREADS=6 |
ONNX intra-op thread count for OmniParser. |
MCP_SCREEN_MAX_EDGE=2576 |
Screenshot downscale target (long edge). |
MCP_SCREEN_NO_FRESH=1 |
Disable forced fresh-frame capture on static monitors (screenshots may then return the keepalive-resent stale frame). |
MCP_SCREEN_FOCUS_SETTLE_MS=150 |
Delay after screen_focus activates a window (lets the compositor deliver keyboard focus before a following keystroke burst). |
MCP_SCREEN_NO_NUDGE=1 |
Disable the pointer damage-nudge used to prime/refresh a static monitor's frame. |
Data paths
| Path | What |
|---|---|
~/.config/mcp-screen/token |
Portal restore token (one-time consent). |
~/.local/share/mcp-screen/world/map.db |
World-model SQLite cache (per-screen learned elements). |
~/.local/share/mcp-screen/sessions/<sid>/ |
Recorder trajectories + WebP frames + replay.html. |
~/.local/state/mcp-screen/actions.jsonl |
Reliability audit log (one JSON line per action). |
/tmp/screen_err.txt |
Last unhandled tool traceback (dev-diagnostic only). |
Dev workflow
pytest -q # 78 tests, ~0.7s, no live D-Bus needed (conftest stubs)
Edit a .py, then in the running Claude Code session:
screen_reload # re-execs the server in place (preserves the MCP connection)
On any tool exception the dispatcher writes the full traceback to
/tmp/screen_err.txt (the JSON-RPC error only carries the message); read it
when debugging crashes.
Ops notes (hard-won — read before touching capture/input)
- Fractional scaling —
NotifyPointerMotionAbsolutecoords are logical and local to each stream (keyed bynode_id). Don't add a global logical origin; the portal clamps with "Invalid position". Seeinput.global_to_logical. - Cursor position —
cursor_mode=METADATA(4)means the cursor is NOT baked into frames. PipeWire attaches aSPA_META_Cursorto its src pad, butvideoconvertstrips it and PyGObject can't downcast it —capture.pyreads it via actypespad-probe with x86-64 offsets. We composite a marker back into plain screenshots so the pointer stays visible. - User-takeover guard —
input.guard_usercompares the live pointer to where WE last commanded it; >MCP_SCREEN_GUARD_PXpx drift ⇒ caller took the mouse ⇒ STOP. Passforce=trueto bypass / take control back. Fails open if the cursor can't be read. - Unicode typing — the portal keysym path drops non-ASCII;
input.type_textauto-pastes any non-ASCII string viawl-copy+ Ctrl+V, with afinallyrestoring the prior clipboard (orwl-copy --clearif it couldn't be saved) so sensitive text never outlives the call. Falls back to ASCII-only keysyms ifwl-clipboardis absent. xdotool / XTEST can NOT reach native-Wayland apps. - Modifier+letter combos —
input.keylowercases single-letter trailing parts when modifiers are present, so"Ctrl+A"is select-all, not Ctrl+Shift+a (capital-A is the X11 keysym for shifted A). Standalonekey("A")keeps its case for legacy text-input behavior. - GPU is hard-disabled (
CUDA_VISIBLE_DEVICES=""at server top); grounding is CPU-only by design — predictable latency, no driver flake.
Install as a Claude Code plugin
screen-mcp ships as a Claude Code plugin that bundles the MCP server and a
drive-screen skill (the locate → ground → act → confirm loop).
/plugin marketplace add 88plug/screen-mcp
/plugin install screen-mcp@screen-mcp
One-time setup after install (the server has system + Python deps the manifest can't install for you):
# in the installed plugin dir (or a clone)
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
# system packages (Arch/Manjaro names; use your distro equivalents):
# gstreamer>=1.28, pipewire, python-gobject, xdg-desktop-portal-gnome, wl-clipboard
Requirements: Linux + Wayland + GNOME. First run pops an xdg-desktop-portal
RemoteDesktop + ScreenCast consent dialog (token cached at ~/.config/mcp-screen).
Optional: /dev/uinput (group input) for the kernel input backend, and the
bundled GNOME-Shell extension for full window awareness (one-time Wayland re-login).
The launcher (bin/screen-mcp) fails with a clear message if the deps are missing,
so a misconfigured install never silently half-works.
License
FSL-1.1-ALv2 © 2026 88plug — Functional Source License; converts to Apache 2.0 two years after each release.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。