vscode-cube-mcp
This MCP server wraps STM32CubeMX's command‑line scripting mode, letting AI assistants automate STM32 project workflows without opening the GUI.
cubemx_load – Read key configuration (pins, peripherals, clock) from an
.iocfile (read‑only).cubemx_configure – Load an
.ioc, apply a sequence ofsetcommands to modify it, and save.cubemx_generate – Generate HAL code from an
.iocinto a specified directory.cubemx_export_pinout – Export the pin configuration to a CSV file (read‑only).
cubemx_new_project – Create a new project from embedded templates (MCU, toolchain, clock, peripherals).
cubemx_remove_peripheral – Remove a peripheral from an
.ioc.cubemx_add_source – Add custom source files to the CMake build list.
cubemx_script – Execute arbitrary CubeMX script commands as an advanced escape hatch.
Note:
cubemx_new_project,cubemx_remove_peripheral, andcubemx_add_sourceare described in the README but may not be present in the current server schema.
For security, all file paths are restricted to pre‑defined allowed root directories.
Allows generating and modifying CMake build configurations for STM32 projects, including adding custom source files to CMake source lists.
Click on "Deploy 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., "@vscode-cube-mcpLoad OLED_HAL.ioc and generate HAL code"
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.
Vscode_cube_mcp
项目定位:对于48脚的芯片来说,就算打开GUI界面配置端口,也消耗不了多长时间。 但是对于100脚甚至144脚的芯片来说,此项目就能提供方便。
为什么用(用之前 vs 用之后)
用之前:配置一个 STM32 工程,你得打开 CubeMX 图形界面——选芯片、拖时钟树、 点引脚、配外设,每一步都在 GUI 里点,重复劳动多,还容易漏。
用之后:在 AI 对话里直接说一句:
「使用 vscode-cube-mcp 的内置 Tool,参考 SPL_OLED 工程下的文件; 用 STM32F103C8T6 生成一个工程:PB14 配成 GPIO 输出(接 LED)、 PB8 做 SCL、PB9 做 SDA 配 I2C1、TIM2 配内部时钟(1s 周期)。 配置到 HAL 骨架为止,LED 闪烁和 OLED 显示的业务代码我自己写。」
工具自动生成整个 HAL 工程;想改配置,继续说就行,全程不用打开 GUI。
MCP(Model Context Protocol) server,封装 STM32CubeMX 官方命令行脚本模式(-q),
让 AI 助手可以直接加载 .ioc 工程、改引脚/外设配置、生成 HAL 代码、导出引脚表,全程无需打开 CubeMX GUI。
能力边界:本工具只生成工程配置与 HAL 骨架(引脚、外设、时钟、工具链), 不负责应用逻辑代码(LED 闪烁、OLED 显示内容、传感器驱动等)——业务代码请在生成后的工程里自己写。
Related MCP server: stm32c0-mcp
功能一览
工具 | 说明 |
| server 内置帮助:工具清单、可用模板、外设配置方法(陌生 agent 建议先调用) |
| 加载 .ioc 并回读关键配置(只读) |
| 加载 .ioc,执行 |
| 加载 .ioc 并生成 HAL 工程 |
| 导出引脚配置 CSV(只读) |
| 从零生成新工程(内置模板库,无需预先 .ioc) |
| 从 .ioc 移除外设 |
| 把自定义源文件加入 CMake 源列表 |
| 任意 CubeMX 脚本命令序列(高级/原始脚本接口) |
要求
Python >= 3.10(Windows 建议用官方安装版,不要用 msys2/Git 自带的 python,见 FAQ)
STM32CubeMX 6.x(ST 专有软件,请从 ST 官网 免费下载并自行遵守其许可;本工具仅运行时调用其命令行,不包含、不修改其代码)
快速开始(Windows)
三步,约 2 分钟。以下命令都在 PowerShell 里执行。
第 1 步:安装
pip install vscode-cube-mcp装完后先验证一下(能打印出版本号就说明装好了):
python -m pip show vscode-cube-mcp如果提示
pip不是命令或装到了奇怪的位置,先看文末 FAQ「pip 报错 / 装不上」。
第 2 步:配置环境变量(永久生效)
用 setx 写入用户级环境变量($env: 的临时写法只对当前窗口有效,重启客户端后就没用了,不要用):
setx ST_CUBEMX_EXE "C:\MINE\STM\STM\STM32CubeMX.exe"
setx ST_CUBEMX_ALLOWED_ROOTS "C:\MINE\STM32Project"把路径换成你自己的:
ST_CUBEMX_EXE:本机STM32CubeMX.exe的完整路径;ST_CUBEMX_ALLOWED_ROOTS:允许 AI 访问的工程根目录(多个用;分隔,如C:\MINE\STM32Project;C:\MINE\OTHER)。
设置完成后关掉并重新打开客户端(Reasonix / VS Code 等),环境变量才会被读到。
第 3 步:接入 MCP 客户端
把下面配置加到你所用客户端的 MCP server 列表里(以 mcpServers 配置为例):
{
"mcpServers": {
"Vscode_cube_mcp": {
"command": "python",
"args": ["-m", "cubemx_mcp"],
"env": {
"ST_CUBEMX_EXE": "C:/MINE/STM/STM/STM32CubeMX.exe",
"ST_CUBEMX_ALLOWED_ROOTS": "C:/MINE/STM32Project"
}
}
}
}说明:
env里的路径和上面第 2 步二选一即可(都设也行,env优先)。如果不写env,就必须依赖第 2 步的系统环境变量;JSON 里 Windows 路径建议用正斜杠(
C:/...)或双反斜杠(C:\\...),避免转义问题;
"command": "python"要求python在 PATH 里且就是装有本包的解释器;如果不对,改成"command": "py", "args": ["-m", "cubemx_mcp"]或写解释器完整路径(见 FAQ)。
验证
打开客户端,发一条消息让 AI 调用
cubemx_load(给它一个 .ioc 路径);或在终端手动冒烟:
python -m cubemx_mcp启动后不报错、不立刻退出,即 server 正常(它是 stdio 服务,会挂起等待输入,Ctrl+C退出)。
配置项(环境变量)
变量 | 默认 | 说明 |
| PATH 中的 | STM32CubeMX 可执行文件完整路径 |
| 当前工作目录 | .ioc / 生成路径允许访问的根目录, |
|
| 单次 CubeMX 调用超时秒数,机器慢可调大 |
安全设计:所有 .ioc / 生成路径必须在
ST_CUBEMX_ALLOWED_ROOTS白名单内,白名单外的路径会被拒绝。
使用示例
让 AI 助手做的事情都会通过上述 9 个工具完成,例如:
「第一次用你,先看看你能干什么、有哪些芯片模板」→
cubemx_help(陌生 agent 建议第一个调用)「加载
D:\proj\Blink.ioc,把 PB13 改成 GPIO_Output 并加标签 LED」→cubemx_configure「用 STM32F103C8T6 从零建一个工程,LED 在 PB13,带 I2C1」→
cubemx_new_project「把 OLED.c 加进编译,重新 generate 后也保留」→
cubemx_add_source
内置模板库(templates/,按芯片型号命名的最小模板:仅芯片标识 + 基础时钟 72MHz/SWD/SysTick,无外设,如 STM32F103C8T6.ioc);外设全部由 cubemx_new_project 的 commands set 命令现配,TIM 内部时钟由配置补丁自动处理。新增芯片只需把该芯片 6.18 原生 .ioc 放进 templates/。
cubemx_new_project 参数(设计原则:默认值而非强制)
参数 | 默认 | 说明 |
| 必填 | 工程名(仅字母/数字/下划线) |
| 必填 | 生成目标目录(须在白名单内) |
|
| 芯片型号,匹配 |
| 按 mcu 查找 | 指定模板 .ioc 路径,优先于 mcu |
|
| 目标工具链,可覆盖为 |
|
| 每个外设生成独立 |
|
| PLL 时钟源,默认外部晶振 72MHz; |
|
| PLL 倍频(8MHz×9=72MHz),可覆盖(如 HSI 配 16 → 64MHz) |
| 空 |
|
默认值而非强制:默认生成 CMake 工具链 + 外设独立
.c/.h+ 72MHz(HSE×9), 显式传其他值即覆盖,不会被工具卡死。写 .ioc 时会按默认值补回RCC.PLLSourceVirtual=HSE(CubeMX 的 set RCC 命令可能把该字段弄丢,导致时钟静默降级 HSI);生成后若仍丢失,返回值会附 ⚠ 时钟警告。
升级到新版本
升级到 PyPI 最新版:
python -m pip install -U vscode-cube-mcp
python -m pip show vscode-cube-mcp # 确认版本号升级后必须重启客户端(Reasonix / VS Code 等),MCP server 进程才会加载新代码; 若重启后工具参数仍是旧的,等几秒或新开一个会话(host 侧工具快照可能滞后)。
维护者发布新版流程(改版本号 →
python -m build→twine upload→git tag+ push) 见README.dev-notes.md。
常见问题 FAQ
Q:pip 装上了,但 python -m cubemx_mcp 报 ModuleNotFoundError: No module named 'cubemx_mcp'
装的解释器和 python 指向的不是同一个。确认:
python -m pip show vscode-cube-mcp # 能显示才算装在当前 python 上若 python 指向 msys2/Git/系统 Store 的 python,换成官方 Python(py -m pip install vscode-cube-mcp,py -m cubemx_mcp),或直接写解释器全路径到客户端配置。
Q:客户端里 AI 报找不到 STM32CubeMX / _find_cubemx 失败
环境变量没传进 server 进程。检查:① 是否用了 setx(临时 $env: 会失效);② 是否重启了客户端;③ ST_CUBEMX_EXE 路径是否存在(在 PowerShell 里 Test-Path "C:\...\STM32CubeMX.exe" 应为 True)。
Q:报错说路径不在允许范围内(allowed roots)
把工程所在目录加进 ST_CUBEMX_ALLOWED_ROOTS(多个用 ;),改完重启客户端。如果写在客户端 env 里,检查 JSON 的 ; 和路径是否被转义破坏了。
Q:CubeMX 调用很慢或超时
首次启动 CubeMX 较慢是正常的;把 ST_CUBEMX_TIMEOUT 调大(如 600)。另外确认没有残留的 CubeMX / Java 进程占着工程文件。
Q:CubeMX 弹「Resolve Clock Issues」
通常是 .ioc 时钟树不自洽(如 HSE 未启用但 PLL 选了 HSE)。这个属于工程配置问题,详见 README.dev-notes.md 的「从零配置时钟实战」。
开发与测试
python -m unittest test_cubemx_mcp -v # 运行单元测试(不依赖 CubeMX)技术栈:Python >= 3.10 + mcp SDK 2.x(stdio);打包 setuptools + build + twine;目标平台 Windows(跨平台可用)。
许可与依赖声明
本工具代码:MIT License(见
LICENSE)mcp SDK(唯一 Python 依赖):MIT License(modelcontextprotocol/python-sdk)
STM32CubeMX:ST 专有软件,运行时外部调用,需用户自备并遵守其许可条款
更多资料
examples/:真实可复现案例(LED 点灯 / I2C OLED / TIM3 PWM + 输入捕获,指令可直接复制)docs/install-claude-code.md:Claude Code(终端版)安装配置指南README.dev-notes.md:开发笔记——ST 扩展识别工程踩坑、从零配置时钟实战、各外设实测状态与能力边界、TIM 配置补丁原理
更新日志
0.4.2(2026-08-27)
工程化补强(非功能迭代,为「全外设完善」里程碑铺路):
CI:新增 GitHub Actions(windows-latest,Python 3.10-3.13 矩阵;
ruff check+ruff format --check+pytest覆盖率门槛 80%)测试:47 → 72 个,覆盖率 71% → 94.9%(新增模板补丁、新建工程调度层、工具包装层、help topics 等测试;覆盖率 <80% 即失败)
代码质量:配置 Ruff(保守规则集)+ pre-commit 钩子;TIM 注入器硬编码枚举抽为
_TIM_*常量对照表(6.18 实测来源);修复 Python 3.10/3.11 的 f-string 反斜杠语法兼容问题(此前低版本无法导入)新目录
examples/:3 个可复现案例(LED 点灯 / I2C OLED / TIM3 PWM + 输入捕获)文档:README 增加「项目定位自白」与「用之前 vs 用之后」说明;明确能力边界(只做 .ioc 配置与 HAL 骨架,应用业务代码由用户编写);术语统一为通用说法(最小模板 / 配置补丁 / 内置帮助 / 基准样本等);
0.4.1(2026-08-27)
新功能:TIM PWM 配置生成(
_inject_tim_pwm)——命令set ip parameters TIM3 PWM <pin> <signal> [Prescaler n] [Period n] [Pulse n]例:set ip parameters TIM3 PWM PA6 S_TIM3_CH1 Prescaler 72 Period 100 Pulse 50→ 10kHz / 50%新功能:TIM 输入捕获配置生成(
_inject_tim_input_capture)——命令set ip parameters TIM2 InputCapture <pin> <signal> [Prescaler n] [Period n]例:set ip parameters TIM2 InputCapture PA0-WKUP S_TIM2_CH1_ETR Prescaler 72 Period 65535自动配 IC1 上升沿 + IC2 下降沿参数,TIM2 中断自动启用配置生成逻辑复用公共骨架
_rebuild_ioc_lines/_finish_ioc_write(IP/Pin 重建、 IPNb/PinsNb 同步、functionlistsort 段、幂等),与_inject_tim_internal_clock同款机制.ioc 内部枚举名对照表(6.18 实测):
PWM Generation1 CH1/Input_Capture1_from_TI1(GUI 名 ≠ .ioc 内部名,写错会被 CubeMX load 时静默丢弃);PA0 信号名是组合名S_TIM2_CH1_ETR;PWM 模式名空格转义\;Channel 键值TIM_CHANNEL_N已知限制(实测):CubeMX 只生成 IC1 的
sConfigIC,测占空比的 IC2 需在 main.c 手动HAL_TIM_IC_ConfigChannel补齐(示例见cubemx_help(topic="tim"))文档:
cubemx_helptim topic 补充 PWM/输入捕获命令、F103 引脚→信号映射表、 IC2 补配示例;README.dev-notes.md 新增「0.4.1」实测记录(基准样本逐行对齐)测试:40 → 47 个(新增 PWM/输入捕获配置生成回归:幂等、替换、非法参数、Channel 键)
真机验证:注入 .ioc 经 6.18 generate 后与基准样本(
PWM_IC_OLED.ioc)逐行一致, 生成 tim.c 参数正确(PWM 10kHz/50% + IC RISING)版本规划:0.5.0 预留给"完善所有外设"里程碑;全部外设完善前,功能迭代走 0.4.x
0.4.0(2026-08-26)
架构:最小模板 + 外设配置补丁——模板从"整机配置"精简为每芯片 1 个基础种子 (
STM32F103C8T6.ioc= 芯片标识 + 72MHz/SWD/SysTick,无外设),外设全部由cubemx_new_project的commandsset 现配,模板数量不再随配置组合爆炸新功能:
cubemx_help内置帮助工具(第 9 个工具)——完整指南 + templates/ 动态扫描 + 分主题(gpio/i2c/tim/rcc/remove/add_source),陌生 agent 接入后第一件事调用它TIM 内部时钟:配置补丁(
_inject_tim_internal_clock)替代借壳法——命令含set ip parameters TIMx ClockSource TIM_CLOCKSOURCE_INTERNAL时自动注入 6.18 验证过的 标准表达(任意 TIM/芯片,可附Prescaler/Period自定义);借壳法退役删除模板库精简:删除旧组合模板
tim_template.ioc/tim2_internal.ioc与templates/README.md(知识迁入 README.dev-notes.md);缺芯片模板时报错带可用模板清单与生成指引修复:
安全:
_check_path白名单前缀绕过漏洞;cubemx_add_source输入校验(拒绝路径穿越/绝对路径/换行注入)cubemx_add_source锚点找不到时静默假成功 → 改抛错cubemx_remove_peripheral补Mcu.Pin重排与Mcu.PinsNb修正;functionlistsort 段删除泛化_run_script超时后强杀 CubeMX 进程树(防残留 Java 进程占工程文件锁)cubemx_new_projectset 命令失败立即中止;支持Prescaler/Period自定义配置生成/移除逻辑的行尾换行匹配、IPNb/PinsNb 缺失防御等健壮性修复
测试:20 → 40 个(新增回归测试覆盖上述修复)
0.3.1(2026-08-07)
修复:pip 安装版
cubemx_new_project找不到模板(_project_template补sys.prefix/templates查找路径——data-files 安装时把模板放在sys.prefix下)
0.3.0(2026-08-07)
新功能:
cubemx_new_project参数化,设计原则 "默认值而非强制":toolchain默认"CMake",可覆盖(EWARM V8.32 / MDK-ARM 等)couple_files默认True(每个外设生成独立.c/.h),可覆盖为False集中到 main.cclock_source默认"HSE"+pll_mul默认9(8MHz×9=72MHz),写 .ioc 时按默认值补回RCC.PLLSourceVirtual=HSE;生成后 HSE 仍丢失会返回 ⚠ 时钟警告
文档:README 新增
cubemx_new_project参数说明;.gitignore忽略*.bak
0.2.2(2026-08-06)
修复:pyproject 作者元数据(
pip show的 Author 字段显示正确)
0.2.1(2026-08-06)
文档:README 重写为面向用户的手册;新增 Claude Code 安装指南
0.2.0(2026-08-06)
新功能:从零生成 HAL 工程(
cubemx_new_project,内置模板库)新功能:外设管理工具(
cubemx_remove_peripheral/cubemx_add_source)新功能:TIM 内部时钟工程化(借壳法,
templates/STM32F103C8T6_tim2_internal.ioc)打包:templates 随 wheel 分发(PyPI 正式发布)
0.1.1(2026-08-05)
文档:补充构建链说明(CMake+Ninja)
0.1.0(2026-08-05)
首个版本:MCP server 封装 STM32CubeMX 命令行脚本模式(
-q)
Available Tools
5 toolscubemx_configureA
加载 .ioc,依次执行 set 命令,最后 saveas 写回原文件。
参数: ioc: 工程 .ioc 文件绝对路径(会被写回,先备份再调用) commands: 命令列表,如 ["set mode USART1 Asynchronous", "set pin PB13 GPIO_Output"]
| Name | Required | Description | Default |
|---|---|---|---|
| ioc | Yes | ||
| commands | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the transparency burden. It discloses the key behavioral trait that the .ioc file 'will be written back' and advises backup, revealing the destructive nature. It also explains the process sequence (load, set, saveas). However, it omits other potential side effects, errors, or prerequisites.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The main operation is summarized in one dense sentence, followed by a compact parameter list. No redundant phrasing or fluff; every sentence earns its place. The description is front-loaded with the core action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a relatively simple tool with an output schema present, the description covers the key aspects: what it does, parameters, and the write-back risk. It doesn't need to detail return values. However, adding an explicit statement about when to choose this over sibling tools would make it fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, but the description fully compensates by explaining both parameters: ioc as 'absolute path' with a write-back warning, and commands as a 'command list' with concrete examples like 'set mode USART1 Asynchronous'. This adds substantial meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's operation: 'Load .ioc, sequentially execute set commands, finally saveas write back to original file.' This is a specific verb+resource (configure via set commands) and differentiates from siblings like cubemx_load (which only loads) and cubemx_generate (which generates code).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides a useful caveat ('backup before calling') but does not explicitly state when to use this tool versus alternatives like cubemx_script or cubemx_generate. There is no 'use this when...' or 'instead of...' guidance, so usage is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cubemx_export_pinoutA
加载 .ioc 并导出当前引脚配置 CSV(只读,CSV 写系统临时目录后读回)。
参数: ioc: 工程 .ioc 文件绝对路径
| Name | Required | Description | Default |
|---|---|---|---|
| ioc | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It explicitly mentions that the operation is read-only and that the CSV is written to the system temp directory before being read back, which is a valuable side-effect disclosure. It does not detail error conditions or cleanup of temp files, but the key behavioral trait is transparently communicated.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise, consisting of two short sentences. The primary action is front-loaded, and the parameter explanation is directly attached. Every word serves a purpose, with no filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity, the description covers the main aspects: input parameter, behavior, and side effects. The presence of an output schema handles return values. However, it omits potential preconditions (e.g., .ioc must exist) and error handling, but for a single-purpose export tool, this is a minor gap, making it largely complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides only a string type for the 'ioc' parameter with 0% description coverage. The description compensates by specifying 'absolute path to project .ioc file', adding critical semantic context that clarifies the expected input format and purpose. This extra detail goes beyond the schema and is essential for correct usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool loads a .ioc file and exports the current pin configuration as CSV. The verb 'export' and resource 'pin configuration CSV' are specific, and this distinguishes it from siblings like cubemx_generate (which generates code) or cubemx_configure (which modifies settings).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for retrieving pin configurations as CSV, and the read-only note suggests safe invocation. However, it does not explicitly state when to use this tool versus alternatives, nor does it provide exclusions or prerequisites (e.g., requiring an existing .ioc file), leaving the usage context implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cubemx_generateA
加载 .ioc 并执行 project generate 生成 HAL 代码。
参数: ioc: 工程 .ioc 文件绝对路径 project_dir: 生成目标目录;留空则在 .ioc 所在目录生成。 强烈建议指向副本/测试目录,避免覆盖现有工程。
| Name | Required | Description | Default |
|---|---|---|---|
| ioc | Yes | ||
| project_dir | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the transparency burden. It warns about overwriting existing projects, a key behavioral side effect, and clarifies the default output destination. However, it doesn't disclose prerequisites, error handling, or whether the .ioc file itself is modified, so it is strong but not exhaustive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded with the action, followed by a clear parameter list. Every sentence earns its place, including the practical warning about avoiding overwrites, with no redundant or vague text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter tool with an output schema, the description covers purpose, parameters, and the main risk. It lacks explicit comparisons to sibling tools, but the generate operation is self-evident, so the overall guidance is sufficient for an agent to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, yet the description thoroughly explains both parameters: ioc as an absolute path, and project_dir with its optional behavior and strong recommendation to use a copy. This adds significant meaning beyond the schema's bare property titles.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it loads a .ioc file and executes project generate to produce HAL code, using a specific verb and resource. This distinguishes it from siblings like cubemx_load or cubemx_configure by focusing on the generation step.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage via 'load .ioc and generate HAL code' and provides practical parameter guidance (recommending a copy/test directory), but it does not explicitly discuss when to choose this tool over alternatives or mention any exclusions. Usage context is present but not fully elaborated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cubemx_loadA
加载 .ioc 工程并回读关键配置(只读,不修改任何文件)。
参数: ioc: 工程 .ioc 文件绝对路径(须在允许目录内)
| Name | Required | Description | Default |
|---|---|---|---|
| ioc | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Even though no annotations are provided, the description explicitly states 'read-only, does not modify any files' and discloses a path restriction (must be in allowed directory). It does not describe error handling or return format, but the output schema exists, so that is acceptable.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: one sentence for purpose and one bullet for the parameter. Every piece of text adds value and no redundant information is present.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a a simple single-parameter tool with an output schema, the description covers the essential aspects: what it does, the parameter semantics, and the safety/restriction. Nothing critical is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides only a string parameter named 'ioc' with no description. The tool description fills this gap by explaining that it is an absolute path to the .ioc file and must be within an allowed directory, adding meaningful context.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the tool loads a .ioc project and reads back key configurations, with an explicit read-only note. This distinguishes it from siblings like cubemx_configure (which modifies) or cubemx_generate (which generates code).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context: this is a read-only inspection tool. It does not explicitly name alternatives or state when not to use it, but the read-only framing and the sibling tool names imply the intended use case.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cubemx_scriptA
执行任意 CubeMX 脚本命令序列(逃生通道,原样传给 -q)。
常用命令示例: config load "C:/path/proj.ioc" set mode USART1 Asynchronous set pin PB13 GPIO_Output set gpio parameters PB13 GPIO_Label=LED config saveas "C:/path/proj.ioc" project generate
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It states commands are passed verbatim to -q (原样传给 -q), revealing that there is no validation or processing, which is a key behavioral trait. However, it does not discuss error handling, side effects, or output behavior, leaving some transparency gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded, starting with the purpose and then offering a bulleted list of examples. Every line earns its place, with no filler or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with a single free-form string parameter and an output schema, the description provides sufficient context through the escape-hatch explanation and examples. It could be more comprehensive by specifying the complete command grammar or error behavior, but it is adequate for invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It provides concrete command examples (config load, set mode, project generate) that illustrate the expected format and scope of the 'script' parameter, giving the agent actionable guidance. This is substantial compensation, though not exhaustive.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool executes arbitrary CubeMX script command sequences and functions as an escape hatch, distinguishing it from the more specific sibling tools like cubemx_load or cubemx_generate. It uses a specific verb (执行/execute) and resource (CubeMX script commands), making its purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase '逃生通道' (escape hatch) signals this tool is meant for cases not covered by the higher-level sibling tools, but it does not explicitly name alternatives or state when not to use it. The implied usage is clear: use when custom or arbitrary commands are needed.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
v0.1.1- First observed
cubemx_configure - First observed
cubemx_export_pinout - First observed
cubemx_generate - First observed
cubemx_load - First observed
cubemx_script
TDQS
Scored across 5 tools
Each tool has a clear, distinct purpose: load reads config, configure applies changes, generate produces code, export_pinout exports CSV. However, cubemx_script is a catch-all escape hatch that can perform all of these operations, which creates some boundary ambiguity for agents deciding between the specific tools and the generic script runner.
All tool names follow the uniform pattern cubemx_<action>, using clear verbs like load, configure, generate, and export_pinout. The naming is perfectly consistent and predictable, with no mixed conventions or vague verbs.
The server has 5 tools, which is well within the ideal 3-15 range for a focused domain. Each tool addresses a distinct CubeMX workflow step, and the number feels appropriate without excess or deficiency.
The tool set covers the core CubeMX lifecycle: loading projects, modifying configuration, generating code, and exporting pinout. Minor gaps exist such as no dedicated tool for creating a new project from scratch or listing all settings, but these can be worked around via the catch-all script tool.
Maintenance
Related MCP Connectors
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform
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.4110MIT
- FlicenseAqualityCmaintenanceMCP server for scaffolding, building, and flashing bare-metal STM32C011 firmware using the STM32CubeCLT toolchain. Exposes tools for project scaffold, build, flash, and probe listing.4-
- AlicenseAqualityBmaintenanceAn MCP server that enables AI agents to inspect, plan, validate, and apply STM32CubeMX .ioc configuration changes, and generate STM32CubeIDE projects, ensuring safe and testable embedded-system workflows.9MIT
- AlicenseNot gradedqualityCmaintenanceAn 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.MIT