stm32-stlink-mcp
Provides tools for debugging and flashing STM32 microcontrollers via ST-LINK probes, including session management, breakpoints, memory/register access, expression evaluation, and standalone flashing.
Click on "Install 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., "@stm32-stlink-mcpconnect to STM32 and set a breakpoint at main"
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.
stm32-stlink-mcp
MCP server for debugging STM32 microcontrollers over ST-LINK, built on STMicroelectronics' own
STM32CubeCLT toolset — ST-LINK_gdbserver, STM32_Programmer_CLI, and arm-none-eabi-gdb
(driven via GDB/MI2). No OpenOCD, J-Link, or probe-rs involved.
Architecture
A debug session is a pair of child processes, exactly mirroring ST's own documented workflow (UM2576, "STM32CubeIDE ST-LINK GDB server"):
arm-none-eabi-gdb --interpreter=mi2 --(TCP, target extended-remote)--> ST-LINK_gdbserver --(USB)--> ST-LINK --(SWD)--> STM32arm-none-eabi-gdb is driven in MI2 mode so the server gets source-level stepping, symbolic
breakpoints, and symbol-aware expression evaluation for free, instead of hand-rolling the GDB
Remote Serial Protocol. ST-LINK_gdbserver owns the USB handle to the probe for the lifetime of
the session; flashing via gdb's load (MI: -target-download) is transparently delegated by the
server to STM32CubeProgrammer, so no session teardown is needed to reflash. A standalone
one-shot flash (flash_standalone, no session required) invokes STM32_Programmer_CLI directly
and therefore conflicts with an already-open session on the same probe — see the tool description.
Related MCP server: dbgprobe-mcp-server
Setup
npm install
npm run buildRequires STM32CubeCLT to be installed and its bin/ directories reachable — either already on
PATH (the CLT installer does this by default) or via STMCP_CUBECLT_PATH / per-tool overrides.
Run npm run doctor to check.
Running
node dist/index.js serve # starts the MCP server on stdio (default mode)
node dist/index.js doctor # pre-flight check: tool resolution, connected probes, udev rules
node dist/index.js doctor --jsonRegistering with an MCP client
{
"mcpServers": {
"stm32-stlink": {
"command": "node",
"args": ["<path-to-this-repo>/stmcp/dist/index.js"]
}
}
}Configuration (environment variables)
Variable | Default | Purpose |
| — | Per-binary override (highest priority) |
| — | CubeCLT install root; subpaths resolved via |
| — | Default probe serial (omit to auto-select if exactly one is attached) |
|
| Default MCU device string |
|
|
|
|
| SWD/JTAG clock |
|
| Concurrent debug session cap |
|
| How long to wait for "Waiting for debugger connection..." |
|
|
|
| — | Optional log file (stderr always used regardless — stdout is reserved for MCP framing) |
|
| Enables the erase path |
|
| Enables |
|
| Allows |
| (unrestricted) | Comma-separated allowlist roots for ELF/bin file arguments |
|
| Max size for file arguments |
|
| Flash address window for the write guard (default: 128KB, STM32G431CB) |
Tools
Domain | Tool | Purpose |
Probe |
| List connected ST-LINK probes |
Session |
| Spawn gdbserver+gdb, load ELF symbols, connect |
Session |
| Clean session teardown |
Session |
| Session info (one, or all) |
Flash |
| One-shot flash via STM32_Programmer_CLI, no session needed |
Flash |
| Reflash via gdb |
Execution |
| Resume/continue |
Execution |
| Interrupt |
Execution |
| Reset (monitor reset [halt]) |
Execution |
| Step over/into/out |
Breakpoints |
| By file:line, symbol, or |
Memory |
| Raw memory access (write is guarded) |
Registers |
| Named core registers |
Registers |
| One-call Cortex-M SCB fault register dump (CFSR/HFSR/... decoded) |
Expressions |
| Symbol-aware evaluation via gdb MI |
Deferred to v2
SVD peripheral register tools (memory_read/write + evaluate_expression already reach everything by
address), live/streaming memory polling, a plugin system, per-chip memory-region allowlists,
arbitrary gdb monitor passthrough, and option-bytes/RDP tools (bricking-capable, intentionally
out of scope).
RTT
RTT (SEGGER Real Time Transfer — live, non-halting console/variable tracing) is intentionally
not implemented in this server. ST-LINK_gdbserver's GDB/MI stub has no non-stop mode, so
reading memory through this server's debug_connect session requires halting the core first —
which defeats RTT's purpose. The correct mechanism is direct AP memory access that never halts
the core (confirmed by reading ST's own STM32CubeMonitor source, which uses exactly this, and by
STM32_Programmer_CLI's -r32fast).
That's what strtt already does, and
strtt-mcp wraps it as its own MCP server
(strtt_start/strtt_stop/strtt_status/strtt_read/strtt_write). Register it alongside
this server rather than through it:
{
"mcpServers": {
"stm32-stlink": { "command": "node", "args": ["<...>/mcp-server/dist/index.js"] },
"strtt": {
"command": "node",
"args": ["<path-to-strtt-repo>/mcp/dist/index.js"],
"env": { "STRTT_BIN": "<path-to-strtt-binary>" }
}
}
}Start strtt_start with tcp: true to connect through the shared ST-LINK Server instead of
claiming the USB device directly — this lets it run concurrently with an open debug_connect
session here, since GdbServerProcess always passes -t/--shared to ST-LINK_gdbserver.
Without tcp: true, strtt and an open debug session will contend for the same probe.
Hardware verification runbook
With an ST-LINK and target attached:
node dist/index.js doctor # confirm probe + tools resolve
npx @modelcontextprotocol/inspector node dist/index.js # interactive tool testingThen, via the inspector or an MCP client:
list_probes→ the probe's serial appears.debug_connect { elfPath, device, interface: "swd", serial }→ returns asessionId.breakpoint_set { sessionId, location: "main" }→ returns a breakpoint number.debug_run { sessionId }→ halts withreason: "breakpoint-hit".register_read { sessionId, registers: ["pc","sp","lr","r0"] }.evaluate_expression { sessionId, expression: "<a known global>" }.read_fault_registers { sessionId }→ benign/zero flags right after reset.debug_disconnect { sessionId }→ confirm no orphaned processes:ps aux | grep -E 'ST-LINK_gdbserver|arm-none-eabi-gdb'.flash_standalone { file, reset: "hard", run: true }with no session open.Negative test: open a session, then call
flash_standaloneon the same serial → expectDEVICE_BUSY.
Note: debug_connect halts the target's CPU. Don't attach to a board that's actively driving
actuators/outputs in a way where an unplanned halt would be unsafe, without first confirming that's OK.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA GDB/MI protocol server based on the MCP protocol, providing remote application debugging capabilities.68MIT
- AlicenseAqualityCmaintenanceStateful MCP server for driving debug probes (J-Link) to flash, debug, and inspect embedded targets. Enables AI agents to perform flash, memory, breakpoint, and ELF/SVD-aware operations conversationally.4111MIT
- AlicenseNot gradedqualityCmaintenanceMCP 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.2MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides comprehensive debugging capabilities for J-Link debuggers, enabling memory, flash, register, and RTT operations through AI assistants.32MIT
Related MCP Connectors
MCP server for Klever blockchain smart contract development.
An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform
A MCP server built for developers enabling Git based project management with project and personal…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/phryniszak/stmcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server