EmbedForge
Enables AI-driven embedded development: generate, build, flash, and debug firmware using natural language commands through MCP.
README
EmbedForge
AI 嵌入式一体化开发平台 — MCP-first 架构,让 AI 直接帮你写嵌入式代码
EmbedForge 把 AI 代码生成 → 编译 → 烧录 → 测试 → 自动修复 打通成一个闭环, 并以 MCP Server 形式接入 Claude Code / Trae / Cursor 等编程工具,让你用自然语言就能完成嵌入式开发。
核心能力
| 能力 | 说明 |
|---|---|
| AI 代码生成 | 支持多 LLM 后端(Ollama / OpenAI / Anthropic / Echo) |
| 多构建系统 | 自动检测 PlatformIO / CMake / Makefile / ESP-IDF / GCC 裸机 |
| 硬件交互 | 串口监视、OpenOCD 烧录、Wokwi 仿真 |
| 闭环编排 | 生成→编译→烧录→测试→自动修复,最多 N 轮迭代 |
| 独立修复 | fix 命令根据编译错误或串口日志修复已有代码 |
| MCP Server | 一键接入 Claude Code / Trae / Cursor |
快速开始
方式一:一键安装脚本(推荐)
# 克隆项目
git clone https://github.com/He-user520/EmbedForge.git
cd EmbedForge
# 运行安装脚本(自动安装依赖 + 配置 MCP)
.\install.ps1
方式二:手动安装
# 克隆
git clone https://github.com/He-user520/EmbedForge.git
cd EmbedForge
# 安装
pip install -e ".[dev]"
# 一键接入编程工具
embedforge mcp install
安装完成后 重启 Claude Code / Trae / Cursor,即可使用。
接入编程工具
# 自动检测并安装到所有可用工具
embedforge mcp install
# 只安装到 Claude Code
embedforge mcp install -t claude
# 只安装到 Trae(项目级配置)
embedforge mcp install -t trae -p .
# 只安装到 Cursor
embedforge mcp install -t cursor
# 强制覆盖已有配置
embedforge mcp install --force
接入后,你可以在编程工具里直接说:
- "帮我创建一个 STM32 的点灯程序"
- "编译一下这个项目"
- "把固件烧录到开发板"
- "读取串口日志,看看哪里错了,帮我修"
CLI 命令一览
# 一键开发:AI生成 → 编译 → 烧录 → 测试 → 自动修复
embedforge dev "在STM32F407上配置USART2发送Hello World" --mcu STM32F407VG
# 编译项目
embedforge build -p ./myproject
# 烧录固件
embedforge flash -p ./myproject
# 串口监视器
embedforge monitor --port COM3
# 初始化新项目
embedforge init myproject --mcu STM32F407VG
# 根据编译错误修复代码
embedforge fix compile -p ./myproject
# 根据串口运行时日志修复代码
embedforge fix runtime -p ./myproject --port COM3
# 以 MCP Server 模式启动
embedforge mcp start -s ai
# 检查依赖环境
embedforge doctor
项目结构
embedforge/
├── cli/ # 命令行接口
│ └── main.py # 所有 CLI 命令
├── core/ # 核心模块
│ ├── config.py # 配置管理
│ ├── orchestrator.py # 闭环编排器
│ ├── templates.py # 代码模板
│ └── exceptions.py # 异常定义
├── servers/ # MCP Server 实现
│ ├── ai_server/ # AI 代码生成服务
│ ├── build_server/ # 构建编译服务
│ │ ├── base.py # 构建系统自动检测
│ │ ├── platformio.py # PlatformIO 后端
│ │ ├── cmake.py # CMake 后端
│ │ ├── esp_idf.py # ESP-IDF 后端
│ │ └── gcc.py # GCC 裸机后端
│ └── hardware_server/ # 硬件交互服务
│ ├── serial.py # 串口通信
│ ├── flash.py # 固件烧录
│ ├── debug.py # 调试接口
│ └── simulation.py # Wokwi 仿真
├── templates/ # 项目模板
│ ├── stm32_baremetal/ # STM32 裸机模板
│ ├── stm32_freertos/ # STM32 FreeRTOS 模板
│ ├── arduino_basic/ # Arduino 基础模板
│ └── esp32_wifi/ # ESP32 WiFi 模板
└── tests/ # 测试套件(44 个用例)
支持的硬件
| MCU | 构建系统 | 烧录方式 |
|---|---|---|
| STM32 (F1/F4/H7) | PlatformIO / CMake / GCC | OpenOCD / ST-Link |
| ESP32 / ESP8266 | ESP-IDF / PlatformIO | esptool |
| Arduino | PlatformIO | avrdude |
| 通用 ARM | GCC 裸机 | OpenOCD |
开发
# 运行测试
pytest tests/ -v
# 代码检查
ruff check embedforge/
# 类型检查
mypy embedforge/
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.