Debug Connection Issues
This guide covers the most common connection issues and how to resolve them.
Serial Connection Issues
Section titled “Serial Connection Issues””Permission Denied” on Linux
Section titled “”Permission Denied” on Linux”Symptom: Error: Permission denied /dev/ttyACM0
Cause: Your user isn’t in the dialout group.
-
Add your user to the dialout group:
Terminal window sudo usermod -aG dialout $USER -
Log out and log back in (or reboot)
-
Verify:
Terminal window groups | grep dialout
Device Not Appearing
Section titled “Device Not Appearing”Symptom: /dev/ttyUSB* or /dev/ttyACM* doesn’t show your device
Causes and solutions:
| Cause | Solution |
|---|---|
| Charge-only USB cable | Use a data-capable USB cable |
| USB port issue | Try a different USB port |
| Board not powered | Check the board’s power LED |
| Driver missing (Windows) | Install CH340/CP2102 driver |
Check if device is detected:
# Before plugging inls /dev/tty* > before.txt# Plug in devicels /dev/tty* > after.txtdiff before.txt after.txtWrong Baud Rate
Section titled “Wrong Baud Rate”Symptom: Garbled output in Serial Monitor, or client can’t communicate
Solution: Verify the baud rate matches your firmware:
// Default is 115200mcp.begin(Serial, 115200);In client config:
"env": { "SERIAL_PORT": "/dev/ttyACM0", "SERIAL_BAUD": "115200"}Port Already In Use
Section titled “Port Already In Use”Symptom: Error: Port is in use or Resource busy
Check what’s using the port:
# Linuxlsof /dev/ttyACM0
# macOSlsof /dev/cu.usbserial-*Common culprits:
- Arduino IDE Serial Monitor
- PlatformIO Device Monitor
- Another terminal with serial open
Solution: Close all other serial connections and try again.
WiFi TCP Connection Issues
Section titled “WiFi TCP Connection Issues”Connection Refused
Section titled “Connection Refused”Symptom: Error: connect ECONNREFUSED or Connection refused
Causes and solutions:
| Cause | Solution |
|---|---|
| Wrong IP address | Check Serial Monitor for correct IP |
| ESP32 not running server | Verify “TCP server listening on port 3000” in Serial Monitor |
| Wrong port | Default is 3000, check your firmware |
| Firewall blocking | Temporarily disable firewall or add exception |
Verify ESP32 is listening:
# Check if port is opennc -z 192.168.1.42 3000Can’t Find ESP32 IP
Section titled “Can’t Find ESP32 IP”Symptom: Don’t know the ESP32’s IP address
Solution: Open Serial Monitor after boot — the ESP32 prints:
Connecting to WiFi.....IP: 192.168.1.42TCP server listening on port 3000Not on Same Network
Section titled “Not on Same Network”Symptom: Connection times out
Solution: Ensure your computer and ESP32 are on the same local network (same WiFi router). Corporate networks may isolate devices.
Firewall Blocking
Section titled “Firewall Blocking”Symptom: Connection works from another device but not your computer
Solution:
- Linux:
sudo ufw allow 3000/tcp - macOS: System Settings → Network → Firewall → Allow incoming connections
- Windows: Windows Defender Firewall → Allow an app through firewall
ESP32-Specific Issues
Section titled “ESP32-Specific Issues”Not Responding After Flash
Section titled “Not Responding After Flash”Symptom: ESP32 doesn’t respond to commands after uploading new firmware
Cause: Some ESP32 boards reset when the USB connection is opened (DTR), which can interfere with the first connection.
Solution: Wait before connecting:
# Wait 2 seconds after flashsleep 2 && npx mcpu-clientOr in your agent config, add a startup delay.
Tool Not Found
Section titled “Tool Not Found”Symptom: Method not found or tool doesn’t appear in list
Causes:
| Cause | Solution |
|---|---|
| Tool not registered | Add mcp.add_tool() in setup() before mcp.begin() |
| Client not restarted | Restart the client after flashing new firmware |
| Wrong device ID | Verify device ID matches in DEVICES config |
Debug with MCP Inspector:
SERIAL_PORT=/dev/ttyACM0 npx @modelcontextprotocol/inspector npx mcpu-clientOpen the browser URL and call list_tools to see what the firmware actually exposes.
Using MCP Inspector for Debugging
Section titled “Using MCP Inspector for Debugging”MCP Inspector is the best tool for debugging MCP/U connections:
# SerialSERIAL_PORT=/dev/ttyACM0 npx @modelcontextprotocol/inspector npx mcpu-client
# TCPDEVICES=mydevice:192.168.1.42:3000:tcp npx @modelcontextprotocol/inspector npx mcpu-clientWhat to check in Inspector
Section titled “What to check in Inspector”- Call
get_info— verifies device is responding - Call
list_tools— shows all available tools - Call a simple tool like
gpio_read— tests basic functionality - Check for errors — look at the response JSON for error fields
Quick Diagnostic Checklist
Section titled “Quick Diagnostic Checklist”- Device is powered (check LED)
- Correct serial port / IP address
- Correct baud rate (115200 default)
- No other app using the port
- Linux: user in
dialoutgroup - TCP: same network as ESP32
- Client restarted after firmware flash
- Device ID matches in
DEVICESconfig
Next Steps
Section titled “Next Steps”- Connect via Serial — detailed serial setup
- Connect via WiFi TCP — detailed TCP setup
- Multi-Device Setup — multiple MCUs