ESP32 Control

com.pixharvestv0.1.0更新于 Oct 8, 2026

Control ESP32 IoT devices from AI agents: status, GPIO, ADC, reboot.

概览

AI 生成的概览

让助手通过 REST API 查看和控制 ESP32 物联网设备:状态、GPIO 读写、ADC 采样、原始命令和重启。

功能
为运行轻量 MicroPython REST 固件的 ESP32 提供六个工具:esp32.status 返回在线状态、芯片型号、可用堆内存和运行时长;esp32.gpio_set 将某个 GPIO 置高或置低;esp32.gpio_read 读取数字引脚;esp32.adc_read 返回模拟电压(毫伏);esp32.send_command 发送原始 AT 或应用命令;esp32.reboot 重启设备。该服务器在本地运行,通过 HTTP 与设备通信,局域网和远程均可使用。
适用场景
当你希望 Claude Desktop、Cursor 等 AI 客户端直接查看或操作实体 ESP32 开发板时使用,例如切换引脚电平、采集模拟输入、检查设备健康状态或重启设备,而不必打开串口终端或自己写脚本。
运行要求
本地 Python 运行环境并安装 esp32-mcp 包,以及一台已刷入本项目 MicroPython 固件、开放 REST API 的 ESP32。设备地址通过环境变量 ESP32_HOST 设置(默认 ESP32_TIMEOUT 设置。设备自带的 WiFi 热点使用默认密码,应当修改。
安装前请注意
该服务器会改变硬件状态:esp32.gpio_set 会驱动实际引脚,esp32.send_command 会把原始命令传给设备,esp32.reboot 会重启设备,误操作会影响真实硬件。默认仅允许写入引脚 2、4、5、18、19。固件默认热点密码较弱,README 提醒在将设备暴露到互联网前先修改。项目提供付费 Pro 版本,但免费版已包含六个核心工具。

安装

在 SourceWeft 中

  1. 打开 控制台中的 ESP32 Control,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ESP32 MCP Server

Control and read ESP32 IoT devices directly from AI agents (Claude, Cursor, any MCP client).

  • esp32.status — online / chip / free heap / uptime
  • esp32.gpio_set — set a GPIO high/low
  • esp32.gpio_read — read a digital pin
  • esp32.adc_read — read analog voltage (mV)
  • esp32.send_command — raw AT/application command
  • esp32.reboot — reboot the device

Architecture

AI agent (Claude/Cursor)  →  this MCP server (Python)  →  ESP32 REST API  →  device

The ESP32 runs a tiny MicroPython firmware (esp32_firmware/main.py) exposing a lightweight REST API on port 80. The MCP server talks to it over HTTP — works locally and remotely.

Quick start

1. Flash the ESP32 firmware

  1. Install MicroPython on your ESP32.
  2. Upload esp32_firmware/main.py as main.py (Thonny or mpremote).
  3. Power on — the device opens a WiFi AP named ESP32-MCP (password 12345678) or you can set STA mode inside the firmware to join your network.

2. Run the MCP server

bash
pip install esp32-mcpexport ESP32_HOST=http://192.168.4.1     # device address (AP default)esp32-mcp                                  # stdio transport (local MCP client)

For remote agents, run with HTTP transport:

bash
uv run esp32-mcp --transport http --port 8000

3. Add to your AI client

Claude Desktop (claude_desktop_config.json):

json
{  "mcpServers": {    "esp32": {      "command": "esp32-mcp",      "env": { "ESP32_HOST": "http://192.168.4.1" }    }  }}

Cursor: Settings → MCP → Add server → esp32-mcp with env ESP32_HOST.

Then just ask: "turn GPIO 2 on", "what's the ADC reading on pin 34?", "reboot the device".

Configuration

Env varDefaultMeaning
ESP32_HOSThttp://192.168.4.1ESP32 REST endpoint
ESP32_TIMEOUT8request timeout (s)

Safety

  • GPIO outputs are limited to pins 2, 4, 5, 18, 19 by default (edit GPIO_OUT in the firmware to change).
  • The firmware only listens on its own network; change the AP password before exposing to the internet.

Pricing

PlanPriceWhat you get
Free$0All 6 core tools, single device
Pro$9/mo or $90/yrMulti-device, history, batch control, OTA, webhooks

Free is not a trial — core tools work forever. Upgrade when you need scale.

License

MIT

来源:README.md,提交 2e603b9

工具

0
工具元数据尚未被收录。

版本历史

1
  1. v0.1.0最新Oct 8, 2026