Skip to content

Client Configuration

All configuration is done via environment variables.

VariableDescriptionDefaultExample
SERIAL_PORTSerial port — single device shorthand/dev/ttyACM0, COM3
SERIAL_BAUDBaud rate (used with SERIAL_PORT)1152009600
DEVICESMulti-device config stringesp32:/dev/ttyACM0:115200

Priority: SERIAL_PORTDEVICES


Terminal window
SERIAL_PORT=/dev/ttyACM0 npx -y mcpu-client

Custom baud rate:

Terminal window
SERIAL_PORT=/dev/ttyACM0 SERIAL_BAUD=9600 npx -y mcpu-client

Format: id:port:baud (serial) or id:host:port:tcp (TCP), comma-separated.

Serial:

Terminal window
DEVICES=robot:/dev/ttyUSB0:115200,display:/dev/ttyACM0:115200 npx -y mcpu-client

TCP (WiFi):

Terminal window
DEVICES=robot:/dev/ttyUSB0:115200,sensor:192.168.1.50:3000:tcp npx -y mcpu-client

Virtual Mock Testing:

Terminal window
DEVICES=mock-mcu:mock npx -y mcpu-client

Windows:

Terminal window
set DEVICES=board1:COM3:115200,board2:COM4:115200 && npx -y mcpu-client

MCP-U Client includes a built-in “Buffered Pull Memory” feature that stores sensor history and tool execution logs in a local SQLite database, allowing LLMs to query historical context securely. This feature is enabled by default.

VariableDescriptionDefault
MCPU_MEMORY_ENABLEDEnable memory subsystemtrue
MCPU_MEMORY_CONNECTION_URLSQLite connection pathsqlite:///./mcpu-memory.db
MCPU_SQL_READONLY_ENABLEDExpose sql_readonly_query tooltrue
MCPU_BUFFER_DRAIN_ENABLEDAutomated polling for buffered pinstrue
MCPU_RAW_RETENTION_HOURSKeep raw sensor samples for X hours24
MCPU_TOOL_CALL_RETENTION_DAYSKeep execution logs for X days365

Via Command Line (CLI):

Terminal window
MCPU_RAW_RETENTION_HOURS=48 MCPU_BUFFER_DRAIN_ENABLED=false DEVICES=esp32:/dev/ttyUSB0:115200 npx -y mcpu-client

Via Claude Desktop (claude_desktop_config.json):

{
"mcpServers": {
"mcu": {
"command": "npx",
"args": ["-y", "mcpu-client"],
"env": {
"DEVICES": "mock-mcu:mock",
"MCPU_MEMORY_ENABLED": "true",
"MCPU_MEMORY_CONNECTION_URL": "sqlite:////absolute/path/to/my-memory.db",
"MCPU_RAW_RETENTION_HOURS": "48"
}
}
}
}

FormatSyntaxExample
Serialid:port:baudesp32:/dev/ttyUSB0:115200
TCPid:host:port:tcpsensor:192.168.1.50:3000:tcp

With multiple devices, tools are prefixed: robot__gpio_write, display__gpio_write


The client has zero hardcoded tool names. On startup:

  1. Connects to all configured devices
  2. Calls get_info + list_tools on each
  3. Converts firmware JSON Schema → Zod schemas at runtime
  4. Registers one MCP tool per firmware tool
  5. Auto-configures polling for any tool that declares McpPolling(ms) in firmware

Adding a new tool to firmware = the MCP tool appears automatically on next client restart.

When a tool is registered with McpPolling(interval_ms), the firmware includes "polling": {"enabled": true, "interval_ms": N} in its list_tools response. The client reads this and schedules periodic calls automatically — no env var required.

// Firmware — declare polling in the tool registration
mcp.add_tool("read_sensor", "Read sensor buffer", handle_sensor, McpPolling(2000));

The client starts polling read_sensor every 2 seconds on its own. If the result contains "type": "buffer" data, observations are written to the memory database.


ScenarioTool name formatExample
Single device{tool_name}gpio_write
Multi device{device_id}__{tool_name}robot__gpio_write

OSSerialTCP
Linux/dev/ttyUSB*, /dev/ttyACM*
macOS/dev/tty.usbserial-*
WindowsCOM3, COM4, …

OSCommandTypical port
Linuxls /dev/ttyUSB* /dev/ttyACM*/dev/ttyACM0
macOSls /dev/tty.usbserial-*/dev/tty.usbserial-*
WindowsDevice Manager → PortsCOM3, COM4

Permission error on Linux:

Terminal window
sudo usermod -aG dialout $USER
# Log out and back in