MCP Connector

Build and Flash ESP32 Projects via LLM

Proof-of-concept MCP server consolidating ESP-IDF workflow commands - install, create, build, flash, and test ESP32 projects - into 7 LLM-callable tools.

Works with githubesp idf

Maintainer of this project? Claim this page to edit the listing.


91
Spark score
out of 100
Updated 7 months ago
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Streamline ESP32/ESP device project development by integrating ESP-IDF commands with LLM interaction. Automate build, flash, and management tasks for a more efficient embedded development lifecycle.

Outcomes

What it gets done

01

Build ESP-IDF projects through LLM commands.

02

Flash firmware to ESP devices with optional port specification.

03

Consolidate ESP-IDF and project commands for simplified LLM-driven development.

04

Experimental support for automatic issue fixing based on build logs.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-esp-mcp-server | bash

Capabilities

Tools your agent gets

build_project

Build an ESP-IDF project using the ESP32/ESP device build system.

flash_firmware

Flash built firmware to a connected ESP32/ESP device with optional port specification.

clean_build

Clean build files for an ESP32/ESP device project.

fix_build_issues

Automatically fix build issues based on build logs (experimental).

Overview

ESP MCP Server

A proof-of-concept MCP server wrapping the ESP-IDF CLI with seven tools for installing dependencies, scaffolding projects, setting target chips, building, listing serial ports, flashing firmware, and running pytest-embedded tests conversationally. Use for ESP32/ESP-IDF project install, build, flash, and test workflows via an AI assistant. Explicitly a PoC - monitor, menuconfig, and device management are future work, not current capabilities.

What it does

A proof-of-concept MCP server consolidating ESP-IDF and related project commands in one place, aiming to simplify getting started with Espressif's embedded development toolchain through LLM communication alone. The project is explicit about its current status - a PoC, not a finished product - and invites contributions for missing commands via pull request.

Seven core tools are implemented: run_esp_idf_install installs ESP-IDF dependencies and the toolchain via install.sh; create_esp_project scaffolds a new ESP-IDF project; setup_project_esp_target sets the target chip (esp32, esp32c3, esp32s3, and others); build_esp_project builds a project with incremental build support; list_esp_serial_ports lists available serial ports for connected ESP devices; flash_esp_project flashes built firmware to a connected device; and run_pytest runs pytest tests with pytest-embedded support for on-device testing.

Additional features layered on top: flexible per-project ESP-IDF path management via an idf_path parameter (so different projects can use different ESP-IDF versions without a shared environment variable), SDK config management supporting multiple sdkconfig_defaults files separated by semicolons for build configuration, build-time tracking for performance monitoring, optional port specification for flashing, and experimental automatic issue-fixing based on build log analysis.

Every tool also accepts an idf_path parameter directly, which takes priority over the IDF_PATH environment variable and lets a single MCP server manage multiple ESP-IDF versions across projects.

Documented usage is fully conversational: asking the chatbot to install ESP-IDF dependencies at a given path, set the target chip to esp32s3 for a project, build a project (optionally with custom sdkconfig defaults), run pytest against a target chip, or flash firmware to a connected device - each translating into the underlying idf.py build/set-target/flash or pytest commands.

The stated longer-term vision extends beyond the current PoC toward a comprehensive embedded-device toolkit: broader ESP-IDF command coverage (monitor, menuconfig interaction), device management and information retrieval, home-assistant-platform integration, and streamlined access to ESP-IDF documentation - none of which is implemented yet.

When to use - and when NOT to

Use this connector when you want an AI assistant to install, scaffold, build, flash, or test ESP-IDF projects for ESP32-family chips through natural language instead of manually running idf.py commands. Given its explicit PoC status, expect gaps in command coverage - monitor, menuconfig, and device management are documented as future work, not current capabilities - and verify build/flash results directly rather than assuming full parity with the ESP-IDF CLI.

Capabilities

Accepts natural-language requests specifying a project path, target chip, and optional ESP-IDF version or sdkconfig files. Returns the result of the corresponding ESP-IDF CLI command execution - install status, build output, flashed firmware, or pytest results - wrapping Espressif's ESP-IDF CLI (idf.py) and pytest-embedded for on-device testing.

How to install

git clone git@github.com:horw/esp-mcp.git

Configure into any MCP-supporting chatbot via a standard mcpServers entry pointing the command at a uv or Python executable, args at the cloned repository directory and main.py, and an optional IDF_PATH environment variable pointing at the ESP-IDF installation root for per-project version selection.

Who it's for

ESP32/ESP-IDF embedded developers who want to install, build, flash, and test firmware projects conversationally through an LLM, and are comfortable working with an early-stage proof-of-concept rather than a fully mature tool.

Source README

MseeP.ai Security Assessment Badge

Goal

