Control a Raspberry Pi Pico (RP2040/RP2350) from an AI agent
A Raspberry Pi Pico is the cheapest way to give an AI agent a real board to work with. This MCP server lets Claude Code, Claude Desktop or Cursor flash a Pico, Pico W or Pico 2 and talk to it over USB serial, with or without picotool installed.
Last checked against the source code on 2026-09-20.
Setup
- Optional: install picotool (
brew install picotool, or build it from Raspberry Pi's repository). Without it the server falls back to copying the UF2 file. - Register the server with your MCP client using the quickstart config.
- Connect the Pico with a data-capable micro-USB or USB-C cable.
Detection
list_boards matches the Raspberry Pi USB vendor ID 2e8a with product IDs 000a (Pico SDK USB serial), 0009 (Pico W), 000f (Pico 2 / RP2350) and 0003 (BOOTSEL). Boards are returned with family rp2040, and the family covers the RP2350 too.
In BOOTSEL mode the Pico is a USB drive, not a serial port, so it usually disappears from the serial port list. That is expected. Flashing still works, as described next.
Flashing a UF2
Hold BOOTSEL while plugging the board in, then let the agent call:
flash_firmware {
"family": "rp2040",
"path": "/dev/cu.usbmodem1101",
"firmwarePath": "/Users/you/pico-blink/build/blink.uf2"
}- With picotool on the PATH the server runs
picotool load -x <file>, which loads the file and starts it. - Without picotool it looks for a mounted
RPI-RP2orRP2350drive (under/Volumeson macOS,/media/$USERor/run/mediaon Linux, and drives D: to G: on Windows) and copies the .uf2 onto it. - If neither works, the tool result tells the agent to install picotool or to put the board in BOOTSEL mode, rather than reporting success.
The path argument is required by the tool, but a Pico flash does not use it beyond labelling the result. Pass the port the board had before it entered BOOTSEL.
Talking to it
Once your firmware is running with USB stdio enabled (pico_enable_stdio_usb in the Pico SDK), the board reappears as 2e8a:000a and the serial tools work:
serial_open { "family": "rp2040", "path": "/dev/cu.usbmodem1101", "baudRate": 115200 }
serial_write { "family": "rp2040", "handle": { ... }, "dataBase64": "bGVkIG9uCg==" }
serial_read { "family": "rp2040", "handle": { ... }, "timeoutMs": 1000 }The write above sends the text led on followed by a newline. A few lines of C in your firmware that read stdin and switch the LED are enough for the agent to control the board, and the agent can write those lines too.
Pins and buses on a MicroPython Pico
Flash MicroPython's UF2 once and the agent gets gpio_mode, gpio_read, gpio_write, adc_read, pwm_write, i2c_scan, i2c_read, i2c_write, spi_transfer and mpy_exec with no firmware of ours on the board: the server drives MicroPython's raw REPL over the same USB port, the way mpremote does, and board_info confirms which runtime it found. As of 2026-09-20 these tools are proven against the real MicroPython interpreter (its WebAssembly build) in a simulator and have not been run on a physical Pico by the studio; the quickstart keeps that status current.
Limits today
- No tool runs a Pico SDK CMake build;
build_projectcovers PlatformIO projects only, and has been proven against recorded PlatformIO output rather than a real install. The agent runs your CMake build in the terminal and hands the UF2 toflash_firmware. - On firmware that is not MicroPython the pin and bus tools do not apply; control goes through the serial port.
Frequently asked questions
- Can Claude Code control a Raspberry Pi Pico?
- Through this MCP server it can flash a Pico, Pico W or Pico 2 and exchange data with it over USB serial. On a Pico running MicroPython it can also drive pins directly with gpio_mode, gpio_read, gpio_write, adc_read, pwm_write, the i2c_ tools, spi_transfer and mpy_exec, through MicroPython's raw REPL. On other firmware, what the board does with the serial messages is up to that firmware, so a small command parser on the Pico turns the agent's serial_write calls into actions.
- Do I need picotool to flash a Pico from an agent?
- No. If picotool is installed the server runs picotool load -x with your file. If it is not, the server looks for the board's BOOTSEL drive (RPI-RP2 or RP2350) and copies the .uf2 file onto it, which is the flashing method Raspberry Pi documents.
- Which Pico USB IDs are detected?
- Raspberry Pi vendor ID 2e8a with product IDs 000a (the Pico SDK's default USB serial), 0005 (a Pico running MicroPython), 0009 (Pico W), 000f (Pico 2) and 0003 (BOOTSEL mode). The MicroPython id was missing until 2026-09-19, so an older build did not list a MicroPython Pico at all.
- Does it work with the RP2350 as well as the RP2040?
- Yes, the RP2350 on the Pico 2 is covered by the same module: it is detected by its product ID, and the BOOTSEL copy fallback looks for both the RPI-RP2 and the RP2350 drive names.
- Is this the same as running an MCP server on the Pico itself?
- No. Projects such as micro-mcp run a MicroPython MCP server on a Pico W over Wi-Fi. This server runs on your computer and talks to the Pico over USB, so the board needs no network stack and any firmware with a USB serial port works.