virtual-nanokvm
A software KVM for macOS. It lets an AI agent, or a script, use your Mac's mouse and keyboard the way a person does, and lets you watch and control the Mac from a browser.
Inspired by the Sipeed NanoKVM, but with no extra hardware: it runs locally on the Mac it controls.

How it works

One human-like input engine, two input paths:
| Input | How it reaches macOS | Setup |
|---|
sys | Synthetic system events (CGEventPost) | Accessibility permission only |
driver | Virtual USB keyboard and mouse (Karabiner-DriverKit-VirtualHIDDevice); macOS sees real hardware | Driver install plus a small root bridge |
Human-like movement
A move never jumps, and no two moves are the same. Each one has:
- a curved path that bends to one side, like a wrist arc
- a natural speed: slow start, fast middle, slow finish
- Fitts's law timing: longer for far or small targets
- an overshoot and correction on some long moves
- a slight tremor that fades near the target
The pace is adjustable. speed on act and the mouse and key tools sets it for one call: 1 is a typical person (the default), 2 twice as fast, 0.5 half as fast, from 0.25 to 5. VNKVM_MOUSE_SPEED (or --speed) changes the default. Paths keep their shape, and grabbing the mouse still stops vnkvm. Typing keeps its own words-per-minute pace.


Around the target, behavior varies too. Some moves overshoot and come back, some fall short and finish with a second stroke, and long ones sometimes detour. Before a click the hand dwells, sometimes longer, sometimes with a tiny wobble. After a click it often drifts a few points away. Clicks, scrolling and typing get human timing too. If you grab the mouse mid-action, vnkvm stops, releases every key and button, and reports user took control.
Install
One line (macOS 14+). It installs Go if needed (with Homebrew), builds vnkvm, links it to ~/.local/bin, and runs a setup check:
curl -fsSL https://raw.githubusercontent.com/Lucklyric/virtual-nanokvm/main/install.sh | bash
Add -s -- --claude --codex after bash to install the agent plugins in the same step. Run vnkvm doctor at any time to see what is missing; vnkvm doctor --fix raises the macOS permission dialogs.
As an agent plugin
Claude Code
/plugin marketplace add Lucklyric/virtual-nanokvm
/plugin install vnkvm@virtual-nanokvm
Codex
codex plugin marketplace add https://github.com/Lucklyric/virtual-nanokvm.git
codex plugin add vnkvm@virtual-nanokvm
Both install the MCP server and a vnkvm skill that teaches the agent the screenshot → act → check loop. The server builds itself on first start (Go and the Xcode command line tools are needed; the one-line installer sets them up). Re-running the installer with --claude or --codex also updates the plugins. Then run /vnkvm:setup in Claude Code, or ask Codex to "run the vnkvm doctor": it checks and requests the Accessibility and Screen Recording permissions for the app running the agent. Set VNKVM_INPUT=driver to use the driver input instead of sys.
Any other MCP client
git clone https://github.com/Lucklyric/virtual-nanokvm.git
virtual-nanokvm/scripts/vnkvm-mcp # MCP server on stdio
The one-line installer also links the launcher as ~/.local/bin/vnkvm-mcp. Point MCP clients and scripts at that path: it stays the same across updates, and plugin cache paths do not.
| Tool | Does |
|---|
screenshot | A low-detail look at the screen or one app window (even when covered), or a sharp zoom of part of an earlier shot, optionally with a crosshair where a click would land |
act | Up to 20 planned actions in one call (move, click, type, key, hold, menu, scroll, drag, wait, expect), or a saved recipe, then a new low-detail look once the screen settles |
list_windows | App windows with ids and positions |
mouse_move, click, drag, scroll, type_text, key | Single actions, with an optional look afterwards |
lessons | Per-app rules on what made tasks slow and what worked, versioned and measured per task, kept on this Mac |
recipes | Saved sequences that worked in an app, replayed with one act call, kept on this Mac |
cursor_position | Where the cursor is |
doctor | Checks permissions, display, capture path, driver input and Tailscale |