stm32-mcp
Provides integration with the STMicroelectronics STM32 toolchain, enabling headless creation, configuration, code generation, building, cleaning, and flashing of STM32 firmware projects via CubeMX, CubeIDE, and STM32 Programmer CLI.
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-mcp@stm32-mcp build the firmware in my project directory"
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 Model Context Protocol (MCP) Server
An open-source Model Context Protocol (MCP) server that drives the official STMicroelectronics STM32 toolchain from the command line. Designed specifically for AI coding assistants—including Claude Code and Google Antigravity—enabling autonomous, reliable, and headless embedded firmware development.
Key Features
100% Headless Operation: Never launches or drives a GUI. Interacts exclusively via:
STM32CubeMXscript mode (config load,project generate,exit)stm32cubeidec.exeEclipse CDT headless builderSTM32_Programmer_CLI.exefor hardware flashing and verificationarm-none-eabi-gccandarm-none-eabi-sizefor compilation and memory analysis
Structured Compiler Diagnostics: Parses GCC outputs into typed error/warning/note objects with precise file, line, and column coordinates. Never floods context windows with megabytes of unparsed build logs.
Safety Gates: Destructive actions (
stm32_cleanandstm32_flash) require explicit confirmation (confirm: true), preventing accidental code loss or unwanted board programming.Strict User-Code Boundaries:
stm32_patch_user_codeenforces paired, non-nested, uncorrupted/* USER CODE BEGIN */and/* USER CODE END */blocks, ensuring CubeMX regeneration never erases user logic.Zero Credential Handling: Does not handle or store ST logins or scrape downloads. If a target MCU firmware package is missing, the tool returns a clear, actionable message directing the developer to download it manually from st.com.
Enforced ASCII Path Validation: ST's legacy CLI tools fail abruptly on Windows paths containing Cyrillic, spaces, or Unicode characters. This server intercepts and rejects non-ASCII paths immediately with diagnostic guidance before invoking external tools.
Related MCP server: stm32-mcp
Supported Environments
Operating Systems: Windows 10/11, macOS, Linux
AI Clients:
Claude Code (
.claude-plugin/plugin.json)Google Antigravity (
antigravity/mcp_config.json)Any MCP-compliant client (Cursor, Zed, etc.)
Tool Reference
The MCP server exposes 9 dedicated tools covering the entire embedded development lifecycle:
Tool | Parameters | Description |
|
| Checks discovery status of CubeIDE, CubeMX, Programmer CLI, GCC, and installed HAL firmware packages. |
|
| Initializes a complete STM32 project ( |
|
| Inspects and parses an existing |
|
| Idempotently updates GPIO functions, peripheral pin assignments, and labels in the |
|
| Executes CubeMX in headless script mode to generate HAL drivers and peripheral initialization code. |
|
| Safely inserts or replaces code inside matching |
|
| Builds the project headlessly using CubeIDE, extracting structured diagnostics and Flash/RAM memory sizes. |
|
| Cleans build artifacts ( |
|
| Flashes the compiled binary to hardware via ST-LINK ( |
Installation & Setup
Prerequisites
Node.js: >= 20.0.0
STM32CubeIDE: Recommended version 1.15.0 to 1.19.0 (installed at default path
C:\ST\STM32CubeIDE_*or/opt/st/stm32cubeide).STM32Cube MCU Packages: Download desired target families (e.g.
STM32Cube_FW_F1_V1.8.6) from st.com and extract into~/STM32Cube/Repository.
Build from Source
git clone https://github.com/irrumi/stm32-mcp.git
cd stm32-mcp
npm install
npm run build
npm testAI Client Configuration
Claude Code
Add the plugin manifest to your project or Claude Code configuration:
{
"mcpServers": {
"stm32": {
"command": "node",
"args": ["<PATH_TO_PLUGIN>/dist/index.js"]
}
}
}Google Antigravity
Reference the included antigravity/mcp_config.json:
{
"mcpServers": {
"stm32": {
"command": "node",
"args": ["C:/path/to/stm32-mcp/dist/index.js"]
}
}
}Load the skills/stm32-firmware/SKILL.md skill into your Antigravity skills repository:
# Windows PowerShell
Copy-Item -Recurse -Path ".\skills\stm32-firmware" -Destination "$HOME\.gemini\antigravity\skills\"Worked Walkthrough: Blinky on STM32F103 (Blue Pill)
1. Verify Environment
// Prompt: "Check STM32 toolchain health"
// Tool called: stm32_doctor
{}Response: Reports paths to stm32cubeidec.exe, STM32CubeMX.jar, STM32_Programmer_CLI.exe, arm-none-eabi-gcc, and confirms STM32Cube_FW_F1 package is present.
2. Create Project
// Prompt: "Create a new STM32F103C8 project called blinky-f103"
// Tool called: stm32_create_project
{
"name": "blinky-f103",
"mcu": "STM32F103C8Tx",
"path": "C:/projects/stm32/blinky-f103",
"debug": "swd"
}3. Assign Pin Configurations
// Prompt: "Configure PC13 as an output for the onboard LED"
// Tool called: stm32_configure_pins
{
"iocPath": "C:/projects/stm32/blinky-f103/blinky-f103.ioc",
"pins": [
{ "pin": "PC13", "mode": "GPIO_Output", "label": "LED_STATUS" }
]
}4. Headless Code Generation
// Prompt: "Generate HAL code with CubeMX"
// Tool called: stm32_generate_code
{
"projectDir": "C:/projects/stm32/blinky-f103"
}5. Insert Application Code
// Prompt: "Add non-blocking blink logic using HAL_GetTick() inside while loop"
// Tool called: stm32_patch_user_code
{
"filePath": "C:/projects/stm32/blinky-f103/Core/Src/main.c",
"marker": "WHILE",
"mode": "replace",
"content": " static uint32_t last_tick = 0;\n if (HAL_GetTick() - last_tick >= 500) {\n last_tick = HAL_GetTick();\n HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);\n }"
}6. Headless Compilation & Memory Analysis
// Prompt: "Build the Debug configuration"
// Tool called: stm32_build
{
"projectDir": "C:/projects/stm32/blinky-f103",
"configuration": "Debug"
}Structured Output:
{
"success": true,
"summary": "Build finished successfully with 0 errors and 0 warnings.",
"diagnostics": [],
"memoryUsage": {
"flashBytes": 3844,
"ramBytes": 1580,
"text": 3824,
"data": 20,
"bss": 1560
}
}7. Program Target Hardware
// Prompt: "Flash the firmware to my connected Blue Pill"
// Tool called: stm32_flash
{
"projectDir": "C:/projects/stm32/blinky-f103",
"verify": true,
"reset": true,
"confirm": true
}Architecture & Security Considerations
Process Execution: All external commands are executed using
child_process.spawnwith explicit argument arrays andshell: false. Shell interpolation is strictly prohibited.Path Sanitization: All incoming file and directory paths are validated against ASCII character sets before any filesystem or process operation.
Non-Destructive Regeneration: Code injection checks BEGIN/END balance, marker matching, duplicate detection, and nesting protection.
License
MIT © irrumi
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
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 Connectors
Run, build, and validate firmware on virtual hardware from your AI agent. Hardware knowledge corpus.
Build, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Your AI Agent's Infrastructure Layer. Connect Claude, Copilot, Codex, or ChatGPT to 200+ managed open source services. Start databases, pipelines, and applications through natural language.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI assistants to interact with STM32 development boards via J-Link debugger using RTT communication, supporting connection, logging, memory operations, and firmware flashing through natural language.121MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code to build, flash, and communicate with STM32 hardware over SWD and serial, including multi-board management, live memory monitoring, and hardware sequences.24MIT
- FlicenseAqualityCmaintenanceEnables AI assistants to flash firmware, program memory, modify option bytes, erase chips, reset boards, and capture SWO printf traces for STM32 microcontrollers via STM32CubeCLT.12-
- AlicenseAqualityBmaintenanceMCP server that wraps STM32CubeMX CLI to let AI load .ioc projects, modify pin/peripheral configurations, generate HAL code, and export pinout tables.52MIT
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/irrumi/stm32-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server