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
- Install MicroPython on your ESP32.
- Upload
esp32_firmware/main.py as main.py (Thonny or mpremote).
- 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
pip install esp32-mcp
export ESP32_HOST=http://192.168.4.1
esp32-mcp
For remote agents, run with HTTP transport:
uv run esp32-mcp --transport http --port 8000
3. Add to your AI client
Claude Desktop (claude_desktop_config.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 var | Default | Meaning |
|---|
ESP32_HOST | http://192.168.4.1 | ESP32 REST endpoint |
ESP32_TIMEOUT | 8 | request 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
| Plan | Price | What you get |
|---|
| Free | $0 | All 6 core tools, single device |
| Pro | $9/mo or $90/yr | Multi-device, history, batch control, OTA, webhooks |
Free is not a trial โ core tools work forever. Upgrade when you need scale.
License
MIT