Get the FREE Ultimate OpenClaw Setup Guide →

ESP32 -air-conditioner

Turn your Air Conditioner on/off and control it from a Chatbot application using this MCP server running on an ESP32 microcontroller

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mrlaki5-esp32-mcp-air-conditioner arduino --upload ESP32-MCP-air-conditioner.ino \
  --env AC_IR_PIN="GPIO_NUM" \
  --env WIFI_SSID="your-ssid" \
  --env IR_PROTOCOL="required if using IR control (e.g., NEC, RC6)" \
  --env AC_POWER_PIN="GPIO_NUM" \
  --env MCP_SERVER_IP="0.0.0.0" \
  --env WIFI_PASSWORD="your-password" \
  --env MCP_SERVER_PORT=" MCP port if applicable"

How to use

This MCP server runs on an ESP32 and exposes MCP-compatible endpoints to control an air conditioner via IR or a relay. After flashing the Arduino-based firmware, the ESP32 connects to your Wi‑Fi network and becomes a bridge between your chatbot or MCP client and the AC. Use the MCP client to send intents like power on/off, set temperature, or change modes. The server maps those intents to IR signals or relay commands so you can control the AC remotely from chat or voice interfaces. You can customize the supported commands in the Arduino sketch to fit your specific AC model and its remote protocol.

How to install

Prerequisites:

  • A ESP32 development board
  • USB cable to program the ESP32
  • Arduino IDE installed or a compatible ESP32 toolchain
  • ESP32 board support added to the Arduino IDE
  • Optionally IRremoteESP8266 and ArduinoJson libraries (installed via Library Manager)

Step-by-step:

  1. Clone this repository to your computer.
  2. Open ESP32-MCP-air-conditioner.ino in the Arduino IDE.
  3. Configure Wi‑Fi credentials and any AC-specific settings in the code (WIFI_SSID, WIFI_PASSWORD, IR/relay pin assignments, and MCP settings).
  4. Connect the ESP32 to your computer via USB.
  5. Select the correct ESP32 board and port in the Arduino IDE.
  6. Upload the sketch to the ESP32.
  7. Power the ESP32 and ensure it connects to your Wi‑Fi network. Use your MCP client or chatbot to send control commands to the ESP32's IP address.

If you prefer, you can adapt the provided sketch to a different development workflow, but the steps above outline the typical Arduino-based deployment.

Additional notes

Notes and tips:

  • Ensure the IR LED or relay wiring matches the pins defined in the sketch (AC_POWER_PIN, AC_IR_PIN).
  • Some air conditioners use different IR protocols; update IR_PROTOCOL in the code if needed.
  • If the ESP32 cannot reach your Wi‑Fi network, check router settings and ensure the ESP32 is on the same network.
  • The mcp.json configuration file referenced by the firmware is required by the MCP framework; ensure it’s present and correctly formatted in your project.
  • If you encounter library conflicts, install compatible versions via the Arduino Library Manager (ArduinoJson and IRremoteESP8266 are common requirements).
  • For chatbot integration, expose intents like power_on, power_off, set_temperature, and set_mode; map them to the corresponding MCP commands in the sketch.

Related MCP Servers

Sponsor this space

Reach thousands of developers