bitpirate-mcp
This MCP server lets an AI agent control an ESP32-Bit-Pirate bench over USB CDC to interrogate targets across UART, SPI flash, I2C, and 1-Wire, with safety-gated read/write operations.
Discover USB CDC devices, verify target pin activity, and scan UART baud rates.
Open/close UART sessions, send commands, capture output, enter download mode, and read target flash through the firmware UART bridge with esptool.
Probe, read, dump, patch-write, erase, search, string-extract, analyze, configure, and raw-instruction-transfer SPI flash data.
Scan I2C buses, read registers, write registers, and dump device memory.
Open/close 1-Wire sessions, search for a device ROM, and send/read arbitrary 1-Wire bytes.
Optionally set PSU voltage/current and enable/disable power when hardware supports it.
Safety tiers: read-only tools run freely; allowed-write operations are logged; approval-write/destructive operations require
_confirmed: trueand may also drive firmware confirmations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@bitpirate-mcp dump the SPI flash to firmware.bin and scan it for secrets"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
An MCP server for the ESP32-Bit-Pirate - an open-source, ESP32-S3-based clone of the Bus Pirate multibus tool. It exposes the bench's UART, SPI (incl. the on-device flash shell), I2C (master and slave), 1-Wire, GPIO, PWM and scope/measure capabilities as MCP tools over stdio, so an AI agent can probe, dump and analyze firmware on a target board end-to-end: attach a device to the ESP32, let the agent drive the tools, and get extracted binaries and analysis out the other end.
A port of buspirate-mcp (Marc Plogas, MIT) from the BusPirate 6's BPIO2 binary protocol to the Bit-Pirate's text-console protocol. The tool/dispatch/session/safety layers are largely kept verbatim; the device layer was replaced and re-grounded in the Bit-Pirate v1.8 firmware source.
What makes this different from the upstream
buspirate-mcp (BP6) | bitpirate-mcp (ESP32-Bit-Pirate) | |
Transport | BPIO2 flatbuffers over a 2nd CDC port | Plain text console at 115200 baud (single CDC port) |
Device layer |
|
|
Flash work | Manual JEDEC sequences + host-side page program/erase | Native firmware flash shell: probe, on-device analysis, search, strings, read, raw dump, patch write, full erase |
On-device analysis | None |
|
Raw transactions |
| BP6-style instruction syntax |
Logic analyzer | FALA (5 tools, 75 MHz, 8 ch) | Removed - no FALA; |
Power supply | Hardware PSU (3 tools) | None on the bare devkit - tools report |
Signal timing | Fast binary protocol | ~2 s per menu round-trip (firmware main-loop latency); raw dump is serial-bottlenecked (~11.5 KB/s) |
Gains: the Bit-Pirate is stronger for RE than the BP6 in one key respect -
the firmware does binary analysis on the device (39 secret patterns, file
signature table, entropy), so spi_flash_analyze returns findings without
pulling the whole image first. It is also cheaper (~$15 board + devkit vs $100+).
Related MCP server: agentic-hil
Architecture
MCP client (Claude Code, Hermes, any MCP host)
| stdio
v
server.py tool definitions + dispatch + safety tiers + session mgmt
|
v
tools.py 53 tool implementations (protocol-agnostic where possible)
|
v
bitpirate_hardware.py THE device layer (the only firmware-specific module)
| pyserial, /dev/ttyACM0 @115200
v
ESP32-S3 running ESP32-Bit-Pirate v1.8 text consoleThe console driver has two read modes, both grounded in the firmware's actual output:
Prompt-aware reads - command, then read until the trailing mode prompt (
DIO>,SPI>, …) matches at the end of the transcript. Used for mode switches, DIO, and instruction-syntax transactions.Marker-aware reads - shell flows (flash shell, config wizard) don't end at a mode prompt; the driver reads until a known completion marker (
=== SPI Flash Shell ===,SPI Flash Dump: Done.,SPI configured., …) and answers intermediate prompts in the exact order the firmware asks them.
A quadratic-echo line-length guard (250 chars) protects the firmware's
getLine input path.
Every command string in the driver was taken from the v1.8 firmware source -
SpiFlashShell.cpp, SpiController.cpp, DioController.cpp,
UserInputManager.cpp, ActionDispatcher.cpp - not assumed.
Tools (53)
Safety tiers: read-only (full autonomy), allowed-write (autonomous,
logged), approval-write (blocks until a human confirms with
_confirmed: true and the firmware's own confirmation prompts are driven -
double-gated for destructive operations).
Session & UART
Tool | Tier | Notes |
| read-only | USB CDC console ports |
| read-only | DIO |
| read-only | baud probing over a UART session |
| allowed-write | console interaction with targets |
| allowed-write | probe burst (message x repeats) + bounded response capture with echo count |
| read-only | non-blocking capture of target output |
| allowed-write | boot/EN pin toggling (0-48 GPIO) |
| allowed-write | esptool through the firmware UART bridge |
SPI (incl. on-device flash shell)
Tool | Tier | Notes |
| allowed-write | mode switch + engagement session; close exits the flash shell |
| read-only | firmware flash probe: JEDEC ID, manufacturer, model, capacity |
| read-only | region read as hexdump |
| read-only | raw full-chip dump to a file - the workhorse for RE |
| approval-write | patch write from file/hex/ASCII, auto-erase option |
| read-only | BP6-style instruction |
| allowed-write | MOSI/MISO/SCLK/CS pins + 1-80 MHz + WP/HOLD (NVS-persisted) |
| read-only | on-device BinaryAnalyzer: file signatures, secrets, entropy |
| read-only | string search (1-32 bytes) with context |
| read-only | printable-string extraction |
| approval-write | full-chip erase - destructive |
I2C (master + slave)
Tool | Tier | Notes |
| allowed-write | engagement session |
| read-only | single-byte ping (ack/no-ack) |
| read-only | bus scan |
| read-only | register read / range dump |
| approval-write | register write |
| allowed-write | bench as I2C slave: a target master can write to / read from the bench |
| read-only | mid-session capture of what a target master sent |
1-Wire (incl. DS18B20 lifecycle)
Tool | Tier | Notes |
| allowed-write | engagement session |
| read-only | ROM search (multi-device aware) |
| read-only | presence detect |
| read-only | DS18B20 convert + read (CRC-checked by firmware) |
| read-only | scratchpad read-back |
| allowed-write | scratchpad program (e.g. temperature-set for test emulators) |
DIO, PWM & measurement
Tool | Tier | Notes |
| allowed / read | GPIO drive and sample |
| allowed-write | read a pin and drive the opposite level |
| allowed-write | timed pulse on a pin |
| allowed-write | weak-pull configuration |
| allowed-write | hardware PWM (50 Hz-~100 kHz) |
| allowed-write | 50 Hz pulse-width servo control |
| read-only | edge/level timing on a pin |
| read-only | frequency measurement |
| read-only | bounded logic capture (hex) |
PSU (hardware-dependent)
Tool | Tier | Notes |
| approval-write | report |
Install
# any Python 3.10+ (tested on 3.11)
git clone https://github.com/Indigaz/bitpirate-mcp
cd bitpirate-mcp
python3 -m venv .venv # or: uv venv --python 3.11 .venv
.venv/bin/pip install -e .Register with an MCP host (.mcp.json):
{
"mcpServers": {
"bitpirate": {
"command": "/absolute/path/to/bitpirate-mcp/.venv/bin/python",
"args": ["-m", "buspirate_mcp"]
}
}
}Board requirements: an ESP32-S3 devkit running
ESP32-Bit-Pirate v1.x,
exposing a USB CDC console (/dev/ttyACM0 on Linux). No pin configuration
needed for first use - the firmware keeps its SPI pin map in NVS
(defaults on a typical Bit-Pirate build: MOSI 40, MISO 39, SCLK 41, CS 4,
20 MHz, WP 7); spi_config re-points any free GPIO.
Typical RE workflow
Attach a target to the bench (SPI flash via clip, or I2C bus).
spi_probe- identify the chip (ID, manufacturer, capacity).spi_dump→~/re-lab/<target>/flash.bin- raw image off the bus.spi_flash_analyze/spi_flash_strings/spi_flash_search- on-device findings (what firmware, embedded keys, embedded binaries).Hand the image to your static-analysis tooling (Ghidra, REA, etc.).
Testing & verification
301 unit tests, all passing. The device layer is tested with a transcript-driven protocol mock (
FakeSerial): scripted firmware transcripts are released only after the triggering command is written, simulating real round-trip latency so command/response pairing cannot bleed across commands. The mock is a FIFO of (line → response) so repeated prompts (e.g.y/y) resolve in firmware order, and it accepts raw bytes for the dump path.Live-verified on hardware (ESP32-S3 devkit + Bit-Pirate v1.8, no target attached - no-chip paths): DIO read, edge counter, drive-HIGH/LOW self-test; instruction syntax
[0x9F r:3](floating bus, correct); flash shell probe (no-chip detection), analyze short-circuit, clean shell exit. Reproduce:scripts/smoke_live.py,scripts/smoke_live_spi.py(read-only by design).Protocol battery: 92/92 steps green on a two-board rig. A second ESP32-S3 running a custom
rig-responderfirmware acts as the target side (SPI slave, I2C slave + master, 1-Wire DS18B20 emulator with scratchpad/RAM, GPIO mirror witness, scope). Every checked value is derived from a known write - no flake-tolerant assertions.scripts/protocol_battery.py(console 31 steps + mcp 61 steps).
Roadmap
Shipped
Phase / Tier | What landed |
Phase 1–2 | Console driver (prompt/marker-aware), safety tiers, UART session tools |
Phase 3 | I2C host tools + 1-Wire search/read |
Phase 4 |
|
Phase 5 | Scope/measure: |
Tier 3 | DIO digital + PWM: |
Tier 4 | Bidirectional I2C (ping + bench-as-slave) + |
Tier 5 | 1-Wire DS18B20 lifecycle: |
Tier 6 | Deterministic end-to-end verification: the 92-step protocol battery on a real two-board rig |
Open upstream PRs (geo-tp/ESP32-Bit-Pirate)
PR | Fix |
onewire: add | |
uart: add | |
scope/measure: bounded | |
hiz: actually release DIO/OneWire/UART pins on mode exit |
Next (MCP-side, small)
dio_toggle- invert a pin without re-driving a level.uart_ping- timed (5 s) capture to characterize a DUT's baud/echo behavior.i2c_transfer- bracket instruction syntax for raw I2C sequences (parity withspi_transfer).
Proposed features (by effort)
XMODEM send/receive tools - the firmware already implements xmodem; expose it as MCP tools for AT-style DUT firmware flashing.
uart_read_lines- line-buffered reads (AT command shells,OK-gated targets).dio_shift- clock a byte out across N pins (shift-register DUTs).1-Wire depth - multi-device search results, DS2408 (8-channel I/O), DS2431/DS2433 EEPROM read/write.
spi_slave- bench as SPI slave so a target master can drive the bench (completes the bidirectional matrix: I2C slave exists, SPI slave does not).SPI EEPROM shell - 24xx/25xx EEPROM read/write (matches common bench EEPROMs; carries over from the original Phase 3).
captureoutput modes - save-to-file + ASCII waveform rendering so an agent can actually see the signal.analog_read- ESP32-S3 ADC path (upstream firmware PR; the S3 has ADCs the Bit Pirate firmware doesn't use yet).spi_flash_diff- compare two dumps (find what a patch changed).Bluetooth mode tools - the firmware's S3 BT mode is unexposed; upstream work, larger effort, listed for completeness.
Packaging (carried)
Rename the
buspirate_mcppackage tobitpirate_mcp, PyPI publish, CI.
Credits
Upstream: buspirate-mcp by Marc Plogas (MIT) - the tool/dispatch/session/ safety architecture it builds on.
Hardware & firmware: ESP32-Bit-Pirate by geo-tp (the console protocol, flash shell and analyzer this port drives).
Port to the ESP32-Bit-Pirate: designed and implemented by Hermes Agent (Nous Research)
the LLM agent driving this bench - under direction by Christian Brooks (Indigaz), who owns the hardware, set the goals, and reviews the work.
Method: every firmware-facing string is grounded in v1.8 source; the whole port is test-first (301 unit tests) and verified end-to-end on a real two-board rig (92/92 protocol battery) before each phase ships.
License
MIT - see LICENSE. Upstream copyright (c) Marc Plogas; port copyright (c) 2026 Hermes Agent (Nous Research) / Christian Brooks.
Available Tools
33 toolsclose_1wireA
Close a 1-Wire session and reset the ESP32-Bit-Pirate to HiZ mode. [allowed-write] [Duration: instant.]
Inputs: session_id (required).
close_i2cB
Close an I2C session and reset the ESP32-Bit-Pirate to HiZ mode. [allowed-write] [Duration: instant.]
Inputs: session_id (required).
close_spiB
Exit the flash shell and reset the ESP32-Bit-Pirate to HiZ mode. [allowed-write] [Duration: instant.]
Inputs: session_id (required).
close_uartB
Close a UART session and finalize logs. [allowed-write] [Duration: instant.]
Inputs: session_id (required).
enter_download_modeA
Put target into UART download mode by toggling GPIO pins. Holds boot pin LOW, pulses reset pin, releases. Works for ESP32, ESP8266, and similar chips. [allowed-write] [Duration: fast (~1-2 s -- GPIO toggle sequence).]
Inputs: boot_pin (required), reset_pin (required).
i2c_dumpC
Dump memory from an I2C device by reading all registers sequentially. Saves to artifacts. [read-only] [Duration: slow for large sizes (~1-2 min for 64 KB EEPROM). Fast for small sizes (256 bytes ~2-5 s). Parameterized by size. Background-dispatch recommended for large dumps.]
Inputs: session_id (required), device_addr (required), size, register_bytes.
i2c_readB
Read bytes from an I2C device, optionally from a specific register. [read-only] [Duration: instant.]
Inputs: session_id (required), device_addr (required), length, register_addr.
i2c_scanB
Scan the I2C bus for devices. Returns 7-bit addresses with device hints. [read-only] [Duration: slow (~3-10 s -- sweeps all 128 7-bit addresses). Background-dispatch recommended.]
Inputs: session_id (required).
i2c_writeADestructive
Write bytes to an I2C device register. DANGEROUS: may alter device configuration or EEPROM contents. [approval-write] [Duration: instant.]
Inputs: data_hex (required), session_id (required), device_addr (required), register_addr (required), +1 more.
list_devicesA
Find ESP32-Bit-Pirate console ports on USB CDC serial. [read-only] [Duration: instant.]
Inputs: no named parameters.
onewire_readC
Send arbitrary bytes on the 1-Wire bus and read back a response. [read-only] [Duration: instant.]
Inputs: write_hex (required), read_bytes (required), session_id (required).
onewire_searchA
Search for a device on the 1-Wire bus using Read ROM (0x33). Returns family code, serial number, and CRC validity. Works when exactly one device is present. [read-only] [Duration: fast (~1-3 s -- Read ROM sequence).]
Inputs: session_id (required).
open_1wireB
Open a 1-Wire connection and start an engagement. Configures 1-Wire mode with pullup enabled. [allowed-write] [Duration: fast (~0.5-2 s -- mode switch + folder creation).]
Inputs: engagement_name (required), current_ma, voltage_mv, engagement_path.
open_i2cB
Open an I2C connection and start an engagement. Configures I2C mode with pullups enabled. [allowed-write] [Duration: fast (~0.5-2 s -- mode switch + folder creation).]
Inputs: engagement_name (required), speed, current_ma, voltage_mv, +2 more.
open_spiB
Enter SPI mode on the ESP32-Bit-Pirate and start an engagement. Pin map comes from NVS (change with spi_config). [allowed-write] [Duration: fast (~1-2 s -- mode switch).]
Inputs: engagement_name (required), engagement_path.
open_uartB
Open a persistent UART connection and start an engagement. Creates engagement folder and raw logging. [allowed-write] [Duration: fast (~0.5-2 s -- mode switch + folder creation).]
Inputs: baud (required), engagement_name (required), rx_pin, tx_pin, +1 more.
read_flashA
Read flash memory from target via esptool through the Bit-Pirate UART bridge. Optionally enters download mode first. Requires esptool installed. [allowed-write] [Duration: very-slow (~3-5 min for 1-2 MiB at 460800 baud; larger images proportionally longer). Background-dispatch required. Bridge mode persists after dump -- press the Bit-Pirate button or USB-replug to exit.]
Inputs: size (required), output_path (required), baud, offset, +2 more.
read_outputA
Read available data from an open UART session. Blocks up to timeout. [read-only] [Duration: fast (~timeout_ms; default 5 s). Returns earlier if data is available.]
Inputs: session_id (required), timeout_ms.
scan_baudA
Scan common baud rates and score by readable ASCII output. Returns candidates sorted by confidence. [read-only] [Duration: slow (~15-60 s -- cycles through common baud rates, samples each for a short window). Background-dispatch recommended.]
Inputs: no named parameters.
send_commandB
Send a command over UART and capture the response. [allowed-write] [Duration: fast (~timeout_ms; default 3 s). Returns earlier when response is received.]
Inputs: command (required), session_id (required), timeout_ms.
set_powerBDestructive
Enable or disable the power supply. DANGEROUS: affects power to target device. [approval-write] [Duration: instant.]
Inputs: enable (required), _confirmed.
set_voltageBDestructive
Set power supply voltage (0.8-5.0V) and current limit (0-500mA). DANGEROUS: wrong voltage can damage target hardware. [approval-write] [Duration: instant.]
Inputs: voltage_v (required), current_limit_ma (required), _confirmed.
spi_configB
Set the SPI pin map (MOSI/MISO/SCLK/CS GPIO, frequency 1-80 MHz, optional WP/HOLD pins). NVS-persisted by the firmware. [allowed-write] [Duration: fast (~2-4 s).]
Inputs: cs (required), miso (required), mosi (required), sclk (required), +3 more.
spi_dumpA
Dump the entire SPI flash to a file (firmware raw mode, menu 8). Serial-bottlenecked (~91 s per MiB at 115200 baud). [read-only] [Duration: slow - very-slow (4 MiB flash ~ 7 min). Background-dispatch required.] Returns {path, size}.
Inputs: output_path (required), timeout.
spi_flash_analyzeA
Run the on-device BinaryAnalyzer over the whole flash: file signatures, sensitive patterns (keys, hashes, URLs), entropy summary. [read-only] [Duration: slow - very-slow (full-chip read ~91 s/MiB + analysis). Background-dispatch recommended.]
Inputs: timeout.
spi_flash_eraseADestructive
Erase the ENTIRE flash chip (firmware menu 9). DANGEROUS: all contents destroyed. [approval-write] [Duration: slow - very-slow (seconds to minutes depending on chip).]
Inputs: _confirmed (required), timeout.
spi_flash_searchA
Search the flash for a string pattern (1-32 bytes). Returns match addresses with printable context. [read-only] [Duration: slow (full-chip read ~91 s/MiB). Background-dispatch recommended.]
Inputs: pattern (required), timeout.
spi_flash_stringsA
Extract printable strings from the whole flash (min length parameter). [read-only] [Duration: slow - very-slow (full-chip read). Background-dispatch recommended.]
Inputs: timeout, min_length.
spi_probeA
Detect the SPI flash chip via the firmware flash shell. Returns JEDEC ID, manufacturer, model, capacity, and capability notes. [read-only] [Duration: fast (~2-5 s).]
Inputs: no named parameters.
spi_readA
Read a region of SPI flash memory as a hexdump (firmware menu 5). [read-only] [Duration: fast - slow (serial-bottlenecked ~11.5 KB/s -- ~8 s per 100 KiB).]
Inputs: length (required), address (required), timeout.
spi_transferB
Run a BP6-style SPI instruction, e.g. '[0x9F r:3]' (JEDEC read), '[0x05 r:1]' (status), '[0x06] [0xC7]' (enable + chip erase). Dispatched to the firmware's instruction parser in SPI mode. [read-only for read-only instructions] [Duration: instant - fast.]
Inputs: instruction (required), timeout.
spi_writeADestructive
Write data to SPI flash (firmware menu 6): from a file, hex string, or ASCII string. DANGEROUS: overwrites flash. [approval-write] [Duration: fast - slow (depends on size).]
Inputs: address (required), _confirmed (required), data_hex, auto_erase, +2 more.
verify_connectionA
Check for signal activity on specified pins. User must provide pin mapping. [read-only] [Duration: fast (~2 s -- samples for sample_duration_ms, default 2000).]
Inputs: rx_pin (required), tx_pin (required), sample_duration_ms.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 33 tools
The per-protocol grouping keeps most tools distinct, but flash reading is split across three overlapping entry points (read_flash via esptool/UART bridge, spi_dump via firmware shell, spi_read/spi_flash_search/spi_flash_strings for regions and analysis) and an agent could easily pick the wrong path or protocol family. Detailed descriptions and duration hints help, but the boundaries are only resolvable by careful reading of mechanism (bridge vs shell vs on-device analyzer).
Most tools follow a readable prefix_verb pattern (open_spi, spi_read, i2c_write, close_uart), but the convention drifts: 'onewire_*' vs 'close_1wire', and an inconsistent 'spi_*' versus 'spi_flash_*' split that mixes raw-shell ops with whole-chip analysis ops. It remains interpretable but is not a single predictable pattern.
33 tools is heavy, but the breadth is largely earned by four protocol families (SPI, I2C, UART, 1-Wire) plus power control, each needing open/close and a handful of operations. Still, the SPI family alone consumes 13 tools with visible redundancy (spi_dump vs read_flash vs spi_read), so trimming would improve the surface.
Each protocol has session open/close plus the expected read/write/scan operations, and there is power control, device discovery, and download-mode entry, so the hardware-engagement lifecycle is well covered. Minor gaps: no region-scoped erase (only full-chip spi_flash_erase with spi_write overwrite), no session listing/teardown-all, and no general GPIO manipulation beyond the hardcoded download-mode sequence.
Maintenance
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Audit your MCP servers for poisoned tools and leaked secrets, and check AI-generated code for flaws.
Autonomous agent guardrails, bash sandboxing, MCP rugpull diffing & prompt firewalls.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for BusPirate 6 hardware security testing. Exposes UART, SPI, I2C, 1-Wire, power supply, GPIO, and logic analyzer operations as tools.2MIT
- AlicenseAqualityBmaintenanceAgentic Hardware-in-the-Loop (Agentic HIL) lets coding agents develop firmware on real embedded boards: flash, reset, read UART and exchange CAN traffic, diagnose and fix. Local, policy-gated MCP tools support OpenOCD, pyOCD and STM32CubeProgrammer, with pytest for CI.44943 PyPI37Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI agents to interact with physical embedded target boards over a dual-CDC USB bridge using MCP tools. It exposes console reading, pattern waiting, command sending, reboot/login state machines, and in-RAM MicroPython execution while a single-owner daemon safely arbitrates access to the serial devices.64Apache 2.0
- AlicenseNot gradedqualityBmaintenanceExposes 238 schema-typed tools over streamable-HTTP MCP that let a client drive a Flipper Zero, an AWOK Biscuit (ESP32-C5) and an ESP32 Marauder — scanning, screen mirroring, storage, and other device operations — from natural-language or direct tool calls. Transmit/attack tools stay behind an explicit human confirmation gate.MIT