arduino-mcp-server 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +100 -63
  2. package/build/index.js +12 -18
  3. package/package.json +8 -6
package/README.md CHANGED
@@ -1,18 +1,37 @@
1
- # Arduino MCP Server
1
+ # arduino-mcp-server
2
2
 
3
- Arduino MCP server for `arduino-cli` workflows: dependency checks/install, hardware detection, compile/upload, serial monitoring, and board reference lookup.
3
+ [![npm version](https://img.shields.io/npm/v/arduino-mcp-server)](https://www.npmjs.com/package/arduino-mcp-server)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
+ [![Node.js 20+](https://img.shields.io/badge/node-%3E%3D20-brightgreen)](https://nodejs.org)
6
+
7
+ **Give your AI assistant full control over Arduino — compile, upload, monitor serial, and verify wiring safety, all through natural language.**
8
+
9
+ Part of the [HardwareMCP](https://github.com/hardware-mcp) ecosystem — open-source MCP servers that bridge AI to physical hardware.
10
+
11
+ ---
12
+
13
+ ## What this does
14
+
15
+ AI assistants can control Jira, GitHub, and databases. They can't talk to a microcontroller — until now.
16
+
17
+ `arduino-mcp-server` wraps `arduino-cli` into an MCP server so your AI can:
18
+
19
+ - **Detect** connected boards and ports automatically
20
+ - **Compile and upload** sketches without touching the terminal
21
+ - **Monitor serial output** with stateful sessions (open, read, expect, write, close)
22
+ - **Run electrical safety checks** before sending commands to hardware
23
+ - **Manage dependencies** — cores, libraries, and CLI installation
24
+
25
+ ---
4
26
 
5
27
  ## Quick Start
6
- Install globally:
7
28
 
29
+ **Install:**
8
30
  ```bash
9
31
  npm install -g arduino-mcp-server
10
32
  ```
11
33
 
12
- Add to your AI agent MCP config.
13
-
14
- Claude Desktop (`claude_desktop_config.json`):
15
-
34
+ **Add to Claude Desktop** (`claude_desktop_config.json`):
16
35
  ```json
17
36
  {
18
37
  "mcpServers": {
@@ -21,72 +40,81 @@ Claude Desktop (`claude_desktop_config.json`):
21
40
  "args": ["-y", "arduino-mcp-server"],
22
41
  "env": {
23
42
  "ARDUINO_CLI_PATH": "arduino-cli",
24
- "ARDUINO_SKETCH_ROOT": "D:/Projects/arduino-sketches"
43
+ "ARDUINO_SKETCH_ROOT": "/path/to/your/sketches"
25
44
  }
26
45
  }
27
46
  }
28
47
  }
29
48
  ```
30
49
 
31
- Codex MCP config:
50
+ Requires [arduino-cli](https://arduino.github.io/arduino-cli/) on your PATH, or let the server install it for you.
32
51
 
33
- ```json
34
- {
35
- "mcpServers": {
36
- "arduino": {
37
- "command": "npx",
38
- "args": ["-y", "arduino-mcp-server"],
39
- "env": {
40
- "ARDUINO_CLI_PATH": "arduino-cli",
41
- "ARDUINO_SKETCH_ROOT": "D:/Projects/arduino-sketches"
42
- }
43
- }
44
- }
45
- }
46
- ```
52
+ ---
53
+
54
+ ## What you can say
55
+
56
+ **Bootstrap from scratch:**
57
+ > "Check if Arduino CLI is installed and set everything up for an Arduino Uno."
58
+
59
+ **Compile and upload:**
60
+ > "Compile my Blink sketch and upload it to the Uno on COM6."
61
+
62
+ **Serial monitoring:**
63
+ > "Open serial on COM6 at 115200 and wait until the device prints READY."
64
+
65
+ **Safety-first workflows:**
66
+ > "Run a safety preflight for an Arduino Uno with 5V on pin 13 at 25mA before I send commands."
67
+
68
+ ---
69
+
70
+ ## Tools
71
+
72
+ | Tool | What it does |
73
+ |------|-------------|
74
+ | `arduino_cli_doctor` | Check Arduino CLI installation and version |
75
+ | `install_arduino_cli` | Guide through arduino-cli installation |
76
+ | `detect_hardware` | Detect connected boards and infer FQBNs |
77
+ | `list_connected_boards` | List all connected Arduino boards |
78
+ | `list_serial_ports` | List available serial ports |
79
+ | `ensure_core_installed` | Check/install board cores |
80
+ | `compile_sketch` | Compile a sketch for a target board |
81
+ | `upload_sketch` | Upload compiled sketch to a board |
82
+ | `upload_and_wait_ready` | Upload and wait for device ready signal |
83
+ | `serial_open_session` | Open a stateful serial session |
84
+ | `serial_read` | Read buffered serial data |
85
+ | `serial_expect` | Wait for a pattern in serial output |
86
+ | `serial_write` | Send data over serial |
87
+ | `serial_close_session` | Close a serial session |
88
+ | `serial_list_sessions` | List active serial sessions |
89
+ | `read_serial_snapshot` | Quick one-shot serial read |
90
+ | `safety_preflight` | Electrical safety check before hardware ops |
91
+ | `get_board_details` | Get pin/capability details for a board |
92
+ | `list_supported_boards` | List all boards arduino-cli supports |
93
+ | `list_board_reference` | Browse board pin reference |
94
+ | `search_board_reference` | Search board reference by keyword |
47
95
 
48
- ## Features
49
- - `arduino_cli_doctor` and `install_arduino_cli` for dependency bootstrap
50
- - `detect_hardware` with board/FQBN inference and user-confirmation guidance
51
- - `ensure_core_installed` with automatic core setup from FQBN
52
- - `compile_sketch` and `upload_sketch` with optional auto core install
53
- - Serial monitoring and board/port listing tools
54
- - Local board reference resource and setup prompts
96
+ **Resources:**
97
+ - `arduino://boards/reference` structured board pin/capability reference
55
98
 
56
- ## Requirements
57
- - Node.js 20+
58
- - `arduino-cli` available on `PATH` (or let the server install it via tools)
99
+ **Prompts:**
100
+ - `arduino-cli-bootstrap-policy` — policy for arduino-cli setup behavior
101
+ - `arduino-setup-assistant` guided Arduino environment setup
102
+
103
+ ---
59
104
 
60
105
  ## Configuration
61
- - `ARDUINO_CLI_PATH`: Arduino CLI command/path (default: `arduino-cli`)
62
- - `ARDUINO_SKETCH_ROOT`: optional absolute root for sketch operations
63
-
64
- ## MCP Surface
65
- Tools:
66
- - `arduino_cli_doctor`
67
- - `install_arduino_cli`
68
- - `detect_hardware`
69
- - `ensure_core_installed`
70
- - `compile_sketch`
71
- - `upload_sketch`
72
- - `read_serial_snapshot`
73
- - `list_connected_boards`
74
- - `list_supported_boards`
75
- - `list_serial_ports`
76
- - `get_board_details`
77
- - `list_board_reference`
78
- - `search_board_reference`
79
-
80
- Resources:
81
- - `arduino://boards/reference`
82
-
83
- Prompts:
84
- - `arduino-cli-bootstrap-policy`
85
- - `arduino-setup-assistant`
106
+
107
+ | Variable | Default | Description |
108
+ |----------|---------|-------------|
109
+ | `ARDUINO_CLI_PATH` | `arduino-cli` | Path to arduino-cli binary |
110
+ | `ARDUINO_SKETCH_ROOT` | *(none)* | Restrict sketch paths to this directory |
111
+
112
+ ---
86
113
 
87
114
  ## Development
115
+
88
116
  ```bash
89
- git clone https://github.com/akshatnerella/arduino-mcp-server
117
+ git clone https://github.com/hardware-mcp/arduino-mcp-server
90
118
  cd arduino-mcp-server
91
119
  npm install
92
120
  npm run typecheck
@@ -94,9 +122,18 @@ npm run build
94
122
  npm run dev
95
123
  ```
96
124
 
97
- ## Release
98
- - PRs into `main` must come from `release/*` branches.
99
- - PRs must include exactly one bump label: `patch`, `minor`, or `major`.
125
+ ---
126
+
127
+ ## Part of HardwareMCP
128
+
129
+ This server is part of the [HardwareMCP](https://github.com/hardware-mcp) ecosystem — a collection of MCP servers that give AI assistants real control over physical hardware.
130
+
131
+ ---
100
132
 
101
133
  ## License
102
- MIT, see [LICENSE](LICENSE).
134
+
135
+ MIT — see [LICENSE](LICENSE).
136
+
137
+ ## Support
138
+
139
+ [Open an issue](https://github.com/hardware-mcp/arduino-mcp-server/issues)
package/build/index.js CHANGED
@@ -9,9 +9,11 @@ import { resolveSketchPath, runArduinoCli, runCommand, tryParseJson } from "./ar
9
9
  import { PortOperationCoordinator } from "./portCoordinator.js";
10
10
  import { SerialSessionManager } from "./serialSessions.js";
11
11
  import { runSafetyPreflight } from "./safety.js";
12
+ const cliPathFromEnv = process.env.ARDUINO_CLI_PATH?.trim();
13
+ const sketchRootFromEnv = process.env.ARDUINO_SKETCH_ROOT?.trim();
12
14
  const arduinoConfig = {
13
- cliPath: process.env.ARDUINO_CLI_PATH ?? "arduino-cli",
14
- sketchRoot: process.env.ARDUINO_SKETCH_ROOT
15
+ cliPath: cliPathFromEnv && cliPathFromEnv.length > 0 ? cliPathFromEnv : "arduino-cli",
16
+ sketchRoot: sketchRootFromEnv && sketchRootFromEnv.length > 0 ? sketchRootFromEnv : undefined
15
17
  };
16
18
  const portCoordinator = new PortOperationCoordinator();
17
19
  const serialSessionManager = new SerialSessionManager(portCoordinator);
@@ -679,8 +681,7 @@ server.registerTool("install_arduino_cli", {
679
681
  },
680
682
  outputSchema: toolOutputShape,
681
683
  annotations: {
682
- readOnlyHint: false,
683
- destructiveHint: false,
684
+ destructiveHint: true,
684
685
  idempotentHint: true,
685
686
  openWorldHint: true
686
687
  }
@@ -820,8 +821,7 @@ server.registerTool("ensure_core_installed", {
820
821
  },
821
822
  outputSchema: toolOutputShape,
822
823
  annotations: {
823
- readOnlyHint: false,
824
- destructiveHint: false,
824
+ destructiveHint: true,
825
825
  idempotentHint: true,
826
826
  openWorldHint: false
827
827
  }
@@ -1062,8 +1062,7 @@ server.registerTool("compile_sketch", {
1062
1062
  },
1063
1063
  outputSchema: toolOutputShape,
1064
1064
  annotations: {
1065
- readOnlyHint: false,
1066
- destructiveHint: false,
1065
+ destructiveHint: true,
1067
1066
  idempotentHint: true,
1068
1067
  openWorldHint: false
1069
1068
  }
@@ -1174,8 +1173,7 @@ server.registerTool("upload_sketch", {
1174
1173
  },
1175
1174
  outputSchema: toolOutputShape,
1176
1175
  annotations: {
1177
- readOnlyHint: false,
1178
- destructiveHint: false,
1176
+ destructiveHint: true,
1179
1177
  idempotentHint: true,
1180
1178
  openWorldHint: false
1181
1179
  }
@@ -1357,8 +1355,7 @@ server.registerTool("upload_and_wait_ready", {
1357
1355
  },
1358
1356
  outputSchema: toolOutputShape,
1359
1357
  annotations: {
1360
- readOnlyHint: false,
1361
- destructiveHint: false,
1358
+ destructiveHint: true,
1362
1359
  idempotentHint: false,
1363
1360
  openWorldHint: false
1364
1361
  }
@@ -1629,8 +1626,7 @@ server.registerTool("serial_open_session", {
1629
1626
  },
1630
1627
  outputSchema: toolOutputShape,
1631
1628
  annotations: {
1632
- readOnlyHint: false,
1633
- destructiveHint: false,
1629
+ destructiveHint: true,
1634
1630
  idempotentHint: false,
1635
1631
  openWorldHint: false
1636
1632
  }
@@ -1812,8 +1808,7 @@ server.registerTool("serial_write", {
1812
1808
  },
1813
1809
  outputSchema: toolOutputShape,
1814
1810
  annotations: {
1815
- readOnlyHint: false,
1816
- destructiveHint: false,
1811
+ destructiveHint: true,
1817
1812
  idempotentHint: false,
1818
1813
  openWorldHint: false
1819
1814
  }
@@ -1919,8 +1914,7 @@ server.registerTool("serial_close_session", {
1919
1914
  },
1920
1915
  outputSchema: toolOutputShape,
1921
1916
  annotations: {
1922
- readOnlyHint: false,
1923
- destructiveHint: false,
1917
+ destructiveHint: true,
1924
1918
  idempotentHint: true,
1925
1919
  openWorldHint: false
1926
1920
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arduino-mcp-server",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Arduino CLI wrapper MCP server",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -20,22 +20,24 @@
20
20
  "build": "tsc -p tsconfig.json",
21
21
  "dev": "tsx src/index.ts",
22
22
  "start": "node build/index.js",
23
- "typecheck": "tsc -p tsconfig.json --noEmit"
23
+ "typecheck": "tsc -p tsconfig.json --noEmit",
24
+ "mcpb:validate": "npx @anthropic-ai/mcpb validate .",
25
+ "mcpb:pack": "npx @anthropic-ai/mcpb pack ."
24
26
  },
25
27
  "keywords": [
26
28
  "mcp",
27
29
  "arduino",
28
30
  "arduino-cli"
29
31
  ],
30
- "mcpName": "io.github.akshatnerella/arduino-mcp-server",
32
+ "mcpName": "io.github.hardware-mcp/arduino-mcp-server",
31
33
  "repository": {
32
34
  "type": "git",
33
- "url": "git+https://github.com/akshatnerella/arduino-mcp-server.git"
35
+ "url": "git+https://github.com/hardware-mcp/arduino-mcp-server.git"
34
36
  },
35
37
  "bugs": {
36
- "url": "https://github.com/akshatnerella/arduino-mcp-server/issues"
38
+ "url": "https://github.com/hardware-mcp/arduino-mcp-server/issues"
37
39
  },
38
- "homepage": "https://github.com/akshatnerella/arduino-mcp-server#readme",
40
+ "homepage": "https://github.com/hardware-mcp/arduino-mcp-server#readme",
39
41
  "license": "MIT",
40
42
  "dependencies": {
41
43
  "@modelcontextprotocol/sdk": "^1.17.4",