mcp-stm32-server
🔌 MCP STM32 Controller Server / MCP STM32 컨트롤러 서버
**MCP (Model Context Protocol)**를 통해 STM32 마이크로컨트롤러를 제어할 수 있습니다. AI 어시스턴트는 자연어만으로 GPIO를 읽고 쓰고, LED를 제어하고, ADC를 읽고, OLED를 구동할 수 있습니다.
MCP(Model Context Protocol) 프로토콜을 통해 STM32 마이크로컨트롤러를 제어합니다. AI 어시스턴트는 이 서비스가 제공하는 도구를 호출하여 STM32의 GPIO 읽기/쓰기, LED 제어, ADC 읽기, OLED 화면 조작 등을 수행할 수 있습니다.
아키텍처
AI Assistant (Claude) ←→ MCP Server (this program) ←→ UART ←→ STM32 firmware통신은 JSON 라인 프로토콜을 사용합니다. 한 줄에 하나의 JSON 객체가 들어가며 \n으로 끝납니다.
Related MCP server: Serial MCP Server
빠른 시작
1. 의존성 설치
pip install -r requirements.txt2. 하드웨어 연결
STM32 USART1: PA9 (TX), PA10 (RX)
USB-TTL 모듈을 통해 PC에 연결합니다
아래에서 설명하는 JSON 라인 프로토콜을 구현한 펌웨어를 기기에 플래시합니다
3. 서버 시작
# auto-detect the serial port
python main.py
# specify a serial port
python main.py --port COM3
# SSE mode (HTTP service)
python main.py --sse --port COM3도구
도구 | 설명 | 인수 |
| STM32 온라인 상태 확인 | — |
| LED 밝기 설정 |
|
| 현재 LED 밝기 읽기 | — |
| GPIO 레벨 읽기 |
|
| GPIO 레벨 설정 |
|
| ADC 값 읽기 |
|
| OLED 화면 지우기 | — |
| OLED에 텍스트 표시 |
|
리소스
URI | 설명 |
| 연결 상태, 포트 정보, 가동 시간 |
구성
환경 변수 또는 명령줄 인수를 통해 설정합니다:
인수 | 환경 변수 | 기본값 | 설명 |
|
| 자동 감지 | 시리얼 포트 |
| — | 115200 | 전송 속도 |
| — | false | SSE 모드 |
| — | 8000 | SSE 포트 |
Claude Desktop과 통합
claude_desktop_config.json 파일을 편집합니다:
{
"mcpServers": {
"stm32": {
"command": "python",
"args": ["C:/path/to/mcp-stm32-server/main.py", "--port", "COM3"],
"env": {}
}
}
}통신 프로토콜 (JSON-lines)
각 줄은 독립적인 JSON 객체입니다. 펌웨어는 같은 id를 가진 JSON 라인 하나로 응답하기만 하면 됩니다.
요청:
{"id":1,"cmd":"set_led","args":{"brightness":75}}성공 응답:
{"id":1,"status":"ok","data":{"brightness":75}}오류 응답:
{"id":1,"status":"error","msg":"brightness must be 0-100"}펌웨어 계약: 수신한 모든 요청에 대해 동일한 id와 status("ok" / "error"), 그리고 data 또는 msg를 포함한 JSON 라인 하나로 응답해야 합니다. 부팅 중에 출력되는 유효한 JSON이 아닌 로그 줄은 클라이언트가 자동으로 건너뜁니다.
라이선스
MIT License.
아키텍처
AI 助手 (Claude) ←→ MCP Server (本程序) ←→ 串口 ←→ STM32 固件통신은 JSON 라인 프로토콜을 사용하며, 각 줄은 JSON 객체 하나이고 \n으로 끝납니다.
빠른 시작
1. 의존성 설치
pip install -r requirements.txt2. 하드웨어 연결
STM32의 USART1: PA9(TX), PA10(RX)
USB-TTL 모듈을 통해 컴퓨터에 연결합니다
아래에서 설명하는 JSON 라인 프로토콜을 구현한 펌웨어를 기기에 플래시합니다
3. 서버 시작
# 自动检测串口
python main.py
# 指定串口
python main.py --port COM3
# SSE 模式(HTTP 服务)
python main.py --sse --port COM3도구 목록
도구 | 설명 | 인수 |
| STM32 온라인 상태 확인 | 없음 |
| LED 밝기 설정 |
|
| LED 밝기 읽기 | 없음 |
| GPIO 레벨 읽기 |
|
| GPIO 레벨 설정 |
|
| ADC 값 읽기 |
|
| OLED 화면 지우기 | 없음 |
| OLED에 텍스트 표시 |
|
리소스
URI | 설명 |
| 연결 상태, 시리얼 포트 정보, 실행 시간 |
구성
환경 변수 또는 명령줄 인수를 통해 설정:
인수 | 환경 변수 | 기본값 | 설명 |
|
| 자동 감지 | 시리얼 포트 |
| — | 115200 | 전송 속도 |
| — | false | SSE 모드 |
| — | 8000 | SSE 포트 |
Claude Desktop과 통합
claude_desktop_config.json 파일을 편집합니다:
{
"mcpServers": {
"stm32": {
"command": "python",
"args": ["C:/path/to/mcp-stm32-server/main.py", "--port", "COM3"],
"env": {}
}
}
}프로토콜 형식 (JSON 라인)
각 줄은 독립된 JSON 객체입니다. 펌웨어는 같은 id를 가진 JSON 라인 하나만 응답하면 됩니다.
요청:
{"id":1,"cmd":"set_led","args":{"brightness":75}}성공 응답:
{"id":1,"status":"ok","data":{"brightness":75}}오류 응답:
{"id":1,"status":"error","msg":"brightness must be 0-100"}펌웨어 약속: 요청을 수신할 때마다 동일한 id를 포함하고 status("ok" / "error")와 data 또는 msg를 갖는 JSON 라인으로 응답합니다. 부팅 중 출력되는 JSON 형식이 아닌 로그 줄은 클라이언트가 자동으로 건너뜁니다.
라이선스
MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
AI electronics blueprint generator — BOM, wiring, firmware, renders for Arduino/ESP32/RPi.
Turns a phone into a camera+Bluetooth remote so AI assistants can see and control any PC.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants like Claude to control Arduino boards in real-time, allowing users to turn LEDs on and off through natural language commands using the Model Context Protocol and Firmata.12-
- AlicenseNot gradedqualityDmaintenanceEnables AI tools like Claude Code and Codex CLI to read and write serial port data, facilitating embedded development workflows such as coding, flashing, and debugging.19 npmMIT
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with STM32 development boards via J-Link debugger using RTT communication, supporting connection, logging, memory operations, and firmware flashing through natural language.121MIT
- FlicenseAqualityCmaintenanceEnables AI assistants to flash firmware, program memory, modify option bytes, erase chips, reset boards, and capture SWO printf traces for STM32 microcontrollers via STM32CubeCLT.12-