SuperAPIAI Directory

stm32-gdb-mcp

github.com · AI developer platforms

STM32 GDB MCP Server is a tool that lets AI agents debug STM32 firmware on real hardware. It interacts with debug servers such as OpenOCD/ST-Link/J-Link through GDB, supports flashing, breakpoints, memory/register inspection, FreeRTOS awareness, HardFault localization, and performance sampling, and returns decoded structured results rather than raw GDB text. It requires arm-none-eabi-gdb (or gdb-multiarch) and at least one GDB Server installed in PATH. The project provides a compact mode and composite tools (such as flash_and_run and debug_until) to reduce the number of calls, along with environment check, installation, and deployment scripts. It optionally supports a programmable USB Hub for power/data line control. All operations run locally by default, with no telemetry.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

STM32 GDB MCP Server is an MCP (Model Context Protocol) server designed to let AI agents debug STM32 firmware on real hardware. By driving GDB and GDB Servers (such as OpenOCD, ST-Link, and J-Link), it enables flashing, setting breakpoints, inspecting memory and registers, sensing FreeRTOS state, localizing HardFaults, and performing performance sampling, and it returns decoded structured evidence rather than raw GDB text.

Main capabilities include:

  • Flashing and running: composite tools such as flash_and_run compress multiple calls into one.
  • Debug control: supports breakpoints, single-stepping, pause/resume, and reading memory/registers.
  • RTOS awareness: can inspect FreeRTOS task states.
  • HardFault localization: provides HardFault classification and diagnosis.
  • Performance sampling: supports SWO/RTT and debugger polling sampling.
  • Structured output: returns decoded results and suggested_next_actions to reduce comprehension cost.
  • compact mode: enabled by default, showing only core tools; hidden tools can be invoked via call(tool, args), and tool_help can query the full schema.

Usage:

  1. Environment requirements: PATH must contain arm-none-eabi-gdb (or gdb-multiarch, or any ARM-capable GDB specified via STM32_GDB_MCP_GDB), as well as at least one GDB Server (openocd, JLinkGDBServerCL, or st-util). Running stm32-gdb-mcp-check-env checks the environment and prints installation commands for missing components.
  2. Installation: can be installed via pip install stm32-gdb-mcp or pip install -e . deploy.py can install the server, write the IDE's MCP configuration, and generate rule files in the firmware project. Configuration snippets for each client are in docs/install-ides.md.
  3. Helper commands: stm32-gdb-mcp-check-env, stm32-gdb-mcp-install, stm32-gdb-mcp-deploy.
  4. Quick start: detect_probe reads physical USB devices; probes of the same model are distinguished by serial number, and no automatic selection is made when multiple probes are present.

Applicable scenarios:

  • Embedded development and debugging using STM32 series MCUs.
  • Scenarios requiring AI agent assistance for firmware issue localization (such as HardFault, RTOS task anomalies).
  • Scenarios where you want to reduce the number of debugging calls and quickly go from symptom to root cause.

Key rules and limitations:

  • Read operations require the core to be halted; if target_unresponsive is returned, halt_execution must be executed first.
  • run_for_duration(sample=...) is a best-effort low-speed polling; for high sampling rates or reliable acquisition, use SWO or a firmware ring buffer.
  • A breakpoint timeout indicates the path was not reached and should not be retried as-is; instead, pause, capture state, confirm the hit count, read the gating conditions, and then adjust.
  • Write operations are protected: option bytes, IWDG, and WWDG are prohibited by default and require explicit permission via write_guard(action=policy).
  • Do not force-kill OpenOCD; use recover_session instead; the SWD debugging connection to the same probe is exclusive.
  • A stuck probe requires physical re-enumeration; the optional [hub] extra, combined with a programmable USB hub, can power off/data-line disconnect via tool calls.
  • The programmable USB hub is an optional feature that requires additional installation and configuration; hub operations have a confirmation mechanism and cross-server interlocking, and power loss during flashing may brick the board.
  • All operations run locally by default with no telemetry; only when the agent calls report_issue will an issue be submitted on GitHub via the local gh CLI logged-in identity, including the description, version, environment summary, and session tool call records.
  • For RISC-V or ESP32 debugging, a probe-rs-based server should be selected.

Information not yet provided: specific charging models, prices, a detailed platform compatibility list, performance benchmark data, etc. are not explicitly stated in the materials.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools