embedded-mcp
Lets AI assistants read, command, and debug microcontrollers over a serial connection via MCP. Provides tools for serial port discovery, reading serial output, sending commands, and decoding register values.
README
embedded-mcp
Let an AI assistant read, command, and debug your microcontroller — over plain serial.
embedded-mcp is a Model Context Protocol server. It gives an MCP-capable client (Claude Desktop, Claude Code, …) a small set of tools to talk to a real board over a serial port.
When you debug firmware, your AI pair can now see what the board prints and poke it back — instead of you copy-pasting the serial monitor by hand.
┌─────────────┐ MCP (stdio) ┌───────────────┐ UART / USB-serial ┌──────────────┐
│ AI client │ ◄────────────────► │ embedded-mcp │ ◄────────────────────► │ your board │
│ (Claude) │ │ (this repo) │ (pyserial) │ STM32 / ... │
└─────────────┘ └───────────────┘ └──────────────┘
Why
Embedded debugging is a loop of flash → watch the serial monitor → send a command → read the dump → decode a register against the datasheet. That loop is exactly the kind of tedious, context-heavy work an AI is good at — if you give it eyes and hands on the hardware. This server is those eyes and hands.
Tools
| Tool | What it does |
|---|---|
list_serial_ports |
Discover available ports (COM5, /dev/ttyACM0, …). |
read_serial |
Passively read what the firmware is printing for N seconds. |
send_command |
Send a line to the device's UART shell and capture the reply. |
decode_register |
Turn a raw value (e.g. 0x4002) into named bit-fields. |
decode_register_svd |
Decode a register by name straight from a vendor CMSIS-SVD file. |
list_flashers |
Report which flashers are installed (st-flash / probe-rs / openocd). |
flash_firmware |
Flash a firmware image to the board (dry-run by default). |
Install
git clone https://github.com/atillab1/embedded-mcp.git
cd embedded-mcp
pip install -e .
Use with Claude Desktop
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"embedded-mcp": {
"command": "embedded-mcp"
}
}
}
Restart Claude Desktop. Then just ask:
"List my serial ports, then read whatever COM5 is printing at 115200 for 5 seconds."
"Send
statusto the board on COM5 and tell me what it replies."
"Register RCC->CR read back as 0x4002. Decode it: bit 0 is HSION, bit 17 is HSEON, bit 25 is PLLRDY."
Example: decode a register
decode_register(value=0x4002, fields=[{"name":"HSION","bit":0},{"name":"HSEON","bit":17}], width=32)
{
"value": 16386,
"hex": "0x00004002",
"binary": "00000000000000000100000000000010",
"fields": [
{ "name": "HSION", "bits": "[0]", "value": 0 },
{ "name": "HSEON", "bits": "[17]", "value": 0 }
]
}
Try it now (no hardware needed)
The register decoders work entirely offline — give them a quick spin:
python examples/demo.py
Flashing
flash_firmware shells out to a real flasher and is dry-run by default — it
returns the exact command it would run, so you can review it before anything
touches your board:
"Dry-run flashing build/app.bin to my STM32 with st-flash."
Flip dry_run=False to actually flash. Supported: st-flash (.bin),
probe-rs (.elf, needs chip), openocd (.elf, needs openocd_target).
Safety notes
- Tools open the port only for the duration of the call, then close it — they do not hold the port, so your normal IDE serial monitor can share it (one at a time).
- Read durations are capped at 30s so a call can never hang the client.
flash_firmwareis destructive; it defaults to a dry run and never flashes unless you explicitly passdry_run=False.- This talks to whatever board is on the port. Don't point it at something you don't own.
Roadmap
- [x] Unit tests + GitHub Actions CI
- [x] Load a register map from an SVD file (
decode_register_svd) - [x] Flashing hook (
flash_firmwarevia st-flash / probe-rs / openocd) - [ ] Streaming/continuous monitor (notifications instead of fixed windows)
- [ ] SVD auto-discovery from the connected chip id
Contributions welcome — open an issue or PR.
Development
pip install -e .
pip install pytest
pytest -q
License
MIT © Atilla — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。