esp_mcp_server
An ESP32 component that implements the Model Context Protocol (MCP) server, providing a standardized way for AI applications to integrate with ESP32 devices.
claude mcp add --transport stdio 0x1abin-esp_mcp_server idf.py build \ --env ESP_PORT="COMx or /dev/ttyUSBx" \ --env IDF_PATH="path/to/esp-idf" \ --env PROJ_NAME="Your ESP32 MCP Project" \ --env ESP_VSP_PORT="optional"
How to use
The ESP32 MCP Server Component implements the Model Context Protocol (MCP) server directly on an ESP32 device. It exposes tools and resources that AI agents or applications can discover and invoke over HTTP using JSON-RPC 2.0. You can register tools at runtime with input schemas for validation (Zod-like) and handlers that execute on the ESP32, allowing secure, schema-validated interactions with your device's capabilities (for example, GPIO control, sensor readings, or custom hardware actions). The server also supports URI-templated resources and built-in monitoring, making it suitable for integration with AI agents that rely on a standardized context protocol for control and querying of physical devices.
To use it, connect the ESP32 to a network, run the MCP server as part of your firmware (per the ESP-IDF project setup), and address the server via HTTP endpoints on port 80 (or your configured port). Tools you register include a name, a description, an input schema for validation, and a function that handles incoming arguments and returns a JSON payload. The example in the README demonstrates an echo tool and a GPIO control example, illustrating how to define schemas, register tools at startup, and start the HTTP server to listen for MCP requests.
How to install
Prerequisites\n- A working ESP-IDF development environment (v5.0+).\n- Git and Python installed on your development machine.\n- ESP32 hardware or a suitable ESP32 development board.\n\nInstall and setup steps\n1) Set up ESP-IDF and create your project, or use an existing one that will include the esp_mcp_server component.\n2) Add the component to your project, either via the ESP component registry or by cloning the repository into your project's components/ directory.\n - Recommended: Use the ESP Component Registry to fetch 0x1abin/esp_mcp_server.\n - Manual: Clone into your_project/components/esp_mcp_server.\n3) Include and configure the MCP server in your firmware (example in README shows how to initialize, configure, register tools/resources, and start the server).\n4) Build and flash to your ESP32 device. The typical workflow uses idf.py.\n\nExample commands\n- From your project root:\n idf.py add-dependency "0x1abin/esp_mcp_server"\n idf.py build\n idf.py -p /dev/ttyUSB0 flash monitor
Additional notes
Tips and common considerations:\n- Ensure your ESP32 is connected to a network so the MCP server can be reached over HTTP.\n- Use the built-in schema validation to prevent invalid tool invocations.\n- When registering resources/tools at runtime, consider thread-safety and memory usage on the ESP32.\n- The server uses HTTP/JSON-RPC 2.0; ensure proper authentication if exposing over untrusted networks.\n- The example shows a simple echo tool and a GPIO control tool; you can define more complex tools to expose actuators, sensors, or device state.\n- The MCP schema helpers resemble a Zod-like API for validating inputs; leverage this for robust command definitions.\n- If you encounter port or connectivity issues, verify WiFi setup and firewall rules on the network hosting the MCP client.
Related MCP Servers
MCPSpy
MCP Monitoring with eBPF
paiml -agent-toolkit
Pragmatic AI Labs MCP Agent Toolkit - An MCP Server designed to make code with agents more deterministic
schedcp
MCP Server for Linux Scheduler Management and Auto optimization
neurondb
PostgreSQL extension for vector search, embeddings, and ML, plus NeuronAgent runtime and NeuronMCP server.
mcp_server_pcileech
A simple MCP server for using pcileech to read or write another pc's memory
mcp
MCP server from FitzQ/mcp-server