Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
LUNA_USB_IDSNoExtra VVVV:PPPP gateware ID recognised by apollo_fpga (read at import time).
PYTHONUNBUFFEREDNoRecommended 1 for an unbuffered stdio stream.
CYNTHION_MCP_LOG_LEVELNoLog level (DEBUG, INFO, WARNING...).INFO
CYNTHION_MCP_OUTPUT_DIRNoDefault folder for generated files (pcap, flash dumps, builds; builds go to its gateware_builds subfolder).~/cynthion_mcp

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Cynthion MCP server: drives a Great Scott Gadgets Cynthion (ECP5 FPGA + Apollo debug MCU, LUNA gateware).

DEVICE MODES (see server_status / list_devices, field "mode"):

  • "absent": no Cynthion visible on USB. Call the diagnose_connection prompt, check the CONTROL port cable and the WinUSB driver.

  • "apollo": only the Apollo debugger (1d50:615c) is enumerated; FPGA unconfigured or running USB-less gateware (selftest).

  • "analyzer": USB analyzer gateware is running (1d50:615b, interface subclass 0x10). Use the analyzer_* tools.

  • "facedancer": Moondancer/Facedancer gateware + SoC firmware is running (1d50:615b, subclass 0x20). Use facedancer_* and board I/O tools.

  • "gateware_stub": custom gateware exposing only the Apollo stub interface.

RULES:

  • Only ONE owner of the USB device at a time. A running analyzer capture or Facedancer emulation blocks every tool that hands off to Apollo, reconfigures or reflashes the FPGA ([BUSY] error). Stop it first (analyzer_stop / facedancer_stop).

  • Apollo/JTAG tools (device_info with force_offline, jtag_*, flash_*, configure_bitstream, run_gateware) stop the running gateware. reconfigure_fpga reboots the gateware stored in SPI flash (the analyzer by default).

  • run_gateware / configure_bitstream are volatile (SRAM, lost at power-off). flash_gateware / flash_file / erase_flash / update_apollo_firmware are PERSISTENT and DESTRUCTIVE: they require confirm=true and you MUST ask the human first.

  • Analyzer workflow: analyzer_start -> analyzer_status / analyzer_read / analyzer_transactions (poll) -> analyzer_stop -> analyzer_summary / analyzer_export_pcap. analyzer_capture does a bounded start/wait/stop in one call. Capture plugs: TARGET-C = host side, TARGET-A = device under test, CONTROL = your PC.

  • After a capture, analyzer_decode_classes decodes the buffer at class level (standard requests and descriptors, HID reports/keys, CDC-ACM, mass-storage SCSI, CH34x/FTDI/CP210x serial data). A capture started mid-session misses the enumeration: pass hints keyed by device address, e.g. {"8": "ch340"} or {"5": {"vid": 6790, "pid": 29987}}.

  • Facedancer workflow: facedancer_start(kind=...) -> facedancer_command / facedancer_type_text / facedancer_serial_write -> facedancer_events / facedancer_logs -> facedancer_stop. The emulated device appears on the TARGET-C port.

  • Board I/O tools (board_info, led_set, gpio_list, gpio_read, gpio_write, board_debug_log) REQUIRE facedancer mode (Moondancer firmware). In any other mode they fail with [WRONG_MODE]: switch with run_gateware(target='facedancer').

  • Custom gateware workflow: gateware_toolchain_status (yosys / nextpnr-ecp5 / ecppack available?) -> build_gateware (Amaranth .py design -> .bit; never touches the board, may take minutes) -> configure_bitstream(path=) to load it into FPGA SRAM. build_gateware(elaborate_only=true) checks a design without the toolchain.

  • Errors start with a code in brackets: [NO_DEVICE], [WRONG_MODE], [BUSY], [INVALID_ARGUMENT], [CONFIRMATION_REQUIRED], [DRIVER], [HARDWARE], [UNSUPPORTED], [TIMEOUT], [BUILD_FAILED] (design or toolchain error: read the log tail).

  • If no device is detected, use the diagnose_connection prompt.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
server_statusA

Overall server state: package versions, platform, detected Cynthion mode and devices, analyzer capture status and Facedancer emulation status. Never fails when no hardware is connected.

list_devicesA

Non-invasively enumerate Cynthion-related USB devices (Apollo 1d50:615c, gateware 1d50:615b...) with their mode, strings, revision and interfaces. Does not touch the FPGA.

device_infoA

Detailed Apollo/Cynthion info: hardware name and revision, serial, firmware and USB API versions, ADC. force_offline / include_flash / include_fpga may stop the running gateware (use reconfigure_fpga to restore).

list_bundled_assetsA

List the gateware bitstreams (per board revision) and firmware images bundled with the installed cynthion package. No hardware needed.

