Purpose
ClawTouch MCP is a standalone Python process that implements the Model Context Protocol (MCP) over stdio, exposing a real USB-HID keyboard/mouse (Raspberry Pi Pico 2) as MCP tools for use by any MCP-compatible client, such as Claude Desktop, Cline, Continue, Cursor, OpenClaw, Hermes Agent, and others. Its goal is to enable AI agents to move a real mouse and press real keys through a real hardware HID device, rather than software-injected synthetic events.
Main capabilities
- Provides basic mouse/keyboard operations: hid.click, hid.type, hid.scroll, key combinations, hid.screenshot, and more.
- At the low level, it communicates with the ClawTouch HID device (a Raspberry Pi Pico 2 running the open-source ClawTouch HID firmware, or any ClawTouch finished box) over a USB serial port, converting each tool call into real USB HID reports.
- The target operating system recognizes it as an ordinary physical keyboard/mouse, and input goes through the standard HID driver path, with no need to install a mouse/keyboard driver or HID agent process on the target side.
- By default, it registers 14 HID input tools plus 2 read-only device diagnostic tools; with --allow-screenshot, hid.screenshot and screen.windows can additionally be enabled, for 17 tools in total.
- Coordinates and behavior: clicks/moves/hovers use absolute coordinates by default; the server queries the operating system cursor position (Win32/CoreGraphics/X11), computes the offset, and sends relative deltas so that {"x": 640, "y": 360} lands on the corresponding screen pixel; passing relative=true skips the query and directly sends raw pixel deltas. When the operating system cursor position cannot be read (such as on Wayland or when the query fails), a clear error is returned, and it will not silently guess the click position. hid.drag consists of mouse_button_down → sliding movement → mouse_button_up. v1.1's held key/button operations (mouse_button_*, key_press/key_release, hold_key) map to the Computer-Use Anthropic (CUA) action set. hid.batch can execute ≤10 preplanned actions in sequence within a single call. Consecutive clicks automatically have an interval of about 50 milliseconds by default, which can be overridden with delay_ms (set to 0 to cancel).
- Tool selection guidance: the server provides an MCP instructions field in the initialize response and adds HID_PREFIX before each hid.* description, prompting the agent to use hid.* only as a fallback when no file/browser/operating system API can complete the task or when the user explicitly requests physical keyboard/mouse input. The read-only device.* tools do not carry this prefix.
- v0.2.3+ automatically detects the primary display's physical pixel dimensions at startup, and coordinates are clamped to the actual screen rather than a hardcoded 1920x1080; the detection result can be viewed through the MCP client's device.info (screen.source is "detected" / "explicit" / "unset").
Usage
With Claude Desktop
Add the configuration to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), and restart Claude Desktop. After that, clawtouch will appear in the MCP server list, providing 16 tools (14 HID + 2 device; if --allow-screenshot is passed, 2 more are added, enabling hid.screenshot and screen.windows).
Other MCP clients
examples/integrations/INTEGRATIONS.md provides copyable configurations for 7 verified clients (Claude Desktop / Code, Cursor, OpenClaw, Hermes Agent, ChatGPT Desktop / Codex CLI, Cherry Studio, Trae IDE).
Platform-specific installation guide (recommended for first installation)
- Windows: docs/windows-setup.md, covering dual COM port enumeration, VS Code Claude extension .mcp.json configuration, the need for a full window restart, and display scaling considerations.
- macOS: docs/macos-setup.md, covering the Keyboard Setup Assistant dialog on first plug-in, dual USB-CDC ports, screen recording permission, and pinyin input method punctuation issues.
Deployment modes
- Local mode (common case): the agent + clawtouch-mcp + Pico + the controlled screen are all on the same PC. hid.screenshot captures the same screen, so the visual feedback loop closes naturally; the Pico is a standard USB HID device and needs no driver. Suitable for accessibility, standalone RPA, compatibility testing, and on-machine self-service terminals.
- Agent on another machine: the board receives commands through its USB CDC data channel (the same cable that carries keyboard and mouse), so it always acts on the machine it is plugged into, and clawtouch-mcp also runs on that machine. The agent can still run elsewhere: have the MCP client start clawtouch-mcp on the target machine through a supported transport (for example, an SSH command). Key presses, typing, and relative mouse movement work the same as locally. Absolute clicks and movement require reading the cursor position, and hid.screenshot requires reading the screen, so the server must run inside a logged-in desktop session on the machine—a plain SSH login usually is not: on Linux you need to set DISPLAY (and XAUTHORITY) for the desktop X server; on Windows, an OpenSSH session is outside the interactive desktop, so the server must be started from within the session; on macOS it works once screen recording permission is granted. This firmware does not provide a way to drive a machine on which nothing at all is running.
Applicable scenarios
- Self-service terminals/locked-down machines: no need to install or keep running an input driver or input agent; the board is a standard USB keyboard and mouse (clawtouch-mcp itself runs on that machine).
- Accessibility: let users operate their own computer by having the agent issue HID commands, avoiding compatibility issues with synthetic input across applications.
- Compatibility testing: verify softcorrectly handle external HID input, whose behavior may differ from injected synthetic events.
- Test rig: an agent-driven development laptop running the clawtouch-mcp test machine (e.g., started via SSH).
Limitations
- Not suitable for bulk account creation/multi-account operations: a single-host tethered peripheral structure is inherently unsuitable; one device can drive only one target, and driving ten machines requires purchasing ten devices.
- Not suitable for application-specific scripted shortcuts (selectors, fixed-procedure scripts for specific websites or apps); those should belong to an agent/RPA framework built on top of this primitive layer.
- For standard desktop applications (browsers, IDEs, office suites), a pure software path is already sufficient; hardware is merely an extra option rather than a necessity.
- Runtime safety limits: coordinates are clamped to --screen WxH; the input text per call is capped at 4096 characters; hid.type applies only to ASCII/US keyboard layout text, control characters are stripped by default, and non-ASCII characters (CJK, emoji, curly quotes) are rejected before input; all operations are rate-limited to --ops-per-sec (default 20), which is flood/accidental-touch protection, not security throttling; hid.screenshot is disabled by default and requires passing --allow-screenshot; hid.release_all can serve as an emergency stop tool.
- Once an autonomous agent is connected, its operating authority over this machine is equivalent to that of a person sitting at the keyboard: it can open any application, run commands in the terminal, install or remove software, and read/move/delete files. Because input arrives as ordinary HID, confirmation prompts themselves are not a reliable barrier. Unintended operations may occur due to prompt injection, model errors, or excessive autonomy. It is recommended to use a dedicated wipeable machine (or VM/container), run under a least-privilege account, keep no secrets or logged-in accounts on the target, retain human intervention for important or irreversible operations, isolate the network, treat everything read from the screen or web pages as untrusted input, and keep an emergency stop available (hid.release_all or physically unplugging the USB cable). If deploying for others (accessibility, managed RPA), you must inform end users of these risks and obtain consent.
- MIT licensed, provided "as is", without any warranty.