ESP32 Simulator

io.github.stramanu由 GitHub 帳號 stramanu 發布v0.2.6更新於 Oct 26, 2026

Boot and test ESP32 firmware in a local emulator: UART asserts, buttons, virtual WiFi, screenshots.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

在本機模擬器中啟動並測試 ESP32 韌體,把序列埠日誌、當機資訊、斷言結果與螢幕截圖回傳給助理。

可以做什麼
  • 啟動韌體並回傳主控台日誌、停止原因、模擬時間與當機資訊
  • 斷言指定字串或正規表示式依序出現在主控台,並給出通過/失敗與缺少的那一行
  • 依模擬時間戳驅動硬體:按鍵按下與放開、GPIO 電位、旋鈕轉動、UART 輸入、觸控
  • 在指定模擬時間擷取開發板顯示器的 PNG 截圖
  • 列出支援的晶片、開發板、顯示器與輸入方式,並檢查模擬器與 ROM 是否就緒
適用情境
適合助理撰寫 ESP-IDF 韌體後需要驗證行為的情況:沒有實體開發板時啟動建置產物、檢查開機日誌、以腳本模擬輸入與顯示輸出,或在 CI 中執行相同檢查。
執行需求
透過 npx 以 stdio 在本機執行;需要 Node.js 22+,以及 ESP-IDF 或 Docker 來建置韌體,並需執行一次安裝步驟取得模擬器與 mask ROM。預先編譯的模擬器支援 macOS arm64 與 Linux x64/arm64,其他平台需以 Cargo 自行建置。可選環境變數 ESP32SIM_PATH 與 ESP32SIM_ROM_DIR 用來指定模擬器與 ROM 目錄。
安裝前請注意
此伺服器不負責編譯,韌體由助理自行建置。模擬器不等於真實晶片:未建模的周邊、射頻時序與藍牙無法涵蓋,發布前應在實體硬體上確認。Windows 未經測試。安裝步驟會下載模擬器二進位檔與 ROM,init 會為偵測到的助理寫入 MCP 與技能設定檔。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 ESP32 Simulator,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

esp32sim-mcp

Your agent writes ESP32 firmware, boots it and tests it. No board, no account.

[npm] [CI] [License: MIT] [MCP]

[Claude Code adds a counter to an ESP-IDF project, builds it and verifies it in the emulator]

A real Claude Code session, recorded live (only the idle tail is trimmed): it edits ESP-IDF's hello_world, builds it in Docker because ESP-IDF isn't installed, and checks the console in the emulator.


Coding agents are good at writing embedded C. They are blind when it comes to running it: without a board on the desk, "it compiles" is where the feedback loop ends.

esp32sim-mcp closes that loop. It gives Claude Code, Codex, Cursor or any MCP client a set of tools that boot the firmware the agent just built inside esp32sim, a local instruction-level ESP32 emulator, and hand back what the chip printed, whether it crashed, and what was on the display. The agent reads the result, fixes the code and tries again, the way you would with a board on the bench.

  • 🔌 No hardware, no cloud. Everything runs on your machine. No account, no token, no board.
  • 🧬 Real boot chain. Espressif's mask ROM, the ESP-IDF bootloader and your unmodified app, on ESP32-S3, C3, C6 and the classic ESP32.
  • 📡 More than a console. Virtual WiFi access point with DHCP, DNS and NAT, buttons, rotary encoder, GPIO, UART input, touch, and display screenshots.
  • 🧪 Assertions, not vibes. sim_expect returns pass/fail and the exact line that is missing, so the agent knows what to fix.
  • ⚡ Fast. Emulation usually runs ahead of real time: on Apple silicon, 8 emulated seconds of a WiFi station joining a network take about 0.6 s.
  • 🤖 Comes with a skill. init installs an agent skill that teaches the write → build → simulate → fix loop, including building in Docker when ESP-IDF is not installed.

