MCP server for KVM control — thin client for serial-hid-kvm
Project description
mcp-serial-hid-kvm
MCP (Model Context Protocol) server that gives AI agents full keyboard, mouse, and screen access to a physical PC. Thin client for serial-hid-kvm — all hardware control is delegated via TCP.
How It Works
Claude / AI Agent
↕ MCP (stdio)
mcp-serial-hid-kvm ← this package (thin client + OCR)
↕ TCP (localhost:9329)
serial-hid-kvm ← standalone KVM server (owns hardware)
↕ USB Serial + HDMI
Target PC
The KVM server (serial-hid-kvm) runs as a persistent process owning the serial port and capture device. This MCP server connects to it as a TCP client. Multiple MCP instances (multiple Claude sessions) can share a single KVM server without device conflicts.
Prerequisites
- Hardware: CH9329+CH340 USB HID cable + USB HDMI capture device (see serial-hid-kvm for details)
- serial-hid-kvm installed and running:
pip install -e /path/to/serial-hid-kvm serial-hid-kvm --api # with preview window serial-hid-kvm --api --headless # or headless
- Tesseract OCR (for
get_screen_text/execute_and_read):- Linux:
sudo apt install tesseract-ocr - Windows: https://github.com/tesseract-ocr/tesseract
- Linux:
Installation
pip install -e .
This automatically installs serial-hid-kvm as a dependency.
MCP Client Configuration
Claude Desktop / Claude Code
{
"mcpServers": {
"kvm": {
"command": "mcp-serial-hid-kvm"
}
}
}
Custom KVM server address:
{
"mcpServers": {
"kvm": {
"command": "mcp-serial-hid-kvm",
"env": {
"SHKVM_API_HOST": "127.0.0.1",
"SHKVM_API_PORT": "9329"
}
}
}
}
Configuration
| Variable | Default | Description |
|---|---|---|
SHKVM_API_HOST |
127.0.0.1 |
KVM server address |
SHKVM_API_PORT |
9329 |
KVM server port |
MCP_TESSERACT_CMD |
auto-detect | Path to tesseract executable |
MCP_CAPTURE_LOG_DIR |
platform default | Capture log directory (empty string to disable) |
Hardware settings (SHKVM_SERIAL_PORT, SHKVM_SCREEN_WIDTH, etc.) are configured on the KVM server side, not here. If the target PC uses a non-US keyboard, set --target-layout (or SHKVM_TARGET_LAYOUT) on the KVM server so that type_text and send_key produce correct characters.
Available Tools
Keyboard
| Tool | Description |
|---|---|
type_text |
Type text with inline tags: ls -la{enter}, {ctrl+c}, {alt+f4} |
send_key |
Single key press with modifiers |
send_key_sequence |
Multiple key steps with per-step delays |
Mouse
| Tool | Description |
|---|---|
mouse_move |
Move cursor (absolute or relative) |
mouse_click |
Click at optional position |
mouse_drag |
Drag from one position to another (drag-and-drop, text selection, etc.) |
mouse_scroll |
Scroll wheel |
Screen
| Tool | Description |
|---|---|
capture_screen |
Capture screen as image (high token cost) |
get_screen_text |
Capture + OCR to text (preferred for text content) |
execute_and_read |
Type command, Enter, wait, capture + OCR |
Device Management
| Tool | Description |
|---|---|
get_device_info |
Serial port, capture device, config info |
list_capture_devices |
List available video devices |
set_capture_device |
Switch capture device |
set_capture_resolution |
Change capture resolution |
Architecture
This package is intentionally minimal (~4 files):
mcp_serial_hid_kvm/
server.py MCP tool handlers → KvmClient TCP calls
config.py KVM host/port, tesseract, log settings
ocr.py Tesseract OCR (runs locally on fetched frames)
__init__.py
All keyboard/mouse/capture logic lives in serial-hid-kvm. This package only translates MCP tool calls to TCP API calls and runs OCR locally.
Why Separate?
- No device conflicts — multiple Claude sessions share one KVM server
- Independent restarts — restart the MCP server without losing the KVM connection
- Standalone use —
serial-hid-kvmworks without MCP (interactive preview, scripts, other AI frameworks)
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_serial_hid_kvm-0.1.0.tar.gz.
File metadata
- Download URL: mcp_serial_hid_kvm-0.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad1870d1ff334e1ec98d854bb6948661236a9c84e05acd2876c45a2b8e1fdb0d
|
|
| MD5 |
e40f1a8a90ed5289bd6c9c659a4b60b6
|
|
| BLAKE2b-256 |
52850795aeac5f938a905276b508e2920a3235c7bd3b498b6e73bb01ea6b7637
|
Provenance
The following attestation bundles were made for mcp_serial_hid_kvm-0.1.0.tar.gz:
Publisher:
release.yml on sunasaji/mcp-serial-hid-kvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_serial_hid_kvm-0.1.0.tar.gz -
Subject digest:
ad1870d1ff334e1ec98d854bb6948661236a9c84e05acd2876c45a2b8e1fdb0d - Sigstore transparency entry: 997203081
- Sigstore integration time:
-
Permalink:
sunasaji/mcp-serial-hid-kvm@47f6f506e5e39640db3bd280be36f79051a5d78a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sunasaji
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47f6f506e5e39640db3bd280be36f79051a5d78a -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_serial_hid_kvm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_serial_hid_kvm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fba38357eeb0bc590635f49a3ec073839587111d4af8a648a3bcfced4cb50365
|
|
| MD5 |
a8f1aa44ba2cdada0587078fad967aab
|
|
| BLAKE2b-256 |
78d816181a3c9de599fd97f6bf126728e082792d92221b5828f72d488863cbc1
|
Provenance
The following attestation bundles were made for mcp_serial_hid_kvm-0.1.0-py3-none-any.whl:
Publisher:
release.yml on sunasaji/mcp-serial-hid-kvm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_serial_hid_kvm-0.1.0-py3-none-any.whl -
Subject digest:
fba38357eeb0bc590635f49a3ec073839587111d4af8a648a3bcfced4cb50365 - Sigstore transparency entry: 997203098
- Sigstore integration time:
-
Permalink:
sunasaji/mcp-serial-hid-kvm@47f6f506e5e39640db3bd280be36f79051a5d78a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sunasaji
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47f6f506e5e39640db3bd280be36f79051a5d78a -
Trigger Event:
push
-
Statement type: