esp32-cam-ai
A Model Context Protocol (MCP) server implementation for ESP32-CAM that enables integration with a Large Language Model (LLM). The LLM connects using this library to the ESP32-CAM offering remote camera control, LED management, and system monitoring through standardized MCP tools offering AI capabilities.
claude mcp add --transport stdio rzeldent-esp32-cam-ai uvx rzeldent-esp32-cam-ai
How to use
This MCP server turns an ESP32-CAM into a remotely controllable, AI-enabled camera system. It exposes a set of tools and status queries via the MCP protocol, enabling you to capture images, control the built-in LED and the camera flash, and retrieve system and network diagnostics. Tools are designed to be consumed by AI assistants and automation platforms, allowing you to issue commands such as turning the LED on or off, triggering a brief flash before capturing a photo, or requesting current WiFi and hardware status. With mDNS and OTA support, the device is easy to discover on a local network and keep up to date without manual intervention.
Typical usage flows involve invoking the LED or flash tools to set lighting conditions, then requesting a camera capture (with optional flash) to obtain a base64-encoded JPEG under a small size constraint for streaming or quick display. You can also poll WiFi status for connection details (IP address, signal strength) and system status for health metrics (uptime, memory usage, reset reasons). The MCP protocol ensures proper JSON-RPC structure, validation, and descriptive error codes, so integrations in Copilot, Home Assistant, Node-RED, or other automation environments will have predictable behavior.
How to install
Prerequisites:
- A compatible ESP32-CAM board (AI-Thinker is the primary target)
- PlatformIO IDE or CLI installed on your development workstation
- ESP32 development framework setup in PlatformIO
- Basic familiarity with editing project configuration and WiFi credentials
Step-by-step:
- Clone the repository to your development machine or copy the firmware project to PlatformIO workspace.
git clone https://github.com/yourusername/esp32-cam-ai.git
cd esp32-cam-ai
- Install dependencies and configure WiFi:
- Copy the template environment file and add your credentials.
cp .env.template .env
Edit .env to set WIFI_SSID and WIFI_PASSWORD.
- Build and upload the firmware to your ESP32-CAM:
pio run --target upload
- Monitor the serial output to confirm IP address and readiness:
pio device monitor
- After initial setup, the device will announce its local IP or mDNS hostname. Use your MCP-enabled tools or an MCP client to start issuing tool calls (e.g., led, flash, capture) against the server.
Additional notes
Notes and tips:
- Ensure the camera and LEDs are wired correctly and pins in build_flags match your board. Misconfigured pins can cause capture failures or no LED control.
- The MCP tools return status messages and, for capture, a base64-encoded JPEG intended to stay under ~4 KB whenever possible. Use the provided structure in tool responses to handle image data safely in UI clients.
- If the device restarts, watchdog and OTA features help with recovery and updates. Make sure to enable mDNS and provide a stable network environment for reliable device discovery.
- If you encounter build errors related to camera initialization, verify the chosen camera_config and that the ESP32-CAM board variant matches your hardware.
- When integrating with automations, ensure your caller adheres to the MCP JSON-RPC schema and handles error codes gracefully.
Related MCP Servers
mcp
Official Microsoft Learn MCP Server – powering LLMs and AI agents with real-time, trusted Microsoft docs & code samples.
coplay-unity-plugin
Unity plugin for Coplay
advanced-homeassistant
An advanced MCP server for Home Assistant. 🔋 Batteries included.
gtm
An MCP server for Google Tag Manager. Connect it to your LLM, authenticate once, and start managing GTM through natural language.
packt-netops-ai-workshop
🔧 Build Intelligent Networks with AI
nodit
A Model Context Protocol (MCP) server for AI agents to interact with blockchain data via Nodit’s Web3 Data and Node APIs. Enables LLMs to access structured, multi-chain blockchain context with zero blockchain-specific logic.