mcp-stm32cubeide-server
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., "@mcp-stm32cubeide-serverCan you build and flash the firmware to the board?"
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.
mcp-stm32cubeide-server
An MCP (Model Context Protocol) server that lets AI coding agents (Claude Code / opencode / Claude Desktop) drive the full STM32 development loop — wire up → request → AI writes code → build → flash → debug → diagnose faults — end to end.
让 AI 编程助手(Claude Code / opencode / Claude Desktop 等)直接操控 STM32 开发全流程:接线 → 提需求 → AI 自己改代码 / 编译 / 烧录 / 验证。
中文文档为主。所有工具返回结构化 JSON,失败时携带明确错误信息,便于 AI 精确处理。
功能一览(17 个工具)
类别 | 工具 | 说明 |
环境 |
| 扫描 CubeIDE / CubeMX / CubeProgrammer / GDB / OpenOCD 安装路径,排查"工具未找到" |
工程 |
| 扫描目录自动识别 STM32 工程(AI 无需手动填路径) |
工程 |
| 读取 MCU 型号、构建配置、源文件数 |
代码生成 |
| 从 |
构建 |
| CubeIDE headless 编译(Clean Build / 增量 / 仅清理) |
烧录 |
| CubeProgrammer 烧录 |
烧录 |
| 通过 GDB 精确烧录 |
Flash 操作 |
| 读取芯片 Flash 验证 / 备份、整片擦除 |
串口 |
| 枚举 COM 口;采集 UART 日志验证固件行为 |
调试 |
| 烧录运行,自动捕获 HardFault / BusFault / UsageFault / MemManage 并解析故障寄存器原因 |
调试 |
| OpenOCD 状态查询、暂停 / 恢复目标 |
OLED 字库 |
| 调用波特律动(led.baud-dance.com)官方取模接口给工程 |
oled_add_zh_font与波特律动取模助手/串口助手的字模完全一致(文泉驿点阵字,16x16 列行式阳码),无需再打开浏览器取模,取到的字模可直接用OLED_PrintString显示。
Related MCP server: io.github.microhenrio/openocd-mcp
环境要求
Python 3.10+,
pip install -r requirements.txt(mcp>=1.0.0、pyserial>=3.5)至少安装一个 ST 工具(CubeIDE / CubeMX / CubeProgrammer 任意组合)
工具链自动发现
按顺序查找:环境变量 → PATH → Windows 注册表 → 常见安装位置。大部分情况无需配置。
工具 | 环境变量 |
STM32CubeIDE |
|
STM32CubeMX |
|
STM32CubeProgrammer |
|
arm-none-eabi-gdb |
|
OpenOCD |
|
OpenOCD 脚本目录 |
|
安装 / 注册
opencode — opencode.json
{
"mcp": {
"stm32cubeide": {
"type": "local",
"command": ["python", "D:\\path\\to\\mcp-stm32cubeide-server\\server.py"],
"enabled": true
}
}
}Claude Code / Claude Desktop — .mcp.json / claude_desktop_config.json
{
"mcpServers": {
"stm32cubeide": {
"command": "python",
"args": ["D:\\path\\to\\mcp-stm32cubeide-server\\server.py"]
}
}
}路径请替换为你克隆仓库后的实际路径。建议
command使用 Python 绝对路径(避免 PATH 混入其他版本)。
典型自主编程流程
list_projects找到工程AI 直接修改源码 / 修改
.ioc后generate_codebuild_project编译(出错则读错误信息修到通过)flash_firmware或debug_flash烧录serial_monitor采集串口日志验证行为;崩溃则debug_run拿到故障寄存器诊断需要显示新汉字时,
oled_add_zh_font自动取模并集成进font.c
运行测试
python -m unittest test_server -v项目结构
server.py # MCP 注册与工具路由(入口)
tools.py # 各工具的 async 实现(含命令构造)
discovery.py # 工具链路径发现(env / PATH / 注册表 / 浅层扫描 + 缓存)
process.py # 子进程执行(超时杀进程树)+ OpenOCD 会话管理
mcu.py # MCU 型号识别 + 故障寄存器诊断解析
project.py # .ioc / .elf 查找、工程信息、工程扫描
serial_monitor.py # 串口采集(pyserial,后台线程)
fontgen.py # 汉字字模生成(波特律动官方取模接口 + 本地 PIL 兜底)
test_server.py # 单元测试 / 冒烟测试实现要点
全 async:所有工具为
async def,无嵌套asyncio.run(),支持并发调用进程树清理:Windows 超时用
taskkill /T /F,不残留 CubeIDE / OpenOCDOpenOCD 就绪探测:TCP 轮询端口而非固定 sleep;端口冲突自动避让
编码兼容:工具输出按 UTF-8 / GBK 自动解码,中文路径可用
安全:所有命令用参数列表传入(无 shell 注入面);工具发现仅查已知位置
日志走 stderr:stdout 是 MCP 传输通道,不得污染
许可证
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 Servers
- 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
- AlicenseAqualityBmaintenanceDebug microcontrollers directly from Claude. This is an MCP server that drives OpenOCD, letting Claude flash firmware, control execution, and inspect a running target — and read your variables and peripheral registers by name instead of raw addresses.394MIT
- Alicense-qualityBmaintenanceMCP server for simulating firmware on virtual microcontroller instances, allowing AI agents to upload, run, and read UART output from supported boards such as STM32 and Nordic.15MIT
- Alicense-qualityAmaintenanceMCP server for Agentic Hardware-in-the-Loop testing, enabling AI agents to probe, flash, reset, and validate embedded firmware on real hardware via bounded MCP tools.10Apache 2.0
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
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/Helistana/mcp-stm32cubeide-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server