vscode-cube-mcp AGENTS.md

vscode-cube-mcp AGENTS.md is an instructions file for Codex, OpenCode from h666zhang/vscode-cube-mcp. It costs 1,141 tokens per session, scanned A, original, MIT.

An AGENTS.md instruction file for an MCP server that configures STM32 microcontrollers with STM32CubeMX, a tool for setting up embedded hardware projects. It defines the server's limits and its available configuration commands.

In plain words
What is it for?
Creating and configuring STM32CubeMX projects, including pins, peripherals, clocks, toolchains, project files, and generated hardware-abstraction skeletons.
Why use it?
It tells coding agents what the tool can configure and prevents them from expecting it to write application behavior such as sensor drivers or display logic.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/h666zhang/vscode-cube-mcp/agents-md
Clone the repo
git clone --depth 1 https://github.com/h666zhang/vscode-cube-mcp

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for vscode-cube-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/h666zhang/vscode-cube-mcp/agents-md.svg)](https://agentmods.dev/instructions/h666zhang/vscode-cube-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/h666zhang/vscode-cube-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/h666zhang/vscode-cube-mcp/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,141 This file is loaded in full into every session.
When invoked 1,141 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01141 $0.01141
Opus 5 $0.00571 $0.00571
Sonnet 5 $0.00228 $0.00228
Haiku 4.5 $0.00114 $0.00114

Measured 5d ago against content hash 34bd1c1b3ba8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

vscode-cube-mcp AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 54 lines

How it starts

The opening of the file, as written. The whole thing — 54 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Vscode_cube_mcp — AGENTS.md(项目约定,agent 必读)

本目录是 Vscode_cube_mcp:一个封装 STM32CubeMX 命令行(-q) 的 MCP server。 任何 agent 接入本目录后,先读本文件,再动手

能力边界(最高优先)

  • 本工具只做配置层:.ioc 工程配置 + HAL 骨架生成(引脚 / 外设 / 时钟 / 工具链),不做应用层
  • 不生成、不修改、不负责应用业务代码(LED 闪烁、OLED 显示内容、传感器驱动、中断处理逻辑等)——这些由用户自己编写。
  • 你(agent)在对话中若需要业务代码,应在生成后的工程文件里直接编写;但这不是本工具的能力,也不要要求工具"生成完整功能"。
  • 以后给本工具提需求 / 加功能,同样遵循同一原则:配置到骨架为止,不替用户写业务逻辑。

第一优先:接入后先调 cubemx_help

  • 本 server 的核心内置帮助工具是 cubemx_help:调用它获取完整工具清单、可用芯片模板、各外设配置方法与已知坑。
  • 动手建工程 / 改配置前,必须先调用 cubemx_help,不要凭经验猜 set 命令语法(实测有多个坑,见下)。

项目结构

  • cubemx_mcp.py — MCP server 源码(9 个工具)
  • templates/最小模板基底模板(6.18 原生 .ioc,按芯片命名;仅芯片标识+基础时钟 72MHz/SWD/SysTick,无外设,外设全部由 cubemx_new_projectcommands set 现配;新增芯片用 CubeMX GUI 新建后存为 templates/{mcu}.ioc)
  • test_cubemx_mcp.py — 单元测试(不依赖 CubeMX)
  • README.md — 面向用户的手册(安装/配置/FAQ)
  • README.dev-notes.md — 开发笔记(配置补丁原理、外设实测、发布流程)

工具一览(9 个)

cubemx_help / cubemx_script / cubemx_load / cubemx_configure / cubemx_generate / cubemx_export_pinout / cubemx_new_project / cubemx_remove_peripheral / cubemx_add_source

已知坑(实测结论,勿重踩)

  • TIM 内部时钟:set mode TIMx 一律 KO;set ip parameters TIMx ClockSource TIM_CLOCKSOURCE_INTERNAL 只改参数不改 SH/VP 表达(GUI 仍显示 ETR)。可靠做法(0.4.0 配置补丁):cubemx_new_project 的 commands 里含 set ip parameters TIMx ClockSource TIM_CLOCKSOURCE_INTERNAL 时,server 自动注入 6.18 验证过的标准表达,任意 TIM/芯片适用,可附 Prescaler/Period 自定义;详见 cubemx_help(topic="tim")
  • RCC 时钟:对 RCC 执行 set 命令(如 PLLMUL)会把 RCC.PLLSourceVirtual=HSE 弄丢,时钟静默降级 HSI(64MHz 而非 72MHz)。改时钟优先用 cubemx_new_projectclock_source / pll_mul 参数。
  • generate 覆盖 CMakeLists:cmake/stm32cubemx/CMakeLists.txt 会被重新 generate 覆盖,自定义 源文件需重新调 cubemx_add_source 加入(幂等)。
  • 模板必须 6.18 原生生成:手写/非原生 .ioc 会被 6.18 拒绝。请求的芯片无模板时,报错会给出 可用模板清单与生成方法。

开发 / 验证

  • 单元测试:python -m unittest test_cubemx_mcp(72 个,不依赖 CubeMX)
  • 语法检查:python -m py_compile cubemx_mcp.py test_cubemx_mcp.py
  • MCP 协议级冒烟:用官方 mcp.client.stdio.ClientSession 连接;手写 JSON-RPC 直连本 2.0 server 会挂起无响应。

Read the full file on GitHub · 54 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 54 lines · 1,141 tokens per session scan A 34bd1c1b3ba8

Subscribe to this mod's changes

vscode-cube-mcp AGENTS.md is an instructions file published in the GitHub repository h666zhang/vscode-cube-mcp (2 stars, last pushed 4d ago), licensed MIT. It adds 1,141 tokens to every session, about $0.0057 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.