The goal of this MCP is to:

  • Consolidate ESP-IDF and related project commands in one place.
  • Simplify getting started using only LLM communication.

How to contribute to the project

Simply find a command that is missing from this MCP and create a PR for it!

If you want someone to help you with this implementation, just open an issue.

Notice

This project is currently a Proof of Concept (PoC) for an MCP server tailored for ESP-IDF workflows.

Current Capabilities:

Core Features:

  • run_esp_idf_install: Install ESP-IDF dependencies and toolchain via install.sh.
  • create_esp_project: Create a new ESP-IDF project.
  • setup_project_esp_target: Set target chip for ESP-IDF projects (esp32, esp32c3, esp32s3, etc.).
  • build_esp_project: Build ESP-IDF projects with incremental build support.
  • list_esp_serial_ports: List available serial ports for ESP devices.
  • flash_esp_project: Flash built firmware to connected ESP devices.
  • run_pytest: Run pytest tests with pytest-embedded support for ESP-IDF projects.

Additional Features:

  • Flexible ESP-IDF path management: supports per-project ESP-IDF versions via idf_path parameter.
  • SDK config management: supports custom sdkconfig_defaults files for build configuration (multiple files can be specified separated by semicolons).
  • Build time tracking for performance monitoring.
  • Optional port specification for flashing operations.
  • Includes experimental support for automatic issue fixing based on build logs.

Vision & Future Work:
The long-term vision is to expand this MCP into a comprehensive toolkit for interacting with embedded devices, potentially integrating with home assistant platforms, and streamlining documentation access for ESP-IDF and related technologies.

We envision features such as:

  • Broader ESP-IDF command support (e.g., monitor, menuconfig interaction if feasible).
  • Device management and information retrieval.
  • Integration with other embedded development tools and platforms.

Your ideas and contributions are welcome! Please feel free to discuss them by opening an issue.

Install

First, clone this MCP repository:

git clone git@github.com:horw/esp-mcp.git

Then, configure it in your chatbot.

The JSON snippet below is an example of how you might configure this esp-mcp server within a chatbot or an agent system that supports the Model Context Protocol (MCP). The exact configuration steps and format may vary depending on the specific chatbot system you are using. Refer to your chatbot's documentation for details on how to integrate MCP servers.

{
    "mcpServers": {
        "esp-run": { // "esp-run" is an arbitrary name you can assign to this server configuration.
            "command": "<path_to_uv_or_python_executable>",
            "args": [
                "--directory",
                "<path_to_cloned_esp-mcp_repository>", // e.g., /path/to/your/cloned/esp-mcp
                "run",
                "main.py" // If using python directly, this might be just "main.py" and `command` would be your python interpreter
            ],
            "env": {
                "IDF_PATH": "<path_to_your_esp-idf_directory>" // e.g., ~/esp/esp-idf or C:\\Espressif\\frameworks\\esp-idf
            }
        }
    }
}

A few notes on the configuration:

  • command: This should be the full path to your uv executable if you are using it, or your Python interpreter (e.g., /usr/bin/python3 or C:\\Python39\\python.exe) if you plan to run main.py directly.
  • args:
    • The first argument to --directory should be the absolute path to where you cloned the esp-mcp repository.
    • If you're using uv, the arguments run main.py are appropriate. If you're using Python directly, you might only need main.py in the args list, and ensure your command points to the Python executable.
  • IDF_PATH: (Optional) This environment variable can point to the root directory of your ESP-IDF installation. ESP-IDF is Espressif's official IoT Development Framework. If you haven't installed it, please refer to the official ESP-IDF documentation for installation instructions. Note: All tools support an idf_path parameter that can be manually specified when calling the tool, allowing you to use different ESP-IDF versions for different projects without setting the environment variable. If idf_path is not provided, the tool will use the IDF_PATH environment variable if available.

Usage

Once the esp-mcp server is configured and running, your LLM or chatbot can interact with it using the tools defined in this MCP. For example, you could ask your chatbot to:

  • "Install ESP-IDF dependencies for the ESP-IDF installation at /path/to/esp-idf."
  • "Set the target chip to esp32s3 for the project in /path/to/my/esp-project."
  • "Build the project located at /path/to/my/esp-project using the esp-mcp."
  • "Build the project with custom sdkconfig defaults: sdkconfig.defaults;sdkconfig.ci.release."
  • "Run pytest tests for the project at /path/to/my/esp-project targeting esp32c3."
  • "Flash the firmware to my connected ESP32 device for the project in my_app."

The MCP server will then execute the corresponding ESP-IDF commands (like idf.py build, idf.py set-target, idf.py flash, pytest) based on the tools implemented in main.py.

The result.gif below shows an example interaction:

Examples

  1. Build and Flash

Star History

Star History Chart

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.