Esp MCP Server 58a6c97d

MCPAI代理

提供方 0x1abin

AI代理 未标注 无需鉴权 社区 / 第三方

一个实现模型上下文协议(MCP)服务器的ESP32组件,为AI应用提供与ESP32设备集成的标准化方式。

一句话选型结论

按资料字段整理

Esp MCP Server 58a6c97d 属于AI代理类 MCP 服务器,传输方式未标注,无需鉴权,没有现成安装命令,需按官方文档接入。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类AI代理 传输方式未标注 鉴权无需鉴权 部署方式未标注
GitHub 星标 4 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

AI代理
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

适用场景

C本地部署ESP32MCP协议AI集成HTTP服务器JSON-RPC

安装与配置

未标注 无需鉴权
上游未给出传输方式
  1. 1
    准备运行环境

    按官方文档确认运行环境(常见为 Node.js 或 Python),装好后再执行安装命令。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
给代理接外部能力

让代理在任务中途调用搜索、数据库等真实工具。

多步任务编排

把一串操作拆成步骤,由代理按顺序执行。

自动化重复流程

把固定流程交给代理跑,减少手工操作。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注无需鉴权,装好就能连。

先想清楚的地方

  • 没有现成安装命令,需要按官方文档自己填启动命令和参数。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在AI代理场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Esp MCP Server 58a6c97d当前 未标注 未标注 未标注 无 2026-05-17
Filesystem 560c4363 13 未标注 本地部署 无 2026-05-17
Server Everything (everything) 11 stdio · 本地进程 本地部署 有 2026-05-17
Time 7365cb6d 2 SSE · 服务端推送 远程部署 有 2026-05-18
Everything Claude Code 未标注 stdio · 本地进程 本地部署 有 2026-05-17
Openmemory 557e1585 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

AI代理
字段来自项目仓库与公开索引,中文说明由本站标注
提供方0x1abin上游标注的维护方 0x1abin
分类AI代理本站按上游分类展示
连接方式未标注上游未给出传输方式
鉴权方式无需鉴权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型未标注上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

11.0 KB
来自项目仓库与上游目录的原文,未做删改

ESP32 MCP Server Component

中文文档 | English

An ESP32 component that implements the Model Context Protocol (MCP) server, providing a standardized way for AI applications to integrate with ESP32 devices. This component enables your ESP32 to expose tools and resources that can be discovered and used by AI agents and applications.

