Claude KVM

πŸ‡ΊπŸ‡Έ  πŸ‡ΉπŸ‡·

Claude KVM

Remote Access, Artificial Intelligence

claude-kvm.ai

Claude KVM is an MCP server that lets an agent see and operate a remote desktop over VNC: screenshots, mouse, keyboard and on-device text detection. It runs on macOS with Apple Silicon and connects to any VNC server, including macOS Screen Sharing. ## How it is built | Part | What it does | |---|---| | `claude-kvm-daemon serve` | The service. Holds one VNC connection per target and shares it between sessions. | | `claude-kvm-daemon mcp` | The MCP server of one session, on stdin and stdout. Talks to the service over a Unix socket only you can open. | | `claude-kvm` (this npm package) | A launcher: finds the daemon and runs `claude-kvm-daemon mcp`. It holds no connection and reads no credentials. | A target is a named **profile**. Sessions name the profile they use; host, username and password never appear in an MCP configuration. ## Install Requirements: macOS 15 or later on Apple Silicon. Node.js 18 or later only if you use the npm launcher. ```bash brew install ARAS-Workspace/tap/claude-kvm-daemon ``` ## Set up 1. Create a profile. The password is asked for without echo and kept in your login keychain. ```bash claude-kvm-daemon profile add office-mac --host 192.168.1.20 --username me ``` 2. Check it. ```bash claude-kvm-daemon profile test office-mac ``` 3. Install the service, so that it starts when a session connects and exits when none is left. ```bash claude-kvm-daemon service install ``` The first time the service reaches a machine on your local network, macOS asks whether to allow it. Until you allow it, the connection is retried. To run the service in a terminal instead, skip this step and use `claude-kvm-daemon serve`. 4. Add the server to your MCP client, naming the profile. ```json { "mcpServers": { "claude-kvm": { "command": "npx", "args": ["-y", "claude-kvm"], "env": { "CLAUDE_KVM_PROFILE": "office-mac" } } } } ``` Without Node.js, name the daemon itself: `"command": "/opt/homebrew/bin/claude-kvm-daemon"`, `"args": ["mcp"]`. ## Tools | Tool | Purpose | |---|---| | `vnc_command` | One action on the target. | | `action_queue` | Up to 20 actions in order; stops at the first that fails. It returns text only, so it takes every action except `screenshot`, `cursor_crop` and `detect_elements`. | | `status` | Connection state, display size, who controls the target. | | `reconnect` | Connect again now, for instance after a password was corrected. | | `take_control` | Take over mouse and keyboard from another session. | | `configure` | Show or change the screenshot size of this session and the input timing of the target. The timing is the target's, for every session on it, and changing it takes control like any input; `reset` restores the defaults. | Actions of `vnc_command`: | Kind | Actions | |---|---| | Screen | `screenshot`, `cursor_crop`, `diff_check`, `set_baseline`, `detect_elements` | | Mouse | `mouse_click`, `mouse_double_click`, `mouse_move`, `hover`, `nudge`, `mouse_drag`, `scroll` | | Keyboard | `key_tap`, `key_combo`, `key_type`, `paste` | | Other | `wait` | When a session starts, the server also tells the agent how the tools go together: to look before and after acting, what to leave to you (a refused password, the Local Network permission, lock screens), and not to take control from another session unless you ask. Coordinates are in the session's scaled view of the display (longest side 1280 pixels unless changed). `detect_elements` reads text with Apple Vision on your Mac; no image leaves it. On a macOS target `paste` types the text, because Apple's VNC server does not accept a pasted clipboard. The daemon knows a target is macOS when it signs in with a username, as Screen Sharing does. ## Several sessions, one target Sessions whose profiles name the same target, that is the same host, port and username, share one connection, whether they name one profile or several. All of them can look; one at a time sends input. The first to send input controls the target, loses control after 30 seconds without input, and `take_control` moves it at once or, during a running gesture, after at most ten seconds. What `diff_check` compares with, set by `set_baseline`, is the target's as well. A session that stops reading what the service sends it is dropped after five seconds, so that it cannot hold up the others. ## How it runs Three things take part, and each is one command of the same program. **The service** (`serve`) is the only part that talks to a VNC server. It listens on a Unix socket in your home directory and holds one connection per target. It opens a connection when the first session asks for a profile, keeps it while any session uses it, and closes it 60 seconds after the last one left. A connection that drops is tried again at growing intervals, from one second up to thirty, for as long as a session is using the target; a target that stops answering is noticed in about thirteen seconds, and one that accepts the connection and says nothing, or stops in the middle of a message, is taken for lost when the profile's connect time is up. A refused password is not tried again until you correct it. There are two ways to have the service running, and they are equal: profiles, passwords and sessions work the same in both. | | Installed (`service install`) | In a terminal (`serve`) | |---|---|---| | Starts | By itself, when a session connects | When you run it | | Stops | By itself, ten seconds after nothing needs it | With Ctrl-C | | Needs a terminal | No | Yes, for as long as it runs | | Log | `service log` | The terminal, with `--log` | | Local Network permission | Asked once, for the daemon | Your terminal's own | **A session's MCP server** (`mcp`) is started by your MCP client, one per session, and speaks MCP on its standard input and output. It connects to the service's socket, names the profile from `CLAUDE_KVM_PROFILE`, and translates tool calls. It never talks to the network and holds no password. If the service is not there, it keeps looking for it and tells the agent how to start it. **Profiles** (`profile`) are yours and do not depend on the service: you can create, change and remove them whether the service is installed, running in a terminal, or not running at all. The service reads a profile when a session asks for it. ## Commands Every command also explains itself with `--help`. ### `profile`: the targets A profile is a name for a target and how to treat it. The name is 1 to 64 letters, digits, `.`, `_` or `-`, and does not start with `.` or `-`. ```bash claude-kvm-daemon profile add --host [options] claude-kvm-daemon profile set [options] claude-kvm-daemon profile list claude-kvm-daemon profile show claude-kvm-daemon profile test claude-kvm-daemon profile remove ``` | Command | What it does | |---|---| | `add` | Creates the profile, then asks for the password without echo and stores it in your login keychain. | | `set` | Changes the fields given and leaves the rest. `--password` asks for a new password. | | `list` | Lists the profiles and their targets. | | `show` | Shows one profile. It says whether a password is stored, never the password. | | `test` | Connects once and reports the display size, or why it could not connect. | | `remove` | Removes the profile and its password. | | Option of `add` and `set` | Meaning | Default | Range | |---|---|---|---| | `--host` | Hostname or address of the VNC server | required for `add` | | | `--port` | Its port | 5900 | 1–65535 | | `--username` | Username, where the server asks for one (macOS does) | none | | | `--max-dimension` | Longest side of a screenshot, in pixels | 1280 | 320–8192 | | `--idle-timeout` | Seconds the connection stays open after its last session | 60 | 0–86400 | | `--connect-timeout` | Seconds one connection attempt may take | 10 | 1–120 | | `--control-idle` | Seconds a session keeps control without sending input | 30 | 5–3600 | | `--password-stdin` | Read the password from standard input, for scripts | | | | `--no-password` | The server asks for no password | | | A changed profile reaches a running service the next time a session connects. `--idle-timeout`, `--control-idle` and `--max-dimension` count from then on; `--connect-timeout` and a new password with the next attempt to connect. A new host, port or username names another target: sessions that connect from then on go there, and those already connected stay where they are. `--no-password` on `set` forgets the stored password. ```bash claude-kvm-daemon profile add office-mac --host 192.168.1.20 --username me claude-kvm-daemon profile set office-mac --password claude-kvm-daemon profile set office-mac --max-dimension 1600 --control-idle 120 ``` ### `service`: the installed service ```bash claude-kvm-daemon service install claude-kvm-daemon service status claude-kvm-daemon service log [--follow] [--lines ] [--clear] claude-kvm-daemon service print claude-kvm-daemon service uninstall ``` | Command | What it does | |---|---| | `install` | Copies the program to `~/Library/Application Support/claude-kvm/bin/`, writes the launchd agent `~/Library/LaunchAgents/com.claude-kvm.daemon.plist` and loads it. Run it again after an update, so that the service runs the new version. | | `status` | Says whether the agent is installed, and whether the service is running or waiting for a session. | | `log` | Shows the last 50 lines of the service's log: each connection, failure, retry and refused password, with date and time. `--follow` keeps showing what is added until Ctrl-C; `--lines` sets how many lines; `--clear` empties the log, also while the service is running. | | `print` | Prints the agent's plist as `install` would write it. Changes nothing. | | `uninstall` | Stops the service and removes the agent, the copy and the socket. Profiles, passwords and the log stay; remove a profile and its password with `profile remove`. | `uninstall` removes the copy whichever program runs it. Run it from the program you installed with: run from the copy, it leaves you without that program if you have no other. The log never holds a password. The service keeps it from growing: when it starts, and every hour while it runs, a log larger than one megabyte is cut to its newest half megabyte. `service log --clear` empties it at once. For every VNC handshake, run the service in a terminal with `serve --trace` instead. ### `serve`: the service in a terminal ```bash claude-kvm-daemon serve [--log] [--trace] [--socket ] [--idle-exit ] ``` Runs the same service in the foreground until Ctrl-C. Use it instead of `service install` when you want to watch what happens or do not want anything installed. | Option | Meaning | |---|---| | `--log` | Write what the service does to the terminal: connections, failures, retries. | | `--trace` | Also write every VNC handshake. Implies `--log`. | | `--socket` | Listen on another socket. Sessions must then be started with `mcp --socket` and the same path. | | `--idle-exit` | Exit after this many seconds without a session or a target. Without it the service stays. | While the service is installed, launchd holds the default socket and `serve` refuses to take it; uninstall the service first, or name another `--socket`. The other way round, `service install` refuses while a `serve` in a terminal is listening there. Nothing stops a second `serve` on a socket a first one holds: it takes the socket over, so run one. ### `mcp`: the MCP server of a session ```bash CLAUDE_KVM_PROFILE= claude-kvm-daemon mcp [--socket ] ``` You do not run this yourself; your MCP client does, as the configuration in [Set up](#set-up) says. It needs `CLAUDE_KVM_PROFILE`; without it every tool call answers with how to name a profile. `--socket` names the service's socket when `serve` was given another one. The npm package `claude-kvm` only finds the daemon and runs this command. It looks, in order, at `CLAUDE_KVM_DAEMON_PATH`, the copy the installed service runs, `/opt/homebrew/bin`, and `PATH`. It stops with a message when the Mac is not Apple Silicon, when no daemon is found, or when the daemon it found is older than version 2. It passes no options on: for a service on another socket, name the daemon itself with `"args": ["mcp", "--socket", ""]`. ## Where things are | Path | Content | |---|---| | `~/Library/Application Support/claude-kvm/profiles.json` | Profiles, without passwords | | Login keychain, service `claude-kvm` | One password per profile, under the profile's name | | `~/Library/Application Support/claude-kvm/daemon.sock` | The service's socket, yours only | | `~/Library/Application Support/claude-kvm/bin/` | The copy of the program the installed service runs | | `~/Library/LaunchAgents/com.claude-kvm.daemon.plist` | The agent of the installed service | | `~/Library/Logs/claude-kvm/daemon.log` | Log of the installed service; read it with `service log` | A password is never given on a command line, in an environment variable or to the agent. ## Coming from 2.x Version 2 read `VNC_HOST`, `VNC_PORT`, `VNC_USERNAME` and `VNC_PASSWORD` from the MCP configuration. Version 3 does not: create a profile, set `CLAUDE_KVM_PROFILE`, and remove those variables. A session that still carries them is told the exact `profile add` command. The 2.x line stays on the [`archive/v2.0.12`](https://github.com/ARAS-Workspace/claude-kvm/tree/archive/v2.0.12) branch and as `claude-kvm@2.0.12` on npm. ## Licence This launcher is MIT licensed, see [LICENSE](LICENSE). It runs the daemon as a separate program and contains none of its code. The daemon is licensed under GPL-3.0-or-later; its source is on the [`daemon-tool`](https://github.com/ARAS-Workspace/claude-kvm/tree/daemon-tool) branch.