MCPSERV.CLUB
navado

ESP32 MCP Server

MCP Server

Real‑time resource discovery on ESP32 via WebSocket

Stale(50)
25stars
1views
Updated 22 days ago

About

An MCP (Model Context Protocol) implementation for ESP32 microcontrollers that provides a WebSocket server, WiFi configuration, and resource monitoring using LittleFS and AsyncWebServer.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

ESP32 MCP Server Architecture

The ESP32 MCP Server is a lightweight, WebSocket‑based implementation of the Model Context Protocol designed to run on ESP32 microcontrollers. Its primary goal is to expose device resources—such as sensor readings, configuration parameters, and system metrics—to AI assistants in a standardized format. By translating the MCP specification into an embedded context, developers can turn any ESP32‑based project into a first‑class participant in AI workflows without the overhead of a full server stack.

At its core, the server provides real‑time resource discovery and monitoring. Once a client establishes a WebSocket connection on port 9000, it can issue standard MCP calls (, , etc.) to query the device’s capabilities. The server responds with JSON‑RPC messages that describe available resources, their types, and current values. This dynamic discovery is essential for assistants that need to adapt to heterogeneous hardware; the assistant can request a temperature sensor, confirm its presence, and then pull live data—all without hard‑coding device specifics.

Key features include a thread‑safe request queue, ensuring that concurrent client interactions are handled reliably on the dual‑core ESP32. The server integrates seamlessly with AsyncWebServer, offering both WebSocket and HTTP endpoints for configuration management. A simple web interface is served from LittleFS, allowing users to set WiFi credentials or reset the device without needing a serial console. The architecture diagram shows how network tasks, MCP handling, metrics collection, and logging are isolated across cores for maximum responsiveness.

Real‑world use cases abound: a home automation hub that publishes motion and temperature data to an AI assistant, a smart agriculture node that streams soil moisture readings for predictive analytics, or an industrial IoT sensor that reports vibration metrics to a maintenance bot. In each scenario, the MCP server removes the need for custom APIs or proprietary protocols; the assistant can treat the ESP32 as any other MCP‑compliant endpoint, leveraging its built‑in resource listing and live updates.

What sets this implementation apart is its minimal footprint coupled with a comprehensive test suite. The server runs entirely on the ESP32, yet it adheres to MCP v0.1.0 and offers a stable WebSocket interface ready for production use. Developers building AI‑enabled edge devices can integrate this server into their workflows, enabling agents to discover, query, and act upon sensor data in real time—without reinventing the wheel for each new hardware platform.