Skip to main content
Glama
stm32c0-mcp
by praderppp

stm32c0-mcp

MCP server + CLI for scaffolding, building, and flashing bare-metal STM32C011 firmware, driving the STM32CubeCLT command-line toolchain (/opt/ST/STM32CubeCLT_1.22.0 by default — override with STM32CUBECLT_ROOT).

Targets the STM32C011 family (default part: STM32C011F6Ux, matching the STM32C0116-DK Discovery kit). No HAL/CMSIS pack dependency — scaffolded projects are genuinely bare-metal (hand-written vector table, linker script, and a GPIO-register blinky).

Setup

pyenv local 3.10.0
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"

Related MCP server: Firmware MCP Server

CLI usage

.venv/bin/stm32c0 scaffold /path/to/project [--project-name NAME] [--part STM32C011F6Ux] [--force]
.venv/bin/stm32c0 build /path/to/project [--clean]
.venv/bin/stm32c0 flash /path/to/project/build/firmware.elf [--serial-number SN] [--shared]
.venv/bin/stm32c0 list-probes [--shared]

Multiple probes

STM32_Programmer_CLI's direct USB path only ever sees a single ST-LINK: with two connected it finds one and rejects the other with Error: Serial number not found, which looks like a hardware fault but isn't. Pass --shared to route through ST-LINK server, which sees them all:

.venv/bin/stm32c0 list-probes --shared                       # every probe's serial
.venv/bin/stm32c0 flash fw.elf --serial-number SN --shared   # target one of them

ST-LINK server is started automatically when --shared is used. It ships with STM32CubeIDE rather than STM32CubeCLT (expected at /usr/local/bin/stlink-server, override with STLINK_SERVER), so --shared is opt-in: shared connections fail outright where that server isn't installed. --shared listings report serial numbers only, without firmware versions.

MCP server

.venv/bin/stm32c0-mcp

Exposes scaffold_project, build, flash, and list_probes as MCP tools. See docs/registration.md for wiring it into Claude Code.

Tests

.venv/bin/pytest -v

tests/test_build_smoke.py requires no hardware. tests/test_flash_hardware.py is skipped automatically unless an ST-LINK probe is connected.

Layout

  • src/stm32c0_mcp/ — package: parts.py (device memory-map table), config.py (toolchain discovery), stlink_server.py (ST-LINK server discovery/startup for multi-probe access), scaffold.py/build.py/flash.py/probes.py (drivers), mcp_server.py/cli.py (thin wrappers), templates/bare_metal/ (project skeleton templates).

  • examples/blinky/ — a committed, buildable instance of the scaffolded project; doubles as the smoke-test fixture.

Available Tools

4 tools
buildA

Configure (if needed) and build an STM32C011 project with CMake+Ninja+arm-none-eabi-gcc. Returns success, compiler stdout/stderr, and the built .elf/.bin/.hex paths plus arm-none-eabi-size flash/RAM usage.

Inputs: project_dir (required), clean, build_dir.

flashA

Flash a .elf/.bin/.hex to an STM32C011 over SWD via ST-LINK using STM32_Programmer_CLI. Set serial_number to target one probe among several.

Inputs: file_path (required), part, erase, verify, +3 more.

list_probesA

List connected ST-LINK probes (serial numbers) for multi-probe setups.

Inputs: no named parameters.

scaffold_projectA

Create a minimal bare-metal CMake/Ninja STM32C011 project skeleton (linker script, startup code, one blinky main.c) at project_dir. Does not overwrite an existing non-empty directory unless force=True.

Inputs: project_dir (required), part, force, project_name.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool targets a distinct step in the development workflow: scaffold, build, flash, and discover probes. There is no overlap in purpose; even list_probes clearly supports the flash tool.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern: scaffold_project, build, flash, list_probes. The pattern is clear and predictable.

    Tool Count5/5

    Four tools is well-scoped for the server's purpose of creating, building, and flashing STM32C011 projects. Each tool is necessary and there are no redundant additions.

    Completeness5/5

    The set covers the full lifecycle from project scaffolding through building and flashing. Probe listing addresses multi-probe setups, leaving no obvious dead ends for the stated workflow.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for embedded debugging based on probe-rs, providing 22 tools for ARM Cortex-M and RISC-V microcontrollers, including connection, memory operations, breakpoints, flash programming, and RTT communication.
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A local stdio MCP server for embedded firmware automation that exposes tools to build, flash, reset devices, and capture serial logs through a device configuration file.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      MCP server that wraps STM32CubeMX CLI to let AI load .ioc projects, modify pin/peripheral configurations, generate HAL code, and export pinout tables.
      5
      29 PyPI
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that lets AI coding agents drive the full STM32 development loop—code generation, build, flash, debug, serial monitoring, and fault diagnosis—end to end via CubeIDE, CubeMX, CubeProgrammer, OpenOCD, and GDB.
      1
      MIT