Skip to main content
Glama

arduino-mcp

License Release Node

Local stdio MCP server that wraps arduino-cli so agents can detect boards, manage cores/libraries, compile/upload sketches, and talk serial — without shell gymnastics.

Built as a standalone package (reuse across projects). Designed with Ratchet (a companion robotics project) in mind — Uno + Portenta, 115200 UART — but not coupled to that firmware tree.

Prerequisites

  1. Node.js 20+

  2. Arduino CLI on your machine:

    • Standalone arduino-cli on PATH, or

    • Arduino IDE 2.x (this server auto-detects the IDE-bundled arduino-cli.exe on Windows), or

    • Set ARDUINO_CLI_PATH to the executable

Optional boards for Ratchet:

Board

Core to install

FQBN

Arduino Uno

arduino:avr

arduino:avr:uno

Portenta H7

arduino:mbed_portenta

arduino:mbed_portenta:envie_m7

Portenta note: OpenMV firmware and the Arduino Mbed core overwrite each other. Switching is deliberate — use MCP upload only when you intend to be on the Arduino core.

Related MCP server: Arduino MCP Server (Simple)

Install

cd arduino-mcp
npm install
npm run build

Tools

Tool

Purpose

arduino_cli_version

Health check + resolved CLI path

list_ports / board_list

Detect connected boards / ports

core_list / core_install

List/install platforms

lib_search / lib_install

Library Manager

compile

Build a sketch for an FQBN

upload

Flash a board on a port

serial_open / serial_read / serial_write / serial_close / serial_status

Serial I/O (default baud 115200)

Serial buffers are capped (~64KB). Prefer hex encoding for binary UART frames.

Cursor / Claude Desktop (stdio)

Do not add this to Cursor until you have run a local smoke test and explicitly approve the MCP config (local serial + upload access).

Example Cursor MCP entry (user-level or project .cursor/mcp.json):

{
  "mcpServers": {
    "arduino": {
      "command": "node",
      "args": ["C:/Users/YOU/CursorProjects/arduino-mcp/dist/index.js"],
      "env": {
        "ARDUINO_CLI_PATH": "C:/Users/YOU/Downloads/arduino-cli_1.5.2-rc.1_Windows_64bit/arduino-cli.exe"
      }
    }
  }
}

Omit ARDUINO_CLI_PATH if the IDE-bundled CLI is enough or arduino-cli is on PATH.

Dev without build:

{
  "command": "npx",
  "args": ["tsx", "C:/Users/YOU/CursorProjects/arduino-mcp/src/index.ts"]
}

Smoke test

npm run smoke

With a board plugged in:

$env:SMOKE_UPLOAD_PORT = "COM3"   # your port from board list
npm run smoke

The smoke script compiles examples/Blink for arduino:avr:uno (installs the AVR core if missing). Upload is optional.

  1. arduino_cli_version

  2. core_install → arduino:avr (once)

  3. board_list → note COMx

  4. compile → sketch examples/Blink, fqbn arduino:avr:uno

  5. upload → same sketch/fqbn + port

  6. serial_open → port, baud 115200

  7. serial_read → expect blink-high / blink-low lines

  8. serial_close

Security notes

  • All arduino-cli invocations use spawn with an argv array (no shell interpolation).

  • This server can flash firmware and open serial ports on your machine — treat it as a privileged local tool.

  • Prefer absolute sketch paths from trusted projects.

License

Apache-2.0

Available Tools

17 tools
arduino_cli_versionA

Confirm arduino-cli is available and report its version. Call this first to verify the toolchain before compile/upload.

Inputs: no named parameters.

board_listA

List connected boards with detected FQBN when possible. Alias-friendly companion to list_ports.

Inputs: discoveryTimeout.

compileA

Compile a sketch for a board FQBN without uploading. Use arduino:avr:uno for Uno or arduino:mbed_portenta:envie_m7 for Portenta H7.

Inputs: fqbn (required), sketchPath (required), clean, verbose, +2 more.

core_installA

Install an Arduino core/platform by id. Examples: arduino:avr (Uno), arduino:mbed_portenta (Portenta H7).

Inputs: platformId (required).

core_listA

List installed Arduino cores (platform packages), e.g. arduino:avr or arduino:mbed_portenta.

Inputs: no named parameters.

lib_installB

Install one or more Arduino libraries by name from Library Manager.

Inputs: libraries (required).

list_portsB

List serial ports detected by arduino-cli (USB adapters, Uno, Portenta, etc.).

Inputs: no named parameters.

rattus_crc_self_testA

Verify host-side CRC-8/MAXIM matches firmware RattusUart (expect check vector 0xA1).

Inputs: no named parameters.

rattus_heartbeatC

Send CMD_TWIST heartbeats at ~20 Hz for durationMs (Phase 2.7 soak / link-up). Uses open serial port.

Inputs: vMmS, periodMs, durationMs, omegaMradS.

rattus_send_twistA

Phase 2.7 PC-masquerade: pack a CMD_TWIST frame (CRC-8/MAXIM) and write it to the open serial port (Uno USB). Requires serial_open first.

Inputs: vMmS (required), omegaMradS (required), seq.

serial_closeB

Close the currently open serial port session.

Inputs: no named parameters.

serial_openA

Open a serial port exclusively for read/write. Default baud is 115200 (Ratchet UART). Close any previous session first.

Inputs: path (required), baudRate.

serial_readA

Read buffered bytes from the open serial port. Buffer is capped (~64KB) to protect agent context.

Inputs: encoding, maxBytes.

serial_statusA

Report whether a serial session is open and how many bytes are buffered.

Inputs: no named parameters.

serial_writeA

Write data to the open serial port. Use hex/base64 for binary UART frames (e.g. Ratchet Phase 2.7).

Inputs: data (required), encoding.

uploadA

Upload a sketch to a board on a serial port. Prefer compile first with libraries/buildPath, then pass the same buildPath as inputDir (upload does not accept --libraries).

Inputs: fqbn (required), port (required), sketchPath (required), verify, +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 17 tools

    Disambiguation4/5

    Tools are grouped into clear functional areas (arduino-cli, serial, Ratchet), with distinct purposes. Only board_list and list_ports overlap somewhat, but their descriptions clarify the difference.

    Naming Consistency3/5

    Most tools use snake_case with action-first naming (list_ports, serial_open, core_install), but some are noun-first (board_list, core_list, lib_search) creating minor inconsistency. Prefixes also vary by domain, though the pattern is still readable.

    Tool Count4/5

    17 tools is on the higher end but each serves a distinct purpose across three subdomains (toolchain, serial I/O, Ratchet protocol). The count feels justified for the scope.

    Completeness4/5

    Core workflows are covered: toolchain verification, board/core/library management, compile/upload, serial session lifecycle, and Ratchet-specific helpers. Minor gaps like library uninstall or board details exist but are not critical.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      A comprehensive Model Context Protocol (MCP) server for Arduino CLI interactions, built with FastMCP. This server enables AI agents to seamlessly interact with Arduino CLI for development, debugging, code verification, and more.
      16
      39 PyPI
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for Arduino IDE 2.0 sketches. It exposes a small REST API plus an MCP stdio bridge so agents can read and write the main .ino file, list sources, and optionally compile with arduino-cli.
      61 npm
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      A fully local MCP server for Mixly that lets AI clients discover boards, scan blocks, build/validate/open projects, generate code, and compile via Arduino CLI—all without uploading source or relying on a remote server.
      3
      -