- Explore MCP Servers
- MCP_Control_STM32
Mcp Control Stm32
What is Mcp Control Stm32
MCP_Control_STM32 is a project that enables large language models to control hardware through serial communication by executing specific STM32 functions.
Use cases
Use cases include controlling robotic arms, managing sensor data, and automating tasks in smart home devices.
How to use
To use MCP_Control_STM32, clone the repository, create and activate a virtual environment, install the required dependencies, modify the configuration files for your language model and serial port settings, and then run the MCP code.
Key features
Key features include easy integration with large language models, customizable serial port settings, and the ability to control STM32 hardware functions directly via commands.
Where to use
MCP_Control_STM32 can be used in robotics, IoT applications, and any project that requires hardware control through natural language processing.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Control Stm32
MCP_Control_STM32 is a project that enables large language models to control hardware through serial communication by executing specific STM32 functions.
Use cases
Use cases include controlling robotic arms, managing sensor data, and automating tasks in smart home devices.
How to use
To use MCP_Control_STM32, clone the repository, create and activate a virtual environment, install the required dependencies, modify the configuration files for your language model and serial port settings, and then run the MCP code.
Key features
Key features include easy integration with large language models, customizable serial port settings, and the ability to control STM32 hardware functions directly via commands.
Where to use
MCP_Control_STM32 can be used in robotics, IoT applications, and any project that requires hardware control through natural language processing.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP控制STM32
MCP部分
1.下载源码
git clone https://github.com/ana52070/MCP_Control_STM32.git
cd MCP_Control_STM32
cd mcp-led_oled
2. 创建并激活虚拟环境
为了避免不同项目之间的依赖冲突,建议使用虚拟环境。根据你的操作系统和 Python 版本,创建并激活虚拟环境:
对于 Python 3.3 及以上版本
python -m venv .venv
在 Windows 上激活虚拟环境
.venv\Scripts\activate
在 Linux 或 macOS 上激活虚拟环境
source .venv/bin/activate
3. 安装依赖
直接使用pip安装依赖:
pip install httpx>=0.28.1 mcp>=1.8.0 openai>=1.78.0 python-dotenv>=1.1.0
4.修改代码
修改.env文件为自己的大语言模型,这里默认为ollama
BASE_URL=http://localhost:11434/v1/ MODEL=qwen2.5:1.5b OPENAI_API_KEY=ollama
而如果是使用DeepSeek模型,则需要在.env中写入如下内容:
BASE_URL=https://api.deepseek.com MODEL=deepseek-chat OPENAI_API_KEY="DeepSeek API-Key"
修改server-led.py中的串口配置
# 串口配置 SERIAL_PORT = "COM1" BAUDRATE = 115200 TIMEOUT = 1 # 秒
5.运行MCP代码
python client.py server-led.py
STM32部分
cd MCP_Control_STM32
使用Keil5进行编译和烧录即可,型号为STM32F103C8T6
或者支持使用hex文件手动烧录:
MCP_Control_STM32\STM32_Project\Objects\Project.hex
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










