Token导航 LogoToken导航TokenDH.com
Em MCP logo
AI代理未说明官方级别未说明来源级核验

Em MCP

MCP Server

emMCP是一个基于Ai-Thinker UART-MCP协议的适配库,提供简单易用的API,帮助开发者快速实现MCU与AI模型的MCP交互。

工具数

0

提示词数

0

GitHub Stars

2

资源数

0
AI交互AI代理工作流自动化

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Ai-Thinker-Open

提供方

Ai-Thinker-Open

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

![中文](README_zh.md)

emMCP

Like this project? Please consider giving it a Star ⭐️ to help improve the project!

Welcome to emMCP

emMCP (Easy mcu MCP) is an adapter library for rapid development based on Ai-Thinker UART-MCP. It provides a set of simple and easy-to-use APIs to help developers quickly use MCU to access AI models for MCP interaction.

AiPi-PalChatV1's UART-MCP protocol is a UART-based communication protocol mainly used for MCP interaction between MCU and AI models, with content structure primarily in JSON format. In actual development, developers often need to spend a lot of time handling low-level tasks such as UART serial communication adaptation between MCU and modules, protocol parsing, and data format conversion.

emMCP builds a set of simple, easy-to-use, and highly encapsulated APIs (Application Programming Interfaces) that encapsulate all complex low-level operations (such as serial port initialization and configuration, MCP command packaging and parsing, data validation, exception handling, etc.). Developers only need to call the encapsulated interfaces to complete operations like "establishing connection between MCU and module", "sending MCP commands", and "receiving MCP commands", greatly reducing development difficulty and shortening the development cycle.

Features

  • Support for customizing MCP tools to AI agents
  • Support for actively waking up Ai-Thinker AI devices
  • Support for setting communication baud rate, default 115200
  • Support for setting conversation volume
  • Built-in small state machine with freely customizable callback functions
  • Built-in MCP tool management
  • Memory and FLASH usage (minimum): RAM: 62 Byte, FLASH: 1708 Byte

How to Port?

1. Download Source Code

It is recommended to use GIT to download the source code with the following command:

git clone https://github.com/Ai-Thinker-Open/emMCP.git

2. Import emMCP Library into Your Project

Copy the port and uart-mcp folders to your project, and include the emMCP.h file to use all resources of emMCP.

The example provides a CMake example for STM32F103 (STM32F10xRTOS_MCP), which you can refer to configure your project.

3. Porting Interface

emMCP is a library for serial communication, so you only need to implement the underlying functions for serial communication.

  • First, open the port/uartPort.c file
  • In the function int uartPortSendData(char *data, int len), call your serial port sending function, passing data and len as parameters. For example:
	int uartPortSendData(char *data, int len)
	{
		// Implement serial port sending function here
		if (data == NULL || len Instance == USART2) {
			HAL_UARTEx_ReceiveToIdle_DMA(huart, (uint8_t *)rxBuffer, sizeof(rxBuffer));
			// Call emMCP receiving function
			uartPortRecvData((char *)rxBuffer, Size);
			__HAL_DMA_ENABLE_IT(&hdma_usart2_rx, DMA_IT_TC);
		}
    }

- Implementation of delay function, in the port/port.h file, implement the delay function in the macro #define emMCP_delay. For example:

	#define emMCP_delay osDelay

- Implementation of memory management functions, in the port/port.h file, implement the memory management functions in the macros #define emMCP_malloc and #define emMCP_free. For example:

	#define emMCP_malloc malloc
	#define emMCP_free free

4. Initialize emMCP

You can initialize emMCP anywhere before executing the main function, for example, before the main() function or in a separate initialization function. The code example for initializing emMCP is as follows:

static emMCP_t emMCP_dev;

int main(void)
{
	emMCP_Init(&emMCP_dev);
	while(1)
	{
		// Main loop execution
	}
}

5. Loop Execution of emMCP_TickHandler()

emMCP has a built-in simple state machine that requires cyclically calling emMCP_TickHandler() to process data, reducing the burden when using interrupt functions. It is recommended to call emMCP_TickHandler() in the main loop, for example:

static emMCP_t emMCP_dev;

int main(void)
{
	emMCP_Init(&emMCP_dev);
	while(1)
	{
		emMCP_TickHandler(10);
	}
}

6. Has the porting been successful?

After completing the above steps, compile your project to ensure it compiles successfully without errors. Follow the steps below to verify if the porting is successful:

  • Download the program to the MCU
  • Say "Hello Xiao'an" to the AI module
  • Observe the serial port output. If you see output similar to the following, it indicates that emMCP has been successfully ported to your MCU:
	[DEBUG] emMCP_EventCallback:78: emMCP_EventCallback: event:8,type:4,param:2.WakeUP

For MCP interaction, please refer to emMCP User Documentation

目录标签

目录标签

AI交互AI代理工作流自动化C本地部署MCU开发串口通信协议适配嵌入式开发

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP