rdp-mcp
by omeyz
README.md
# rdp-mcp
An MCP server that lets Claude Code (or any MCP client) see and drive a Remote
Desktop session on Linux, in a window you can watch and take over. RDP for
Windows and Linux hosts, VNC for Macs and anything else.
Computer use for your other machines, from a Linux desktop:
- **You see everything.** Each session is a real FreeRDP client in a window on
your desktop. The pointer glides to where the model clicks.
- **You can take over.** Use your own mouse and keyboard in the window at any
time. The model is told when the pointer moved since its last action.
- **Shared sessions.** A session lives outside the MCP process, so several
agents can drive the same one and it stays open after the agent exits.
- **Passwords stay out of the model.** A profile names an env var, or a
password box opens on your desktop at connect time. The password goes to
FreeRDP on stdin: never a tool argument, never in the process list.
- **Clipboard.** Text copied on your desktop pastes in the session and back
(RDP hosts; macOS Screen Sharing does not accept a VNC clipboard).
- **HiDPI and resizing.** The window opens at your desktop scale, stays sharp,
and the remote desktop follows when you resize it. The model works in
screenshot pixels either way.
Works on GNOME Wayland (through XWayland) and on X11.
## How it works
```
MCP client ──stdio──> server.py ──XTEST / XGetImage──> Xephyr window ──> xfreerdp ──RDP──> Windows
^
you, watching
```
Xephyr is a small X display shown as a window. FreeRDP runs inside it. The
server injects input with XTEST and reads the screen with XGetImage, so it
never captures your real desktop and never steals your pointer.
## Install
Needs: `xfreerdp` (FreeRDP 3), `Xephyr`, `xauth`, `mcookie`, `zenity`, and
[uv](https://docs.astral.sh/uv/). Optional: `remote-viewer` for VNC hosts,
`xclip` for the clipboard bridge.
```sh
# Fedora
sudo dnf install freerdp xorg-x11-server-Xephyr xorg-x11-xauth zenity virt-viewer xclip
# Debian / Ubuntu
sudo apt install freerdp3-x11 xserver-xephyr xauth zenity virt-viewer xclip
git clone https://github.com/omeyz/rdp-mcp && cd rdp-mcp && uv sync
claude mcp add --scope user rdp -- "$PWD/.venv/bin/python" "$PWD/server.py"
```
## Hosts
`~/.config/rdp-mcp/hosts.toml`, one block per machine (see
[`hosts.example.toml`](hosts.example.toml)):
```toml
[db01]
host = "10.0.0.25"
user = "Administrator"
domain = "CORP"
# no password_env: a password box opens on your desktop when connecting
```
Then ask: *"connect to db01 and open Event Viewer"*. Partial names match.
### Macs (VNC)
```toml
[macbook]
protocol = "vnc"
host = "macbook.local"
```
On the Mac: System Settings → General → Sharing → turn on Screen Sharing. If
Remote Management is on instead, open its (i) → Options… and tick **Observe**
and **Control** for your user, or sign-in is refused. Sign in with your Mac
account name and password. `cmd` is the Command key in `rdp_key`.
## Tools
| Tool | What it does |
|---|---|
| `rdp_hosts` | List profiles and open sessions |
| `rdp_connect` | Open (or rejoin) a session, return a screenshot |
| `rdp_screenshot` | Current screen, optional wait |
| `rdp_click` | Left / right / middle click, double click |
| `rdp_move`, `rdp_drag`, `rdp_scroll` | Hover, drag, wheel |
| `rdp_type` | Type text |
| `rdp_key` | Keys and chords: `ctrl+alt+delete`, `win+r`, `tab tab enter` |
| `rdp_disconnect` | Close the window (Windows keeps the user signed in) |
Every action returns a fresh screenshot once the screen settles.
## Limits
- `rdp_type` types as a US keyboard: US-keyboard characters only.
- The clipboard bridge is text only, and does not reach Macs.
- VNC sessions are scaled to the window, so text is a little soft.
- Certificates are trust-on-first-use by default (`cert = "tofu"`).
- State and logs live in `~/.local/state/rdp-mcp/`.
## Safety
This gives a model the mouse and keyboard of whatever account you sign in
with. Watch it, use the least-privileged account that does the job, and keep
your MCP client's tool approvals on for machines that matter.
MIT license.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues