vscode-cube-mcp
One-line summary: This MCP server exposes STM32CubeMX's command-line interface so an AI assistant can load, inspect, edit, and generate STM32 HAL projects from .ioc files without opening the CubeMX GUI (README scope: STM32F103C8T6 only).
cubemx_script– Run an arbitrary CubeMX script command sequence (escape hatch, passed raw to-q), e.g.config load,set mode,set pin,config saveas,project generate.cubemx_load– Load an.iocfile and read back key configuration (read-only, no file modification).cubemx_configure– Load an.ioc, run a list ofsetcommands (peripherals, pins, GPIO params), and save the result back to the file.cubemx_generate– Load an.iocand runproject generateto produce compiled-ready HAL skeleton code, optionally into a specifiedproject_dir(a copy/test dir is recommended).cubemx_export_pinout– Load an.iocand export the current pin assignment as CSV (read-only).Constraints honored by the server:
.iocand output paths must live underST_CUBEMX_ALLOWED_ROOTS;ST_CUBEMX_EXEmust point to a CubeMX install; a timeout (ST_CUBEMX_TIMEOUT, default 240s) applies to each CubeMX call.Note: The README documents a richer tool set (
cubemx_help,cubemx_intent,cubemx_new_project,cubemx_probe,cubemx_remove_peripheral,cubemx_raw_script) that is not present in the provided server schema; this schema only exposes the five tools listed above.
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
项目定位:
自动化流水线:CI/CD 中根据配置文件自动生成初始化代码
自然语言配置:用聊天描述硬件需求,直接产出可编译的工程
批量变体:为不同板子快速生成不同配置
版本控制友好:
.ioc是纯文本,可 diff、可追溯
MCP(Model Context Protocol) server,封装 STM32CubeMX 官方命令行脚本模式(-q),
让 AI 助手可以直接加载 .ioc 工程、改引脚/外设配置、生成 HAL 代码、导出引脚表,全程无需打开 CubeMX GUI。
能力边界:本工具只生成工程配置与 HAL 骨架(引脚、外设、时钟、工具链), 不负责应用逻辑代码(LED 闪烁、OLED 显示内容、传感器驱动等)——业务代码请在生成后的工程里自己写。
保证范围(scope):目前只保证 STM32F103C8T6 这一颗芯片,外设只保证工具现在能配的这些:
TIMx(pwm / input_capture / internal_clock)、GPIO、I2Cx、USARTx、SPIx、ADCx、IWDG、WWDG、CAN、RTC,以及挂在这些外设下的 DMA 与 NVIC 中断。 白名单外的芯片没有内置模板;白名单外的模式会被明确拒绝(cubemx_help也不给方法), 而不是勉强拼一个不可靠的配置 —— 可控的失败比隐蔽的错误更省事。
功能一览
工具 | 说明 |
| server 内置帮助:工具清单、可用模板、外设配置方法(陌生 agent 建议先调用) |
| 按意图配置外设:只写"要什么"(外设/模式/引脚/频率), |
| 从零生成新工程(内置模板库,无需预先 .ioc;可直接吃 |
| 加载 .ioc 并生成 HAL 工程 |
| 回读配置 + 结构化摘要(IP / 引脚 / DMA / 中断 / 时钟;默认纯文本解析、秒回, |
| 加载 .ioc,执行 |
| 探针:在 .ioc 副本上试跑脚本命令或键注入(DMA / TIM / NVIC),输出差异 + CubeMX 是否保留 |
| 导出引脚配置 CSV(只读) |
| 从 .ioc 移除外设 |
| 任意 CubeMX 脚本命令序列(降级接口:能用 |
Related MCP server: stm32cubemx-mcp
要求
Python >= 3.10(Windows 建议用官方安装版,不要用 msys2/Git 自带的 python,见 FAQ)
STM32CubeMX 6.x(ST 专有软件,请从 ST 官网 免费下载并自行遵守其许可;本工具仅运行时调用其命令行,不包含、不修改其代码)
目标平台 Windows(跨平台可用);运行时只依赖 mcp SDK 2.x(stdio),无其它依赖
快速开始(Windows)
三步,约 2 分钟。以下命令都在 PowerShell 里执行。
第 1 步:安装
pip install vscode-cube-mcp装完后先验证一下(能打印出版本号就说明装好了):
python -m pip show vscode-cube-mcp提示
pip不是命令、或装到了奇怪的位置,见文末 FAQ。
第 2 步:设置两个环境变量(永久生效)
setx ST_CUBEMX_EXE "C:\你的路径\STM32CubeMX.exe" # CubeMX 可执行文件
setx ST_CUBEMX_ALLOWED_ROOTS "C:\你的工程目录" # 允许 AI 访问的根目录(多个用 ; 分隔)用
setx写用户级永久变量;$env:只对当前窗口有效,重启客户端就没了;设完要重开客户端才会被读到;也可以写在第 3 步的
env里(二选一,env优先)。
第 3 步:接入 MCP 客户端
把下面配置加到你所用客户端的 MCP server 列表里(以 mcpServers 配置为例):
{
"mcpServers": {
"Vscode_cube_mcp": {
"command": "python",
"args": ["-m", "vscode_cube_mcp"],
"env": {
"ST_CUBEMX_EXE": "C:/MINE/STM/STM/STM32CubeMX.exe",
"ST_CUBEMX_ALLOWED_ROOTS": "C:/MINE/STM32Project"
}
}
}
}Windows 路径在 JSON 里建议用正斜杠(
C:/...)或双反斜杠(C:\\...),避免转义问题;"command": "python"要求python在 PATH 里、且就是装了本包的解释器;不对就改成"py"或写解释器完整路径。
验证
让 AI 调一次 cubemx_help(或给个 .ioc 路径调 cubemx_load),能返回内容就通了。
终端手动冒烟:python -m vscode_cube_mcp 不报错、不立刻退出即为正常(stdio 服务会挂起等输入,Ctrl+C 退出)。
配置项(环境变量)
变量 | 默认 | 说明 |
| PATH 中的 | STM32CubeMX 可执行文件完整路径 |
| 当前工作目录 | .ioc / 生成路径允许访问的根目录, |
|
| 单次 CubeMX 调用超时秒数,机器慢可调大 |
| 与代码同级的 | 知识库目录;一般不用设(源码运行与 pip 安装都会自动找到) |
安全设计:所有 .ioc / 生成路径必须在
ST_CUBEMX_ALLOWED_ROOTS白名单内,白名单外的路径会被拒绝。
使用示例
让 AI 助手做的事情都会通过上述 10 个工具完成,例如:
「第一次用你,先看看你能干什么、有哪些芯片模板」→
cubemx_help(陌生 agent 建议第一个调用)「用 STM32F103C8T6 从零建一个工程」→
cubemx_new_project「TIM3 的 PA6 出 10kHz、占空比 50% 的 PWM;USART2 接 PA2/PA3,波特率 9600」→
cubemx_intent「把 PB13 改成 GPIO_Output 并加标签 LED」→
cubemx_intent(也可以直接发cubemx_configure的 set 命令)「把自己写的 OLED 库加进编译,重新 generate 后也保留」→ 不用调工具,直接写进工程根
CMakeLists.txt的用户区(# Add sources to executable/# Add include paths)
用意图配置外设(推荐)
cubemx_intent 只描述"要什么";.ioc 里的内部名(S_TIM3_CH1、PWM Generation1 CH1 这类)
全部由知识库查出来,AI 不需要记住它们。同一套意图也能直接喂给 cubemx_new_project 的
intents 参数 —— 从零建工程一步到位,不必"先建再配"。
[{"peripheral": "TIM3", "mode": "pwm", "pin": "PA6", "freq_hz": 10000, "duty": 0.5},
{"peripheral": "TIM2", "mode": "input_capture", "pin": "PA0-WKUP"},
{"peripheral": "I2C1", "pins": ["PB8", "PB9"]},
{"peripheral": "USART2", "pins": ["PA2", "PA3"], "baudrate": 9600},
{"peripheral": "ADC1", "pins": ["PA0", "PA1"], "sampling_time": "ADC_SAMPLETIME_55CYCLES_5",
"continuous": true, "interrupt": true, "dma": {"mode": "circular"}},
{"peripheral": "USART2", "pins": ["PA2", "PA3"], "dma": {"request": "USART2_RX"}},
{"peripheral": "GPIO", "pin": "PB13", "mode": "output", "label": "LED"}]参数两种给法都行:业务参数(freq_hz / duty)由代码按定时器时钟换算,或者直接给寄存器参数
(prescaler / period / pulse),显式给的优先。查不到的外设 / 引脚会被拒绝执行,
并告诉你差什么、怎么补。引脚可以写短名(PA0 会自动归一化成 PA0-WKUP)。
有些"必做但容易漏"的项,工具会自己补上(依据都写在 knowledge/rules/*.yaml 里,带实测来源):
配 ADC 时按
.ioc里的 APB2 频率自动选合法的 ADC 预分频 —— 不配的话 CubeMX 会弹[Clock]对话框,-q批处理没人点 → generate 卡死到超时;ADC 多通道时自动补转换序列(
NbrOfConversion+ 每个通道的Rank-n/Channel-n/SamplingTime-n);interrupt: true自动注入对应的 NVIC 键,并按外设选对向量名(如 ADC 用共用的ADC1_2_IRQn);dma子对象按 db 表查出通道与方向(ADC1→DMA1_Channel1、USART2_RX→DMA1_Channel6), 数据宽度交给 CubeMX 补默认 —— 请求名有歧义(USART2 的 RX/TX)时会报错让你挑,不替你选。
知识库(knowledge/)
工具不靠"记忆"写 .ioc:引脚、模式、参数、命令写法全部来自 knowledge/(纯文本,可 diff、可审),
每条实测规则都带 verified 与来源 —— 没验证过的规则会被拒绝执行,不是猜出来的。
换芯片、升级 CubeMX 后重新导出,或收录新外设的流程,见 docs/README.dev-notes.md。
目录可用 ST_CUBEMX_KNOWLEDGE 指定,一般不用设(源码运行与 pip 安装都会自动找到)。
内置模板库(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) |
| 空 |
|
| 空 | 配置意图列表(推荐) —— 与 |
优先用
intents而不是commands手写:手写set mode ADC1 IN0不会自动补 ADC 时钟 (模板默认 36MHz 超 F103 的 14MHz 上限),project generate会弹[Clock]对话框把-q批处理卡死到超时(实测)。
默认值而非强制:默认生成 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 / Claude 等),MCP server 进程才会加载新代码; 若重启后工具参数仍是旧的,等几秒或新开一个会话(host 侧工具快照可能滞后)。
常见问题 FAQ
pip 装上了,但 python -m vscode_cube_mcp 报 ModuleNotFoundError: No module named 'vscode_cube_mcp'
装的解释器和 python 指向的不是同一个。python -m pip show vscode-cube-mcp 能显示才算装对;
若 python 指向 msys2/Git/Store 版,改用官方 Python(py -m pip install vscode-cube-mcp),或在客户端配置里写解释器完整路径。
客户端里 AI 报找不到 STM32CubeMX
环境变量没传进 server 进程。检查:① 是否用了 setx(临时 $env: 会失效);② 是否重启了客户端;
③ Test-Path "C:\...\STM32CubeMX.exe" 是否为 True。
报错说路径不在允许范围内(allowed roots)
把工程目录加进 ST_CUBEMX_ALLOWED_ROOTS(多个用 ;),改完重启客户端。写在客户端 env 里时注意 JSON 转义。
CubeMX 调用很慢或超时
首次启动 CubeMX 较慢是正常的;把 ST_CUBEMX_TIMEOUT 调大(如 600)。另外确认没有残留的 CubeMX / Java 进程占着工程文件。
cubemx_intent 报 UNKNOWN_PERIPHERAL / UNKNOWN_PARAM
知识库还没收录这个外设或这种模式(不是查不到,是故意不猜)。三种办法:① cubemx_help 看已收录哪些;
② 直接发 cubemx_configure 的 set 命令;③ 用 cubemx_probe 试跑一遍,把结果整理进 knowledge/rules/<外设>.yaml。
cubemx_intent 报 UNKNOWN_PIN_SIGNAL / PIN_CONFLICT
前者是这个引脚不支持你指定的信号(报错里会列出它支持哪些);后者是引脚已被占用。按提示换引脚即可。
报 RULE_NOT_VERIFIED
这条规则还没实测过(如早期的 USART)。为避免写出 CubeMX 不认的东西,工具会拒绝执行。先 cubemx_probe 验证,再把规则改成 verified: true。
CubeMX 弹「Resolve Clock Issues」
通常是 .ioc 时钟树不自洽(如 HSE 未启用但 PLL 选了 HSE),属于工程配置问题,详见 docs/README.dev-notes.md 的「从零配置时钟实战」。
许可与依赖声明
本工具代码:MIT License(见
LICENSE)mcp SDK(唯一 Python 依赖):MIT License(modelcontextprotocol/python-sdk)
STM32CubeMX:ST 专有软件,运行时外部调用,需用户自备并遵守其许可条款
更多资料
docs/CHANGELOG.md—— 版本变更记录docs/install-claude-code.md—— Claude Code(终端版)安装配置AGENTS.md—— 给 AI agent 的项目约定(不是给人读的)docs/README.dev-notes.md—— 开发笔记 / 内部实现 / SOP(给维护者与贡献者)
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
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
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.
Related MCP Servers
- FlicenseAqualityDmaintenanceMCP 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.96MIT
- 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.1MIT
- AlicenseAqualityCmaintenanceMCP server for debugging STM32 microcontrollers over ST-LINK using STM32CubeCLT tools (GDB, ST-LINK_gdbserver, STM32_Programmer_CLI) with session management, flashing, breakpoints, memory/register access, and expression evaluation.191GPL 3.0