Skip to main content
Glama
Remote Desktop MCP

Remote Desktop MCP

by lufecito
README.md
# Remote Desktop MCP

A Model Context Protocol (MCP) server for remote desktop control (Local, RDP, VNC, ADB). This allows AI models like Claude to see and interact with your desktop.

> **Linux fork** of [WangYihang/remote-desktop-mcp](https://github.com/WangYihang/remote-desktop-mcp),
> adding a native Wayland backend for local desktop sessions (see [Wayland support](#wayland-support)).

![](./examples/recordings/demo.gif)

## Features

- **Screenshots**: Let the AI "see" your screen.
- **Interactions**: Mouse clicks, movement, scrolling, and keyboard typing.
- **Protocols**: Native support for Local Desktop, RDP, VNC, and Android Devices via ADB.
- **Recording**: Capture desktop sessions as video for demos, debugging, and trace replay.

## Wayland support

On Wayland sessions (`mcp local`) the server uses the
[xdg-desktop-portal RemoteDesktop](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.RemoteDesktop.html)
API instead of `mss`/`pyautogui`, because X11 input injection and root-window
capture never reach Wayland-native windows.

- The first run shows the desktop's remote-control permission dialog. The grant
  is remembered through a single-use restore token stored in
  `$XDG_STATE_HOME/remote-desktop-mcp/portal-restore-token`.
- Screenshots prefer `spectacle` (KDE), then `grim`, then the Screenshot portal.
- Coordinates are given in screenshot pixels, exactly like the X11 backend.
- The bridge needs PyGObject (`gi`) in a system interpreter; the server finds one
  automatically. If no interpreter or portal is available, the session falls back
  to the X11 implementation.

Force a backend with `REMOTE_DESKTOP_BACKEND=wayland|x11|auto` (default `auto`).

## Install

This fork is not on PyPI — `uvx remote-desktop-mcp` would install the upstream
package **without** the Wayland backend. Install from this repository instead:

```bash
uv tool install --from git+https://github.com/lufecito/mcp-remote-desktop-linux remote-desktop-mcp
```

The `remote-desktop-mcp` executable then lands in `~/.local/bin`.

## Quick Start

Register the server with your MCP client.

```bash
# OpenCode (global)
opencode mcp add remote-desktop --global -- remote-desktop-mcp mcp local

# Claude Code
claude mcp add remote-desktop -- remote-desktop-mcp mcp local

# Gemini CLI
gemini mcp add remote-desktop uvx --from git+https://github.com/lufecito/mcp-remote-desktop-linux remote-desktop-mcp mcp local
```

Other protocols work the same way — swap `local` for `rdp`, `vnc`, `adb` or
`playwright`, and pass the connection settings as environment variables:

```bash
# RDP (needs Xvfb and FreeRDP: pacman -S xorg-server-xvfb freerdp,
#      or apt install xvfb freerdp3-x11)
remote-desktop-mcp mcp rdp \
  --host 10.0.0.10 --user ubuntu --password ubuntu

# VNC
REMOTE_DESKTOP_VNC_HOST=127.0.0.1:5900 \
REMOTE_DESKTOP_VNC_PASSWORD=password \
  remote-desktop-mcp mcp vnc

# Android over ADB
remote-desktop-mcp mcp adb --serial emulator-5554
```

Add `--record` to any of them to capture the session as video; files land in
`.logs/sessions/<timestamp>_<protocol>/` next to where the server runs.

### First start on Wayland

The desktop asks for remote-control permission the first time. That dialog blocks
the server's startup, so give your client a startup timeout well above 30 seconds
— for OpenCode:

```jsonc
{
  "mcp": {
    "servers": {
      "remote-desktop": {
        "type": "local",
        "command": ["remote-desktop-mcp", "mcp", "local"],
        "timeout": { "startup": 600000 }
      }
    }
  }
}
```

After the grant is stored in `$XDG_STATE_HOME/remote-desktop-mcp/portal-restore-token`,
later starts are immediate.

## Development

```bash
uv sync
uv run pytest          # unit tests for the coordinate, keysym and PNG helpers
```

## Credits

Fork of [WangYihang/remote-desktop-mcp](https://github.com/WangYihang/remote-desktop-mcp) (MIT).
The original code, examples and recordings belong to its authors; this fork adds
the Wayland backend described above.