Quickstart

bash
npx -y esp32sim-mcp setup                      # emulator + mask ROMs, pinned and SHA-256 verifiedcd your-esp-idf-projectnpx -y esp32sim-mcp init                       # registers the MCP server and the skill for your agents

Then ask your agent for something you can see on the serial console:

Add a counter that prints once a second, build it, and check in the simulator that it reaches 5.

Requirements: Node.js 22+, and ESP-IDF or Docker to build firmware. Prebuilt emulator binaries cover macOS (Apple silicon) and Linux (x64, arm64); see other platforms.

What the agent sees

From a real session, the agent calls:

json
{  "tool": "sim_expect",  "projectDir": ".",  "chip": "s3",  "board": "none",  "maxSeconds": 10,  "patterns": ["Hello world!", "Counter: 1", "Counter: 2", "Counter: 3", "Counter: 4", "Counter: 5"]}

and gets back:

text
### Expect Test: ✅ PASSED
Matched 6 / 6 patterns.
- ✅ Matched (line 54): `Hello world!`- ✅ Matched (line 55): `Counter: 1`  ...- ✅ Matched (line 65): `Counter: 5`
#### Full UART Logs:ESP-ROM:esp32s3-20210327Build:Mar 27 2021rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)...

When something goes wrong, it gets the panic instead (Guru Meditation Error, stack overflow, failed assert, heap corruption) with the log leading up to it, and the missing pattern spelled out.

Tools

ToolWhat it does
sim_runBoots the firmware and returns the console log, stop reason, emulated time and any panic.
sim_expectRuns the firmware and asserts that strings or regexes appear on the console, in order by default.
sim_scriptDrives the hardware at emulated timestamps: press/release buttons, gpio levels, knob turns, uart/serial input, touch, stop.
sim_screenshotReturns a PNG of the board's display at a given emulated time.
sim_list_boardsLists chips, boards, displays and inputs.
sim_doctorChecks the emulator and ROMs and says how to fix what is missing.

All tools take a projectDir (the ESP-IDF build is found through build/flasher_args.json) or explicit appBin/bootloaderBin/ptableBin paths, plus chip, board and wifi (e.g. ssid=demo,psk=secret). Both UART0 and the USB-Serial/JTAG console are captured, so output shows up whichever one the project logs to.

How it works

mermaid
flowchart LR    A["Coding agent<br/>(Claude Code, Codex, Cursor)"] -- "edits code,<br/>runs idf.py build<br/>(local or Docker)" --> B["ESP-IDF build/"]    A -- "MCP: sim_expect, sim_run, ..." --> C["esp32sim-mcp"]    C -- "flasher_args.json" --> B    C -- "spawns" --> D["esp32sim emulator<br/>mask ROM → bootloader → app"]    D -- "UART / USB-JTAG, panics,<br/>display, virtual WiFi" --> C    C -- "pass/fail, logs, PNG" --> A

esp32sim-mcp is a thin, tested layer: it finds the build, translates tool calls into esp32sim's command line, separates and de-duplicates the two consoles, detects panics, and shapes the result for an agent. The emulation itself is esp32sim's work.

Use it in CI

The same checks run without an agent, with exit code 0 on pass and 1 on fail. A GitHub Actions job that builds your firmware and asserts its boot log:

yaml
jobs:  firmware:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v5      - uses: actions/setup-node@v5        with:          node-version: 22      - name: Build        run: docker run --rm -v "$PWD:/project" -w /project espressif/idf:v5.5.4 idf.py set-target esp32s3 build      - name: Install the emulator        run: npx -y esp32sim-mcp setup      - name: Boot and check the console        run: npx -y esp32sim-mcp expect --max-seconds 10 --pattern "app_main" "Counter: 5"

This is what this repository's own CI does with examples/hello-esp32, including a scripted button press.

