Skip to main content
Glama

arduino-mcp-server

npm version License: MIT Node.js 20+

让你的 AI 助手完全掌控 Arduino — 编译、上传、监控串口、验证接线安全,全部通过自然语言完成。

属于 HardwareMCP 生态系统的一部分 — 连接 AI 与实体硬件的开源 MCP 服务器。


功能简介

AI 助手可以控制 Jira、GitHub 和数据库,但无法与微控制器对话 — 直到现在。

arduino-mcp-server 将 arduino-cli 封装为 MCP 服务器,让你的 AI 能够:

  • 自动检测已连接的开发板和端口

  • 编译并上传草图,无需接触终端

  • 监控串口输出,支持有状态会话(打开、读取、等待、写入、关闭)

  • 执行电气安全检查,在向硬件发送命令之前

  • 管理依赖 — 核心、库和 CLI 安装


Related MCP server: Arduino MCP Server (Simple)

快速开始

安装:

npm install -g arduino-mcp-server

添加到 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"
      }
    }
  }
}

需要 arduino-cli 位于你的 PATH 中,或者让服务器为你安装。


你可以这样说

从零开始引导:

"检查 Arduino CLI 是否已安装,并为 Arduino Uno 完成所有设置。"

编译并上传:

"编译我的 Blink 草图并上传到 COM6 上的 Uno。"

串口监控:

"在 COM6 上以 115200 打开串口,等待设备打印 READY。"

安全优先的工作流:

"在我发送命令之前,对 Arduino Uno 执行安全预检,引脚 13 上为 5V、25mA。"


工具

工具

功能说明

arduino_cli_doctor

检查 Arduino CLI 安装和版本

install_arduino_cli

引导完成 arduino-cli 安装

detect_hardware

检测已连接的开发板并推断 FQBN

list_connected_boards

列出所有已连接的 Arduino 开发板

list_serial_ports

列出可用的串口

ensure_core_installed

检查/安装开发板核心

compile_sketch

为目标开发板编译草图

upload_sketch

将编译后的草图上传到开发板

upload_and_wait_ready

上传并等待设备就绪信号

serial_open_session

打开有状态串口会话

serial_read

读取缓冲的串口数据

serial_expect

等待串口输出中出现指定模式

serial_write

通过串口发送数据

serial_close_session

关闭串口会话

serial_list_sessions

列出活动的串口会话

read_serial_snapshot

快速一次性串口读取

safety_preflight

硬件操作前的电气安全检查

get_board_details

获取开发板的引脚/能力详情

list_supported_boards

列出 arduino-cli 支持的所有开发板

list_board_reference

浏览开发板引脚参考

search_board_reference

按关键词搜索开发板参考

资源:

  • arduino://boards/reference — 结构化的开发板引脚/能力参考

提示词:

  • arduino-cli-bootstrap-policy — arduino-cli 设置行为的策略

  • arduino-setup-assistant — 引导式 Arduino 环境设置


配置

变量

默认值

说明

ARDUINO_CLI_PATH

arduino-cli

arduino-cli 可执行文件的路径

ARDUINO_SKETCH_ROOT

(无)

将草图路径限制在此目录内


开发

git clone https://github.com/hardware-mcp/arduino-mcp-server
cd arduino-mcp-server
npm install
npm run typecheck
npm run build
npm run dev

属于 HardwareMCP

此服务器是 HardwareMCP 生态系统的一部分 — 一系列让 AI 助手真正控制实体硬件的 MCP 服务器。


许可证

MIT — 参见 LICENSE。

支持

提交问题

Available Tools

21 tools
arduino_cli_doctorArduino CLI DoctorA
Read-only

Check whether arduino-cli is available and return OS-specific installation instructions if missing.

Inputs: no named parameters. Returns: ok, raw, data, note, +9 more

compile_sketchCompile SketchA
DestructiveIdempotent

Compile an Arduino sketch with a specific board FQBN.

Inputs: fqbn (required), sketchPath (required), clean, warnings, +3 more. Returns: ok, raw, data, note, +9 more

detect_hardwareDetect HardwareB
Read-only

Detect connected Arduino-compatible hardware, infer board/FQBN candidates, and generate next compile/upload commands.

Inputs: port, includeBoardDetails. Returns: ok, raw, data, note, +9 more

ensure_core_installedEnsure Core InstalledA
DestructiveIdempotent

Ensure the Arduino core required by a board FQBN is installed. Can auto-install via arduino-cli core install.

Inputs: fqbn, coreId, autoInstall. Returns: ok, raw, data, note, +9 more

get_board_detailsGet Board DetailsA
Read-only

Get detailed board metadata from arduino-cli for a specific FQBN.

Inputs: fqbn (required). Returns: ok, raw, data, note, +9 more

install_arduino_cliInstall Arduino CLIA
DestructiveIdempotent

