Arduino MCP Server

io.github.hardware-mcp由 GitHub 账号 hardware-mcp 发布v0.2.8更新于 Oct 24, 2026

Arduino MCP server for CLI setup, board detection, compile/upload, serial monitoring, and pin refs.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

本地 MCP 服务器,封装 arduino-cli,让助手检测开发板、编译并上传草图、监控串口,并执行接线安全检查。

可以做什么
检测已连接的开发板和串口并推断板卡标识,同时提供板卡与引脚参考的浏览和搜索。编译草图并上传到目标开发板,包括上传后等待设备就绪。打开、读取、等待匹配、写入和关闭有状态的串口会话,并支持一次性串口快照。执行电气安全预检,涵盖电池充电倍率、电池极性和 ESP32 系列引脚风险。检查或安装 arduino-cli 与板卡核心,并提供安装引导提示和板卡参考资源。
适用场景
适合希望用自然语言让助手端到端操作 Arduino 流程的场景:搭建工具链、编译并烧录草图、观察串口输出,或在给硬件通电前核对接线与电池选择。
运行要求
作为本地 stdio 进程在桌面电脑上运行,通过 npm 安装。需要 arduino-cli 位于 PATH 中,或用 ARDUINO_CLI_PATH 指向该可执行文件;服务器也可引导安装。可选设置 ARDUINO_SKETCH_ROOT 将草图操作限制在某个目录。上传和串口工具需要已连接的开发板和串口。
安装前请注意
上传会把固件写入所连接的开发板,serial_write 会向设备发送数据,因此操作会影响真实硬件。安全预检结果基于厂商公布的近似数值,应针对具体板卡版本查阅数据手册核实。电池与引脚检查只是提示性防护,不能替代电气验证。设置 ARDUINO_SKETCH_ROOT 可限制可访问的草图路径。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Arduino MCP Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

arduino-mcp-server

[npm version] [License: MIT] [Node.js 20+]

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:

bash
npm install -g arduino-mcp-server

Add to Claude Desktop (claude_desktop_config.json):

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

ToolWhat it does
arduino_cli_doctorCheck Arduino CLI installation and version
install_arduino_cliGuide through arduino-cli installation
detect_hardwareDetect connected boards and infer FQBNs
list_connected_boardsList all connected Arduino boards
list_serial_portsList available serial ports
ensure_core_installedCheck/install board cores
compile_sketchCompile a sketch for a target board
upload_sketchUpload compiled sketch to a board
upload_and_wait_readyUpload and wait for device ready signal
serial_open_sessionOpen a stateful serial session
serial_readRead buffered serial data
serial_expectWait for a pattern in serial output
serial_writeSend data over serial
serial_close_sessionClose a serial session
serial_list_sessionsList active serial sessions
read_serial_snapshotQuick one-shot serial read
safety_preflightElectrical safety check before hardware ops
get_board_detailsGet pin/capability details for a board
list_supported_boardsList all boards arduino-cli supports
list_board_referenceBrowse board pin reference
search_board_referenceSearch board reference by keyword

Resources:

  • arduino://boards/reference — structured board pin/capability reference

Prompts:

  • arduino-cli-bootstrap-policy — policy for arduino-cli setup behavior
  • arduino-setup-assistant — guided Arduino environment setup

Safety preflight guardrails

safety_preflight (and the safetyContext passed to upload_sketch, upload_and_wait_ready, and serial_write) now also covers battery and ESP32-family pin footguns, driven by small, extensible data tables rather than hardcoded to any one board:

Battery charge-rate (C-rate) check — pass a battery object (capacityMah, chargeCurrentMa, chemistry) and the check computes chargeCurrentMa / batteryCapacityMah and flags it:

  • BATTERY_CRATE_UNSAFE (hard, blocking) above 1C
  • BATTERY_CRATE_CAUTION (soft, non-blocking) above 0.5C

Generic small LiPo cells are commonly rated for roughly a 0.5–1C safe charge current, so the message spells out the math, e.g. "380mA into a 100mAh cell is a 3.8C rate — well above the ~0.5-1C safe range for typical small LiPo cells; verify your cell's actual rated charge current before proceeding." If chargeCurrentMa is omitted, it's inferred from a small board → onboard-charge-IC lookup table (currently seeded with Seeed XIAO ESP32S3, XIAO ESP32S3 Sense, and XIAO ESP32C3 — see data/battery-charge-ic-reference.json, easy to extend with more boards). These are approximate, manufacturer-published figures — verify against the live datasheet/wiki for your exact board revision before trusting them in a production workflow.

Battery polarity confirmation — when battery.connecting: true (or any battery field is set) but battery.polarityConfirmed isn't explicitly true, the preflight blocks with BATTERY_POLARITY_UNCONFIRMED and a reminder to never assume BAT+/BAT- from wire color. On Seeed XIAO boards it cites the official convention: the negative pad is closest to the USB-C port, positive is farthest from it.

ESP32-family pin safety (table-driven per board via data/board-reference.json):

  • SPI-flash pins (GPIO6-11 on classic ESP32 WROOM/WROVER modules) — hard error (SPI_FLASH_PIN_USED); wiring these prevents boot.
  • Boot-strapping pins (GPIO0/2/12/15 on classic ESP32) — caution; usable at runtime but risky if externally held during boot/reset (existing check).
  • Input-only pins with no internal pull resistor (GPIO34-39 on classic ESP32) — caution (NO_INTERNAL_PULL_PIN); add an external pull-up/pull-down if using them as buttons/switches.
  • Seeed XIAO ESP32S3 — modeled with its 11 usable GPIO (D0-D10), default I2C on D4/D5, and an informational note surfaced whenever D6/D7 are wired: they're hardware UART1 TX/RX by default, but enabling "USB CDC on Boot" frees them as plain GPIO.

Board data for all of the above lives in JSON, keyed by board id/FQBN, so more boards can be added without touching guardrail logic.


Configuration

VariableDefaultDescription
ARDUINO_CLI_PATHarduino-cliPath to arduino-cli binary
ARDUINO_SKETCH_ROOT(none)Restrict sketch paths to this directory

Development

bash
git clone https://github.com/hardware-mcp/arduino-mcp-servercd arduino-mcp-servernpm installnpm run typechecknpm testnpm run buildnpm run dev

Part of HardwareMCP

This server is part of the HardwareMCP ecosystem — a collection of MCP servers that give AI assistants real control over physical hardware.


License

MIT — see LICENSE.

Support

Open an issue

来源:README.md,提交 c020098

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.8最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分