🌟 Features

  • 🚀 Simple API: Clean, intuitive interface for registering tools and resources
  • 🔧 Dynamic Registration: Register tools and resources at runtime
  • 📦 Modular Design: Standalone component, easy to integrate into existing projects
  • 🌐 HTTP Transport: JSON-RPC 2.0 over HTTP for maximum compatibility
  • 🔄 URI Templates: Support for parameterized resource URIs (e.g., sensor://{type}/{id})
  • 📊 Real-time Monitoring: Built-in server statistics and health monitoring
  • 🛡️ Memory Safe: Automatic memory management and cleanup
  • ✅ Schema Validation: Built-in parameter validation using JSON schemas (similar to Zod)
  • 🎯 MCP Compliant: Fully compliant with MCP specification 2025-06-18

🏗️ Architecture

The ESP32 MCP Server follows the standard MCP architecture:```
┌─────────────────┐ HTTP/JSON-RPC ┌─────────────────┐
│ MCP Client │ ◄─────────────────► │ ESP32 MCP │
│ (AI Agent) │ │ Server │
└─────────────────┘ └─────────────────┘
│
┌─────────────────┐
│ Your ESP32 │
│ Application │
│ (Tools & Data) │
└─────────────────┘


## 📦 Installation

### Using ESP Component Registry (Recommended)```bash
idf.py add-dependency "0x1abin/esp_mcp_server"

Manual Installation

  1. Clone this repository into your project's components directory:```bash
    cd your_project/components
    git clone https://github.com/0x1abin/esp-mcp-server.git esp_mcp_server

2. Include the component in your main `CMakeLists.txt`:```cmake
idf_component_register(
    SRCS "main.c"
    INCLUDE_DIRS "."
    REQUIRES esp_mcp_server
)

🚀 Quick Start

Basic Server Setup```c

include "esp_mcp_server.h"

// Tool handler function
static cJSON echo_tool_handler(const cJSON arguments, void user_data) {
cJSON
message = cJSON_GetObjectItem(arguments, "message");

cJSON *result = cJSON_CreateObject();
cJSON *content_array = cJSON_CreateArray();
cJSON *content = cJSON_CreateObject();

cJSON_AddStringToObject(content, "type", "text");
cJSON_AddStringToObject(content, "text", message->valuestring);

cJSON_AddItemToArray(content_array, content);
cJSON_AddItemToObject(result, "content", content_array);

return result;

}

void app_main(void) {
// Initialize WiFi (using ESP-IDF examples common)
ESP_ERROR_CHECK(nvs_flash_init());
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
ESP_ERROR_CHECK(example_connect());

// Configure MCP server
esp_mcp_server_config_t config = ESP_MCP_SERVER_DEFAULT_CONFIG();
config.port = 80;
config.server_name = "ESP32 MCP Server";
config.server_version = "1.0.0";

// Initialize server
esp_mcp_server_handle_t server;
ESP_ERROR_CHECK(esp_mcp_server_init(&config, &server));

// Create input schema for validation
cJSON *schema = schema_builder_create_object();
schema_builder_add_string(schema, "message", "Message to echo", true);

// Register echo tool
esp_mcp_tool_config_t tool_config = {
    .name = "echo",
    .description = "Echoes back the provided message",
    .input_schema = schema,
    .handler = echo_tool_handler,
    .user_data = NULL
};
ESP_ERROR_CHECK(esp_mcp_server_register_tool(server, &tool_config));

// Start the server
ESP_ERROR_CHECK(esp_mcp_server_start(server));

ESP_LOGI("MAIN", "MCP Server started on port %d", config.port);

}


### Advanced Example with GPIO Control```c
// GPIO control tool with schema validation
static cJSON* gpio_control_handler(const cJSON *arguments, void *user_data) {
    cJSON *pin = cJSON_GetObjectItem(arguments, "pin");
    cJSON *state = cJSON_GetObjectItem(arguments, "state");

    // SDK layer guarantees parameters are validated
    int gpio_num = pin->valueint;
    bool gpio_state = cJSON_IsTrue(state);

    gpio_set_level(gpio_num, gpio_state ? 1 : 0);

    cJSON *result = cJSON_CreateObject();
    cJSON *content_array = cJSON_CreateArray();
    cJSON *content = cJSON_CreateObject();

    cJSON_AddStringToObject(content, "type", "text");

    char response[100];
    snprintf(response, sizeof(response), "GPIO %d set to %s",
             gpio_num, gpio_state ? "HIGH" : "LOW");
    cJSON_AddStringToObject(content, "text", response);

    cJSON_AddItemToArray(content_array, content);
    cJSON_AddItemToObject(result, "content", content_array);

    return result;
}

// Register GPIO control tool with schema validation
cJSON *gpio_schema = schema_builder_create_object();
schema_builder_add_integer(gpio_schema, "pin", "GPIO pin number", 0, 39, true);
schema_builder_add_boolean(gpio_schema, "state", "GPIO state (true=HIGH, false=LOW)", true);

esp_mcp_tool_config_t gpio_tool = {
    .name = "gpio_control",
    .description = "Control ESP32 GPIO pins",
    .input_schema = gpio_schema,
    .handler = gpio_control_handler,
    .user_data = NULL
};
ESP_ERROR_CHECK(esp_mcp_server_register_tool(server, &gpio_tool));

🔧 API Reference

Server Lifecycle```c

// Initialize server (does not start HTTP server)
esp_err_t esp_mcp_server_init(const esp_mcp_server_config_t config,
esp_mcp_server_handle_t
server_handle);

// Start HTTP server after registering tools/resources
esp_err_t esp_mcp_server_start(esp_mcp_server_handle_t server_handle);

// Stop HTTP server (can be restarted later)
esp_err_t esp_mcp_server_stop(esp_mcp_server_handle_t server_handle);

// Cleanup and free all resources
esp_err_t esp_mcp_server_deinit(esp_mcp_server_handle_t server_handle);


### Tool Registration```c
// Register a tool with optional schema validation
esp_err_t esp_mcp_server_register_tool(esp_mcp_server_handle_t server_handle,
                                       const esp_mcp_tool_config_t *tool_config);

// Tool handler signature
typedef cJSON* (*esp_mcp_tool_handler_t)(const cJSON *arguments, void *user_data);

Resource Registration```c

// Register a resource
esp_err_t esp_mcp_server_register_resource(esp_mcp_server_handle_t server_handle,
const esp_mcp_resource_config_t *resource_config);

// Resource handler signature
typedef char (esp_mcp_resource_handler_t)(const char uri, void user_data);


### Schema Validation (Built-in Zod-like API)```c
// Create schema objects
cJSON* schema_builder_create_object(void);

// Add typed fields with validation
esp_err_t schema_builder_add_string(cJSON *schema, const char *name,
                                   const char *description, bool required);
esp_err_t schema_builder_add_integer(cJSON *schema, const char *name,
                                    const char *description, int min, int max, bool required);
esp_err_t schema_builder_add_boolean(cJSON *schema, const char *name,
                                    const char *description, bool required);

🎯 MCP Protocol Support

This component fully implements the MCP specification:

  • Tools: Execute actions with side effects (returns JSON)
  • Resources: Provide data content (returns string/binary)
  • Prompts: Reusable templates (planned)
  • JSON-RPC 2.0: Complete protocol compliance
  • Error Handling: Standard error codes and messages
  • Schema Validation: Input parameter validation

Supported MCP Methods

Method Description Status
initialize Server initialization and capability negotiation ✅
tools/list List available tools ✅
tools/call Execute a tool ✅
resources/list List available resources ✅
resources/read Read resource content ✅
ping Health check ✅

📊 Examples

The component includes a comprehensive example in examples/simple/ that demonstrates:

  • WiFi connection setup
  • MCP server initialization and configuration
  • Tool registration with schema validation
  • Resource registration with URI templates
  • GPIO control integration
  • ADC reading functionality
  • Real-time server statistics

Running the Example```bash

cd examples/simple
idf.py set-target esp32
idf.py menuconfig # Configure WiFi credentials
idf.py build flash monitor


## 🔧 Configuration Options```c
typedef struct {
    uint16_t port;                    // HTTP server port (default: 8080)
    const char *server_name;          // Server identification
    const char *server_version;       // Server version
    size_t max_connections;           // Max concurrent connections
    size_t stack_size;                // HTTP server stack size
    int task_priority;                // HTTP server task priority
} esp_mcp_server_config_t;

// Default configuration macro
#define ESP_MCP_SERVER_DEFAULT_CONFIG() { \
    .port = 8080, \
    .server_name = "ESP32 MCP Server", \
    .server_version = "1.0.0", \
    .max_connections = 4, \
    .stack_size = 8192, \
    .task_priority = 5 \
}

