HM

hardware-mcp/arduino-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 2 forks 质量 79 趋势 19MIT

一个开源的Arduino MCP服务器,使AI助手能够通过模型上下文协议通过结构化工具访问与Arduino交互。

概览

作为HardwareMCP生态系统的一部分——开源的MCP服务器,将人工智能与实体硬件连接起来。 AI助手可以控制Jira、GitHub和数据库。但他们不能与微控制器对话——直到现在。 arduino-mcp-server 将 arduino-cli 包裹进 MCP 服务器,使你的 AI 能够: - 自动连接板和端口——无需触碰终端即可草图——并有状态会话(打开、读取、预期、写入、关闭)——在向硬件发送命令前——核心、库和CLI安装 需要在你的PATH上安装arduino-cli,或者让服务器帮你安装。 “检查一下是否安装了Arduino CLI,并把所有设置都设置成Arduino Uno。” “把我的Blink草图整理好,上传到COM6的Uno。” “在COM6上115200打开序列号,等待设备打印准备好。”

概述(AI 翻译)

让你的AI助手完全控制Arduino——通过自然语言编译、上传、监控序列并验证布线安全。

作为HardwareMCP生态系统的一部分——开源的MCP服务器,将人工智能与实体硬件连接起来。


这有什么用

AI助手可以控制Jira、GitHub和数据库。但他们不能与微控制器对话——直到现在。

arduino-mcp-server 将 arduino-cli 包裹进 MCP 服务器,使你的 AI 能够:

  • 自动检测已连接的板和端口
  • 编译并上传草图,无需触碰终端
  • **用有状态会话(打开、读取、预期、写入、关闭)监控串行输出
  • 发送命令给硬件前先进行电气安全检查
  • 管理依赖 — 核心、库和CLI安装

快速启动

安装:

Add to Claude Desktop (claude_desktop_config.json):

需要在你的PATH上安装arduino-cli,或者让服务器帮你安装。


你能说什么

从零开始Bootstrap:

“检查是否安装了Arduino CLI,并把所有设置都设置成Arduino Uno。”

编译并上传:

“把我的Blink小品汇编好,上传到COM6上的Uno。”

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

arduino-mcp-server

Give your AI assistant full control over Arduino — compile, upload, monitor serial, and verify wiring safety, all through natural language.

Part of the HardwareMCP ecosystem — open-source MCP servers that bridge AI to physical hardware.


What this does

AI assistants can control Jira, GitHub, and databases. They can’t talk to a microcontroller — until now.

arduino-mcp-server wraps arduino-cli into an MCP server so your AI can:

  • Detect connected boards and ports automatically
  • Compile and upload sketches without touching the terminal
  • Monitor serial output with stateful sessions (open, read, expect, write, close)
  • Run electrical safety checks before sending commands to hardware
  • Manage dependencies — cores, libraries, and CLI installation

Quick Start

Install:

npm install -g arduino-mcp-server

Add to Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "arduino": {
      "command": "npx",
      "args": ["-y", "arduino-mcp-server"],
      "env": {
        "ARDUINO_CLI_PATH": "arduino-cli",
        "ARDUINO_SKETCH_ROOT": "/path/to/your/sketches"
      }
    }
  }
}

Requires arduino-cli on your PATH, or let the server install it for you.


What you can say

Bootstrap from scratch:

“Check if Arduino CLI is installed and set everything up for an Arduino Uno.”

Compile and upload:

“Compile my Blink sketch and upload it to the Uno on COM6.”

Serial monitoring:

“Open serial on COM6 at 115200 and wait until the device prints READY.”

Safety-first workflows:

“Run a safety preflight for an Arduino Uno with 5V on pin 13 at 25mA before I send commands.”


Tools

Tool What it does
arduino_cli_doctor Check Arduino CLI installation and version
install_arduino_cli Guide through arduino-cli installation
detect_hardware Detect connected boards and infer FQBNs
list_connected_boards List all connected Arduino boards
list_serial_ports List available serial ports
ensure_core_installed Check/install board cores
compile_sketch Compile a sketch for a target board
upload_sketch Upload compiled sketch to a board
upload_and_wait_ready Upload and wait for device ready signal
serial_open_session Open a stateful serial session
serial_read Read buffered serial data
serial_expect Wait for a pattern in serial output
serial_write Send data over serial
serial_close_session Close a serial session
在 GitHub 查看完整 README

安装

npx -y arduino-mcp-server
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "arduino": { "command": "npx", "args": ["-y", "arduino-mcp-server"], "env": { "ARDUINO_CLI_PATH": "arduino-cli", "ARDUINO_SKETCH_ROOT": "/path/to/your/sketches" } } } }