get_logsB

Return recent server and library log lines (cynthion_mcp, apollo_fpga, facedancer, cynthion).

set_led_patternA

Set the Apollo debug-MCU LED pattern. Requires Apollo to own the CONTROL port (hands off from gateware).

reconfigure_fpgaA

Reboot the FPGA from SPI flash (soft reset + allow gateware USB takeover). Restores the flashed gateware (analyzer by default) and stops whatever was running.

force_fpga_offlineA

Hold the FPGA offline so Apollo owns JTAG and the CONTROL USB port. Stops the running gateware.

jtag_scanA

Enumerate the JTAG chain through Apollo and return IDCODEs (0x21111043 = LFE5U-12F). Needs Apollo to own the port: if gateware is running it is handed off (its USB disappears; use reconfigure_fpga or run_gateware to get it back). Does not alter the FPGA configuration or flash.

jtag_register_readA

Read a gateware debug register over the JTAG/SPI register bridge (only for gateware that exposes one, e.g. selftest). May hand off from gateware.

jtag_register_writeA

Write a gateware debug register over the JTAG register bridge (e.g. selftest register 2 = LEDs).

run_gatewareA

Load a bundled gateware (analyzer, facedancer or selftest) matching the board revision into FPGA SRAM. Volatile (lost on power cycle); stops the running gateware. facedancer may also write SoC firmware to flash.

configure_bitstreamA

Load an arbitrary bitstream file into FPGA SRAM over JTAG (volatile). Stops the running gateware.

flash_gatewareA

PERSISTENT: write a bundled gateware to SPI flash so it boots at power-on (facedancer also writes the SoC firmware). Requires confirm=true after asking the user. Reboots the FPGA afterwards.

flash_fileA

PERSISTENT: write a file to the SPI flash at the given offset. Overwrites existing content; requires confirm=true after asking the user.

read_flashA

Dump SPI flash content to a file. Stops the running gateware; the FPGA is rebooted from flash afterwards.

erase_flashA

PERSISTENT and DESTRUCTIVE: erase the whole SPI flash (gateware and SoC firmware). The FPGA will boot unconfigured until reflashed. Requires confirm=true after asking the user.

flash_infoA

Read the SPI flash JEDEC manufacturer/part and 64-bit unique ID over JTAG. Takes the FPGA offline (use reconfigure_fpga to restore the gateware).

update_apollo_firmwareA

PERSISTENT: update the Apollo debug MCU firmware over DFU. Do not unplug during the update. Requires confirm=true after asking the user.

run_selftestA

Load the selftest gateware and run the hardware self-tests (debug module, PHYs, HyperRAM). Stops the running gateware.

analyzer_infoA

Query the analyzer gateware: protocol version, supported speeds, decoded state register, serial. Requires analyzer mode (run_gateware target=analyzer).

analyzer_startA

Start a background USB capture between TARGET-C (host) and TARGET-A (device). Loads the analyzer gateware if needed (stops other gateware). Poll with analyzer_status/analyzer_read, end with analyzer_stop.

analyzer_stopA

Stop the running capture, drain the remaining data and keep the buffer for reading/export.

analyzer_statusA

Capture status: running flag, speed, packet/event/byte counters, buffer usage, errors.

analyzer_readA

Read decoded capture records (packets with PID/address/endpoint/data/CRC check, and bus events) from the buffer. Use next_seq for incremental polling. Works during and after a capture.

analyzer_transactionsB

Group captured packets into transactions (token + data + handshake), decoding SETUP requests.

analyzer_summaryB

Statistics of the buffered capture: packets per PID, devices/endpoints seen with byte counts, events, detected speed, duration and CRC errors.

analyzer_export_pcapA

Write the buffered capture to a pcap file (LINKTYPE_USB_2_0 = 288, opens in Wireshark/Packetry). Also available as resource cynthion://capture/last.pcap.

analyzer_clearA

Discard the buffered capture. Refused while a capture is running.

analyzer_captureA

Bounded one-shot capture: start, wait seconds (with progress), stop, and return status + summary (optionally exporting a pcap). Loads the analyzer gateware if needed.

analyzer_test_deviceA

Control the analyzer's built-in USB test device on the AUX port (1209:000a, r0.6+). Useful to verify a capture by wiring AUX to TARGET-A.

analyzer_decode_classesA

Decode the captured traffic at USB class level: standard control requests and descriptors (device model per address), HID reports (keys, mouse), CDC-ACM line coding / serial state, mass-storage CBW/SCSI/CSW, and serial data of CDC-ACM / CH34x / FTDI / CP210x adapters. Always decodes the whole buffer, then filters and pages (next_seq). Works during and after a capture; no hardware access. During a capture, next_seq points at the first item still open (e.g. a control transfer waiting for its status stage), so that item is returned again, completed, by the next page.

