Read ESP32 UART logs and reset a remote board with MCP

Use AnyRemote’s serial.* MCP tools to read UART output from a board attached to another computer. The target computer runs the CLI; your AI client selects that device and opens an explicitly allowed port.

This workflow is suited to a normal OS serial port, such as an ESP32 connected through a UART bridge. Logs, baud rate and reset wiring depend on your firmware and board. These instructions describe the released tools, not a claim that every ESP32 model or flashing path has been tested.

Reviewed · Maintained by Panda Intelligence Software LTD · CLI 0.3.5

Example commands and MCP arguments. Replace device, session and path placeholders with values from your own results.

Check the runtime and USB connection

The device-side CLI needs Node.js 20.9 or later. Do not use bunx for that side: the current Bun runtime cannot open these serial ports, so the device does not advertise the serial capability. Keep the remote CLI running and use the same AnyRemote account in your AI client.

A UART bridge such as CP210x, CH340/CH9102 or FTDI exposes a regular serial path. Native USB CDC can be useful for traffic while it remains enumerated, but resetting an ESP32-S2/S3/C3/C6 through USB-Serial-JTAG or USB-OTG may remove and re-enumerate the port. AnyRemote does not support that native-USB flashing path; use a UART bridge or the chip’s UART0 with an external adapter.

An available serial path is not permission to assume the board accepts AT commands or any particular boot sequence. Check its firmware protocol and wiring first.

Find and allow the intended port

  1. List ports on the target computer

    The command reports each local path and whether it is allowed. On macOS, the list includes the corresponding /dev/cu.* callout node; allow that form. Copy the path belonging to your board instead of copying the example unchanged.

    npx @panda-ai/anyremote@latest serial ports
  2. Start the connector with an explicit allowlist

    Replace this example with the port from your own listing. The comma-separated --serial-allow list is saved; only * and ? act as wildcards. An empty list disables serial access, and --serial-allow "" clears the saved list. Approve the device in the browser if prompted.

    npx @panda-ai/anyremote@latest remote --serial-allow "/dev/cu.usbserial-0001"
Target OSExample path to replace
macOS/dev/cu.usbserial-0001
Linux/dev/ttyUSB0 or /dev/ttyACM0
WindowsCOM3

Open a session and follow the UART log

In the MCP client, run devices.list first, choose the online computer and keep its deviceId. The objects below are MCP arguments. Replace DEVICE_ID and SESSION_ID with returned values. A session ID is the UUID returned by serial.open, not a name you invent.

  1. serial.ports

    Confirm the intended port appears among the device’s allowed ports. A result with hint: serial_disabled means serial has not been enabled; an empty result does not prove the board is absent from the OS.

    {
      "deviceId": "DEVICE_ID"
    }
  2. serial.open

    Open one port with the baud rate expected by your firmware. 115200 is an example, not a universal setting. Keep the returned sessionId. Defaults include 8N1, a 1 MiB buffer and a ten-minute idle timeout.

    {
      "deviceId": "DEVICE_ID",
      "path": "/dev/cu.usbserial-0001",
      "baudRate": 115200
    }
  3. serial.read

    Read from cursor 0 initially. Thereafter use the preceding result’s nextCursor, an absolute byte offset since the port opened. Check bytesLost before treating the log as complete. The example waits up to three seconds without restarting the board.

    {
      "deviceId": "DEVICE_ID",
      "sessionId": "SESSION_ID",
      "cursor": 0,
      "waitMs": 3000,
      "maxBytes": 8192
    }
  4. serial.close

    Close the same session when the task is finished. This releases the port and its concurrent-session slot. A new CLI process does not restore an old serial session.

    {
      "deviceId": "DEVICE_ID",
      "sessionId": "SESSION_ID"
    }

Control lines or request a reply only when applicable

serial.control supports DTR/RTS changes and device-local timed sequences of at most 16 steps and five seconds total. Derive a reset or bootloader sequence from your board’s schematic and Espressif’s boot-mode documentation. The example below only sets two line states and waits; it is not a universal ESP32 reset.

