Get the FREE Ultimate OpenClaw Setup Guide →

esp32 server

A lightweight Model Context Protocol (MCP) server framework for ESP32. Seamlessly connect embedded devices to LLMs.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio solnera-esp32-mcpserver uvx solnera-esp32-mcpserver \
  --env PORT="3000" \
  --env WIFI_SSID="Your WiFi SSID" \
  --env WIFI_PASSWORD="Your WiFi password"

How to use

This ESP32 MCP server implements the MCP JSON-RPC 2.0 protocol over HTTP, allowing LLMs and agents to discover and execute tools exposed by the device. The server focuses on lightweight, on-device interaction with hardware capabilities via a defined tool API. Tools are registered with metadata and input schemas, enabling robust validation and structured parameter passing. To operate, the ESP32 hosts an MCP server that presents an endpoint (typically /mcp) for MCP traffic. An LLM can initialize a session, request a list of available tools using tools/list, and invoke a tool using tools/call with the appropriate parameters. The echo example in the repository demonstrates how a tool is defined, registered, and called, returning structured results such as echoed text and metadata like length and timestamp. This enables you to integrate hardware-facing functionality (sensors, actuators, etc.) into LLM-driven workflows while keeping the processing on-device for privacy and responsiveness.

How to install

Prerequisites:

  • ESP32 development board
  • Computer with PlatformIO installed (recommended) or Arduino IDE
  • Basic familiarity with ESP32 development workflow

Installation steps:

  1. Install PlatformIO Core (if not using the IDE):
  2. Open PlatformIO and clone the repository (or create a new PlatformIO project and copy the files):
  3. Install dependencies and libraries via PlatformIO (PlatformIO handles ArduinoJson, ESPAsyncWebServer, AsyncTCP automatically via platformio.ini)
  4. Configure WiFi in src/main.cpp (see configuration section below)
  5. Build and upload to your ESP32:
    • In PlatformIO, click Build, then Upload, or use the command line: platformio run --target upload

Configuration basics:

  • Ensure your ESP32 is connected to your WiFi network by editing the credentials in src/main.cpp (ssid and password).

Additional notes

Tips and caveats:

  • The server exposes MCP methods: initialize, notifications/initialized, tools/list, and tools/call. Ensure your LLM or agent is aware of the session handling as MCP may include session IDs.
  • Tools are defined with JSON Schema validation to enforce proper input/output shapes. Extend your tool metadata and schemas as needed.
  • If you encounter issues with network connectivity, double-check the ESP32’s IP address and ensure the device is reachable from the network where your orchestrator runs.
  • While this ESP32 server uses ESPAsyncWebServer for non-blocking operation, ensure proper memory management on constrained devices, especially when handling large JSON payloads.
  • For debugging, connect to the serial console to view logs during initialization and tool registration.

Related MCP Servers

Sponsor this space

Reach thousands of developers