Attempt to install arduino-cli for the current OS using available package managers, then verify and configure CLI path.

Inputs: method, setCliPathInProcess. Returns: ok, raw, data, note, +9 more

list_board_referenceList Board ReferenceA
Read-only

List local board reference entries with pin/spec metadata.

Inputs: no named parameters. Returns: ok, raw, data, note, +9 more

list_connected_boardsList Connected BoardsA
Read-only

List connected boards and serial ports detected by arduino-cli.

Inputs: no named parameters. Returns: ok, raw, data, note, +9 more

list_serial_portsList Serial PortsA
Read-only

List serial ports and any detected board metadata using arduino-cli. Works on Windows/macOS/Linux.

Inputs: no named parameters. Returns: ok, raw, data, note, +9 more

list_supported_boardsList Supported BoardsA
Read-only

List supported/installable boards from the local arduino-cli index.

Inputs: search. Returns: ok, raw, data, note, +9 more

read_serial_snapshotRead Serial SnapshotB
Read-only

Capture serial output for a bounded duration from a given port.

Inputs: port (required), baudRate, durationMs. Returns: ok, raw, data, note, +9 more

safety_preflightSafety PreflightA
Read-only

Run electrical preflight checks (voltage/current/pin risks) before upload or serial write operations.

Inputs: fqbn, port, board, power, +1 more. Returns: ok, raw, data, note, +9 more

search_board_referenceSearch Board ReferenceA
Read-only

Search local board reference by board name, alias, id, or FQBN.

Inputs: query (required). Returns: ok, raw, data, note, +9 more

serial_close_sessionSerial Close SessionA
DestructiveIdempotent

Close a serial session and release its port lock.

Inputs: sessionId (required). Returns: ok, raw, data, note, +9 more

serial_expectSerial ExpectA
Read-only

Wait for a string pattern in a serial session buffer with timeout.

Inputs: pattern (required), sessionId (required), timeoutMs, fromOffset, +1 more. Returns: ok, raw, data, note, +9 more

serial_list_sessionsSerial List SessionsA
Read-only

List active serial sessions and current port lock state.

Inputs: no named parameters. Returns: ok, raw, data, note, +9 more

serial_open_sessionSerial Open SessionA
Destructive

Open a stateful serial monitor session with port lock ownership.

Inputs: port (required), ttlMs, baudRate, maxBufferBytes. Returns: ok, raw, data, note, +9 more

serial_readSerial ReadA
Read-only

Read buffered bytes from an open serial session.

Inputs: sessionId (required), encoding, maxBytes, fromOffset. Returns: ok, raw, data, note, +9 more

serial_writeSerial WriteA
Destructive

Write bytes to an open serial session. Safety preflight is enforced unless explicitly skipped.

Inputs: data (required), sessionId (required), encoding, lineEnding, +2 more. Returns: ok, raw, data, note, +9 more

upload_and_wait_readyUpload And Wait ReadyA
Destructive

Upload a sketch and wait for a serial readiness pattern, handling post-upload reset/re-enumeration windows.

Inputs: port (required), sketchPath (required), fqbn, verify, +7 more. Returns: ok, raw, data, note, +9 more

upload_sketchUpload SketchB
DestructiveIdempotent

Upload a compiled sketch to a connected board/port.

Inputs: port (required), sketchPath (required), fqbn, verify, +3 more. Returns: ok, raw, data, note, +9 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 21 tools

    Disambiguation3/5

    Several tools cluster around board/port discovery (list_connected_boards, list_serial_ports, detect_hardware) and serial reading (serial_read, read_serial_snapshot), so an agent could select the wrong one without careful description reading. Most other tools have clear resource-action targets, but these near-duplicates lower the boundary clarity.

    Naming Consistency4/5

    Names are consistently snake_case and mostly verb_noun (list_*, install_*, compile_*, upload_*). The serial_* prefix group is internally consistent, but read_serial_snapshot and upload_and_wait_ready deviate from the dominant pattern.

    Tool Count3/5

    At 21 tools the server sits in the heavy 16-25 band, but the broad scope of Arduino CLI management, board detection, compile/upload, and serial sessions gives most tools a purpose. It is slightly over the ideal compact size but not excessive.

    Completeness4/5

    The workflow from CLI setup, board detection, core installation, compile, upload, and serial interaction is well covered, including safety preflight. Notable gaps are library management (search/install) and core uninstall/removal, but agents can complete core Arduino tasks without them.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Arduino development through arduino-cli, allowing sketch management, code compilation and uploading, library and board operations, serial monitoring, and AI-powered circuit diagram generation using WireViz.
      23 PyPI
      10
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      A local stdio MCP server wrapping arduino-cli to let agents detect boards, manage cores/libraries, compile and upload sketches, and communicate over serial, enabling hardware control without shell gymnastics.
      17
      -