Client Setup
Installation
Section titled “Installation”The client is published on npm — no local setup needed:
npx mcpu-clientOr install globally:
npm install -g mcpu-clientEnvironment Variables
Section titled “Environment Variables”All configuration is done via environment variables.
| Variable | Description | Default | Example |
|---|---|---|---|
SERIAL_PORT | Serial port — single device shorthand | — | /dev/ttyACM0, COM3 |
SERIAL_BAUD | Baud rate (used with SERIAL_PORT) | 115200 | 9600 |
DEVICES | Multi-device config string | — | esp32:/dev/ttyACM0:115200 |
Priority: SERIAL_PORT → DEVICES
Configuration
Section titled “Configuration”Single Device — SERIAL_PORT
Section titled “Single Device — SERIAL_PORT”SERIAL_PORT=/dev/ttyACM0 npx mcpu-clientCustom baud rate:
SERIAL_PORT=/dev/ttyACM0 SERIAL_BAUD=9600 npx mcpu-clientMultiple Devices — DEVICES
Section titled “Multiple Devices — DEVICES”Format: id:port:baud (serial) or id:host:port:tcp (TCP), comma-separated.
# Two serial devicesDEVICES=robot:/dev/ttyUSB0:115200,display:/dev/ttyACM0:115200 npx mcpu-client
# Serial + TCPDEVICES=robot:/dev/ttyUSB0:115200,sensor:192.168.1.50:3000:tcp npx mcpu-client
# Windowsset DEVICES=board1:COM3:115200,board2:COM4:115200 && npx mcpu-clientWith multiple devices, tools are prefixed: robot__gpio_write, display__gpio_write
Claude Desktop Integration
Section titled “Claude Desktop Integration”Serial — Linux / macOS (~/.config/claude/claude_desktop_config.json):
{ "mcpServers": { "mcpu": { "command": "npx", "args": ["mcpu-client"], "env": { "SERIAL_PORT": "/dev/ttyACM0" } } }}Serial — Windows (%APPDATA%\Claude\claude_desktop_config.json):
{ "mcpServers": { "mcpu": { "command": "npx", "args": ["mcpu-client"], "env": { "SERIAL_PORT": "COM3" } } }}WiFi TCP (replace IP with the one your ESP32 printed to Serial Monitor):
{ "mcpServers": { "mcpu": { "command": "npx", "args": ["mcpu-client"], "env": { "DEVICES": "mydevice:192.168.1.42:3000:tcp" } } }}Mixed — Serial + WiFi TCP:
{ "mcpServers": { "mcpu": { "command": "npx", "args": ["mcpu-client"], "env": { "DEVICES": "robot:/dev/ttyUSB0:115200,sensor:192.168.1.42:3000:tcp" } } }}Claude Code (CLI)
Section titled “Claude Code (CLI)”Serial:
claude mcp add mcpu -e SERIAL_PORT=/dev/ttyACM0 -- npx mcpu-clientWiFi TCP:
claude mcp add mcpu -e DEVICES=mydevice:192.168.1.42:3000:tcp -- npx mcpu-clientMultiple devices:
claude mcp add mcpu -e DEVICES=robot:/dev/ttyUSB0:115200,sensor:192.168.1.42:3000:tcp -- npx mcpu-clientGemini CLI
Section titled “Gemini CLI”Edit ~/.gemini/settings.json:
Serial:
{ "mcpServers": { "mcpu": { "command": "npx", "args": ["mcpu-client"], "env": { "SERIAL_PORT": "/dev/ttyACM0" } } }}WiFi TCP:
{ "mcpServers": { "mcpu": { "command": "npx", "args": ["mcpu-client"], "env": { "DEVICES": "mydevice:192.168.1.42:3000:tcp" } } }}Finding Your Serial Port
Section titled “Finding Your Serial Port”| OS | Command | Typical port |
|---|---|---|
| Linux | ls /dev/ttyUSB* /dev/ttyACM* | /dev/ttyACM0 |
| macOS | ls /dev/tty.usbserial-* | /dev/tty.usbserial-* |
| Windows | Device Manager → Ports | COM3, COM4 |
Permission error on Linux:
sudo usermod -aG dialout $USER# Log out and back inTesting with MCP Inspector
Section titled “Testing with MCP Inspector”SERIAL_PORT=/dev/ttyACM0 npx @modelcontextprotocol/inspector npx mcpu-clientDynamic Tool Discovery
Section titled “Dynamic Tool Discovery”The client has zero hardcoded tool names. On startup:
- Connects to all configured devices
- Calls
get_info+list_toolson each - Converts firmware JSON Schema → Zod schemas at runtime
- Registers one MCP tool per firmware tool
Adding a new tool to firmware = the MCP tool appears automatically on next client restart.
| Scenario | Tool name format | Example |
|---|---|---|
| Single device | {tool_name} | gpio_write |
| Multi device | {device_id}__{tool_name} | robot__gpio_write |