Skip to content

Connecting to CLI Agents

Once your MCP/U client is running, connect it to any MCP-compatible CLI agent.


Official docs: code.claude.com/docs/en/mcp

Serial:

Terminal window
claude mcp add --env SERIAL_PORT=/dev/ttyACM0 mcpu -- npx mcpu-client

WiFi TCP (replace IP with the one your ESP32 printed to Serial Monitor):

Terminal window
claude mcp add --env DEVICES=mydevice:192.168.1.42:3000:tcp mcpu -- npx mcpu-client

All options (--env, --scope, --transport) must come before the server name. The -- separator isolates the command passed to the MCP server.

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"
}
}
}
}
Terminal window
claude mcp list

Or inside a Claude Code session: /mcp


Official docs: github.com/google-gemini/gemini-cli

Serial:

Terminal window
gemini mcp add -e SERIAL_PORT=/dev/ttyACM0 mcpu npx mcpu-client

WiFi TCP (replace IP with the one your ESP32 printed to Serial Monitor):

Terminal window
gemini mcp add -e DEVICES=mydevice:192.168.1.42:3000:tcp mcpu npx mcpu-client

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"
}
}
}
}
Terminal window
gemini mcp list

Or inside a session: /mcp


Official docs: opencode.ai/docs/mcp-servers

OpenCode has no CLI add command — edit opencode.json directly.

Serial:

{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mcpu": {
"type": "local",
"command": ["npx", "mcpu-client"],
"enabled": true,
"environment": {
"SERIAL_PORT": "/dev/ttyACM0"
}
}
}
}

WiFi TCP:

{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mcpu": {
"type": "local",
"command": ["npx", "mcpu-client"],
"enabled": true,
"environment": {
"DEVICES": "mydevice:192.168.1.42:3000:tcp"
}
}
}
}
Terminal window
opencode mcp list

SerialWiFi TCP
Env varSERIAL_PORT=/dev/ttyACM0DEVICES=id:IP:port:tcp
Windows serialSERIAL_PORT=COM3same TCP format
Multi-deviceDEVICES=a:/dev/ttyUSB0:115200,b:/dev/ttyACM0:115200DEVICES=a:192.168.1.42:3000:tcp,b:192.168.1.43:3000:tcp
Claude CodeGemini CLIOpenCode
Add commandclaude mcp add --env KEY=VAL mcpu -- npx mcpu-clientgemini mcp add -e KEY=VAL mcpu npx mcpu-clientmanual config only
Config file.mcp.json (project)~/.gemini/settings.jsonopencode.json
Env field"env""env""environment"
Command formatstringstringarray
Verifyclaude mcp list / /mcpgemini mcp list / /mcpopencode mcp list

OSTypical port
Linux/dev/ttyUSB0 or /dev/ttyACM0
macOS/dev/cu.usbserial-*
WindowsCOM3, COM4, …
Terminal window
# Linux / macOS
ls /dev/tty*

Windows: Device Manager → Ports (COM & LPT)