Use the sessionId of an open session. Observe the new UART output after a board-specific sequence; a successful control response alone does not establish that the firmware booted correctly.

{
  "deviceId": "DEVICE_ID",
  "sessionId": "SESSION_ID",
  "sequence": [
    {
      "dtr": false,
      "rts": false,
      "delayMs": 100
    }
  ]
}
  1. serial.transact for firmware that implements an AT protocol

    Only use this example if the firmware expects AT and returns OK. Stock application boot logs do not imply AT support. The tool writes data plus the chosen line ending, then waits for the literal reply or its time budget. The same encoding applies in both directions.

    {
      "deviceId": "DEVICE_ID",
      "sessionId": "SESSION_ID",
      "data": "AT",
      "eol": "\r\n",
      "until": "OK",
      "waitMs": 2000
    }
  2. Read back before retrying an uncertain write

    If a write returns OUTCOME_UNKNOWN, inspect serial.read or the board’s state before repeating it. A repeated command may trigger the action twice. Retain the current session and its byte cursor while checking.

One port has one holder

MCP sessions and serial attach cannot interleave on the same port. Close an IDE serial monitor and other sessions before opening it through MCP. Use serial.sessions or the console’s Serial sessions view to identify and release an existing holder.

Do not force-release a stream that someone is using without coordinating the handover. For an intended stream release, the console Release action or serial.close with force: true can reclaim it. Ordinary MCP sessions do not need force. Change data bits, parity or stop bits by closing and reopening the port.

Optional: use a local RFC2217 endpoint

On another computer enrolled to the same AnyRemote account, serial attach makes the remote port available to compatible local monitor or uploader tools. Use the exact device ID; selecting a device by name additionally needs saved login credentials. The remote port must be allowlisted and free of another holder.

Run the attach command in its own terminal and keep it open. It prints the actual loopback RFC2217/raw TCP endpoints; optional PTY support needs socat. Ctrl-C closes the session. Flashing still depends on the board, correct firmware layout and uploader version—this guide does not supply a universal flash address.

DTR/RTS changes are coalesced into a device-local sequence, with a 250 ms default window. Consult the uploader’s current remote-serial instructions and the AnyRemote reference before changing --control-coalesce-ms. Native USB re-enumeration remains outside the supported flashing path.

npx @panda-ai/anyremote@latest serial attach --device DEVICE_ID --path "/dev/cu.usbserial-0001" --baud 115200

Troubleshoot the specific result

Code or signalWhat to check
CONFIGURATION_ERROR or serial_disabledUse the current CLI under Node.js on the device, a nonempty allowlist and the intended path. Restart the connector after changing its configuration.
SERIAL_PORT_BUSYAnother MCP session, attach or local program holds the port. Identify that holder and close it before retrying.
SERIAL_PORT_LOSTThe cable disconnected, the OS closed the port or native USB re-enumerated. Recheck serial.ports and open a new session.
DEVICE_OFFLINEThe target connector is not running or cannot reach the relay. Restore the computer’s connection first.
bytesLost greater than 0The ring buffer evicted earlier bytes. Read more frequently or choose a larger bufferBytes when opening, up to 4 MiB. Do not claim an unbroken log.
RATE_LIMITED with serial_session_limitThe account’s concurrent serial-session allowance is full. Close an unused session or inspect the actual plan limits in Billing.

Verify the board rather than the animation

A log read proves only which bytes were returned. Match the boot banner, application response or measured board behavior to your expected firmware result. A desktop screenshot can help inspect an uploader or waveform window, but it is not proof that flashing succeeded.

For an end-to-end task, combine the chosen device’s serial tools with files.* and process.* on that same computer. Keep any log excerpt clearly identified as your actual result; the homepage’s illustrated tool sequence is an example, not a hardware verification record.

Sources and tool reference