🛡️ Security Considerations

  • Parameter Validation: All tool inputs are validated against JSON schemas
  • Memory Safety: Automatic cleanup of JSON objects and strings
  • Error Handling: Comprehensive error reporting with standard HTTP/JSON-RPC codes
  • Resource Limits: Configurable connection limits and timeouts

🧪 Testing

Test your MCP server using any MCP-compatible client:```bash

Using curl to test tools/list

curl -X POST http://your-esp32-ip/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Using curl to call a tool

curl -X POST http://your-esp32-ip/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"echo","arguments":{"message":"Hello World"}}}'
```

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Related Projects

  • Model Context Protocol Specification
  • ESP-IDF
  • cJSON

📞 Support

  • Issues: GitHub Issues
  • Discussions: GitHub Discussions
  • ESP32 Forum: Espressif Forum

Made with ❤️ for the ESP32 and AI community

常见问题

5 问
答案由本站依据条目字段整理,不引用上游原文
Esp MCP Server 58a6c97d 怎么安装?

资料没有给出安装命令,请到官方仓库或文档按说明接入;这类条目多数是生态应用,或尚未发布可安装包。

Esp MCP Server 58a6c97d 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

Esp MCP Server 58a6c97d 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Esp MCP Server 58a6c97d 需要 API Key 吗?

资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Esp MCP Server 58a6c97d 能提供哪些能力?

资料显示能力标签包括 HTTP服务器、本地部署、JSON-RPC、AI代理。具体工具清单以官方文档为准。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。