All CLI commands
bash
esp32sim-mcp setup                 # install emulator + ROMs (or: install-emulator, fetch-roms)esp32sim-mcp init [--global] [--agent claude-code|codex|cursor|claude-desktop] [--dry-run]esp32sim-mcp run [-p dir] [--chip s3] [--board none] [--max-seconds 5] [--wifi ssid=x,psk=y]esp32sim-mcp expect --pattern "a" "b" [--unordered] [--script actions.txt] [...run options]esp32sim-mcp list [--chip c6]esp32sim-mcp doctoresp32sim-mcp serve                 # the MCP server (what agents launch)

Supported chips and boards

ChipBoards (board)
ESP32-S3atech14 (default: ST7735 TFT, buttons, rotary encoder, LED ring, audio), waveshare-lcd4b (480×480 touch), waveshare-amoled18-v2 (368×448 AMOLED touch), waveshare-cam (OV5640 camera), none
ESP32-C3console only (no board models)
ESP32-C6waveshare-c6-lcd147 (172×320 LCD), none
ESP32 (classic)ttgo-tdisplay (135×240 TFT), esp32dev-loopback, none

Use none for stock ESP-IDF projects. The virtual WiFi access point works on all four chips.

Agent setup

init detects the agents you have and configures each one. It runs in your firmware project by default; --global writes user-level settings instead.

AgentMCP server (project / --global)Skill (project / --global)
Claude Code.mcp.json / claude mcp add --scope user.claude/skills/ / ~/.claude/skills/
Codex~/.codex/config.toml (user only).agents/skills/ / ~/.codex/skills/
Cursor.cursor/mcp.json / ~/.cursor/mcp.json.cursor/skills/ / ~/.cursor/skills/
Claude Desktop--global only—

Existing entries are kept, reruns are no-ops, and a config file that does not parse is left untouched.

Claude Code plugin. Instead of init, install the server and skill together as a plugin, for every project:

/plugin install esp32sim --marketplace stramanu/esp32sim-mcp

MCP registry. The server is published to the official MCP registry as io.github.stramanu/esp32sim-mcp. For any other MCP client:

json
{  "mcpServers": {    "esp32sim": { "command": "npx", "args": ["-y", "esp32sim-mcp", "serve"] }  }}

Other platforms

setup installs prebuilt binaries on macOS arm64 and Linux x64/arm64. They are built from source by this repository's emulator workflow with signed build provenance (gh attestation verify <archive> -R stramanu/esp32sim-mcp). Elsewhere, build esp32sim with Cargo (rustup), pinned to the commit this release is tested against:

bash
cargo install --locked --git https://github.com/mikroverk/esp32sim --rev f535f3b42293a76ab64c231a0425f35857ab6cf1 esp32simnpx esp32sim-mcp fetch-roms

ESP32SIM_PATH points at an emulator binary elsewhere and ESP32SIM_ROM_DIR at another ROM directory; ROMs inside an ESP-IDF install are found automatically.

How it compares

Runs without a boardNeeds an account or tokenBuilt for agents
esp32sim-mcp✅ local emulatorNo✅ MCP server + skill
Wokwi CLI MCP✅Yes (WOKWI_CLI_TOKEN)⚠️ experimental
esparagus (Espressif)❌ flashes real hardwareNo✅
esp32sim on its own✅No❌ CLI and web UI

esparagus is the natural next step: simulate first with esp32sim-mcp, then confirm on a real board.

Limitations

  • An emulator is not silicon. Peripherals esp32sim does not model, RF timing and Bluetooth are out of reach here; confirm on hardware before you ship.
  • The agent builds the firmware itself (idf.py, locally or in Docker); the MCP server does not compile.
  • Windows is untested.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for the development setup and how the end-to-end tests run against the real emulator, and CHANGELOG.md for what changed.

Credits

License

MIT © Emanuele Strazzullo

來源:README.md,提交 46f0fe2

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.6最新Oct 19, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分