decode_usb_packetA

Decode one raw USB 2.0 packet: PID, address/endpoint/frame, payload, CRC5/CRC16 check, and SETUP request decoding for 8-byte DATA0 payloads. No hardware needed.

facedancer_list_device_kindsA

Describe the device kinds facedancer_start can emulate (keyboard, ftdi, mass_storage, proxy, script), their parameters and supported commands.

facedancer_startA

Start emulating a USB device with Facedancer in a background worker process. Loads the facedancer gateware if needed (stops other gateware, writes SoC firmware to flash). Stop with facedancer_stop.

facedancer_commandB

Send a command to the running emulated device (e.g. key_down, type_string, serial_write, status) and return its result.

facedancer_type_textA

Type text on the target host with the emulated keyboard (kind=keyboard must be running).

facedancer_serial_writeA

Send data from the emulated FTDI serial adapter to the target host (kind=ftdi must be running).

facedancer_statusB

Status of the Facedancer worker: running, kind, connected, pid, uptime, exit code, last error.

facedancer_logsB

Log output of the Facedancer worker process (facedancer library logs, stdout/stderr).

facedancer_eventsC

Events emitted by the emulation: type 'data' (received / proxied data, field 'source'), 'host_event' (field 'name': bus_reset, configured, set_address), connected, error, stopped.

facedancer_stopA

Stop the emulation (disconnects the emulated device) and report unhandled control requests.

board_infoA

Moondancer board info (name, firmware version, serial, part id, libgreat APIs). Requires facedancer mode.

led_setA

Drive one of the 6 FPGA LEDs through the Moondancer firmware. Requires facedancer mode.

gpio_listA

List the GPIO pins available through Moondancer (PMOD A pins A1-A4, A7-A10 and USER button). Requires facedancer mode.

gpio_readA

Configure a pin as input and read it. 'USER' reads the user button. Requires facedancer mode.

gpio_writeA

Configure a pin as push-pull output and drive it high or low. Requires facedancer mode.

board_debug_logA

Read the Moondancer firmware debug ring buffer (dmesg). Requires facedancer mode.

gateware_toolchain_statusA

Check the open-source ECP5 toolchain used by build_gateware (yosys, nextpnr-ecp5, ecppack): native installs (env overrides, PATH, OSS CAD Suite) or YoWASP packages. Never touches the board.

build_gatewareA

Build an Amaranth design for the Cynthion ECP5 into a .bit bitstream in a subprocess (yosys -> nextpnr-ecp5 -> ecppack), with progress. Never touches the board; load the result with configure_bitstream(path=). Design/toolchain failures are reported as [BUILD_FAILED] with the log tail.

Prompts

Interactive templates invoked by user choice

NameDescription
capture_usb_trafficStep-by-step guide to capture and analyse USB traffic of a device with the Cynthion analyzer.
emulate_keyboardGuide to emulate a USB keyboard with Facedancer and type text on the target host.
diagnose_connectionChecklist to diagnose why no Cynthion is detected.

Resources

Contextual data attached and managed by the client

NameDescription
statusServer, device and activity status (same as server_status).
assetsBundled gateware and firmware assets.
last_capture_pcapCurrent analyzer buffer as a pcap file (LINKTYPE_USB_2_0).
logsLast 500 server log lines.

TDQS

B3.4/5.0

Scored across 50 tools

Disambiguation3/5

The tools are grouped into recognizable hardware subsystems, but several boundaries are fuzzy: analyzer_capture overlaps with the analyzer_start/status/read/summary workflow, and run_gateware/configure_bitstream/flash_gateware/reconfigure_fpga/force_fpga_offline require careful reading to choose correctly. led_set versus set_led_pattern is also easy to confuse, though the descriptions often clarify mode requirements.

Naming Consistency3/5

All names use snake_case and readable prefix clusters, but the convention is mixed: analyzer_start and led_set are noun-first, while list_devices and set_led_pattern are verb-first. The set remains understandable, but it does not follow a single predictable verb_noun pattern.

Tool Count2/5

Fifty tools is very heavy for an agent to manage, even for a complex FPGA/USB hardware server. Several operations could be consolidated, especially the one-shot analyzer_capture against the multi-step analyzer tools and facedancer_serial_write against facedancer_command.

Completeness5/5

The surface is unusually complete for the domain: device discovery, gateware build/load/flash, JTAG, SPI flash, analyzer capture/decode/export, Facedancer emulation, GPIO, LEDs, logs, and firmware update are all covered. There are no obvious lifecycle gaps for the stated hardware-debugging purpose.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues