arduino-mcp-server 0.2.6 → 0.2.7
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.
- package/README.md +106 -34
- package/build/index.js +12 -18
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
# Arduino MCP Server
|
|
2
2
|
|
|
3
|
-
Arduino MCP server for `arduino-cli` workflows: dependency checks/install, hardware detection, compile/upload, serial monitoring,
|
|
3
|
+
Arduino MCP server for `arduino-cli` workflows: dependency checks/install, hardware detection, compile/upload, serial monitoring, board reference lookup, and safety preflight checks.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
This repository includes:
|
|
6
|
+
- `server.json` for MCP Registry metadata.
|
|
7
|
+
- `manifest.json` for Claude Desktop MCP bundle (`.mcpb`) packaging.
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
Use this server to automate Arduino setup and development tasks from an MCP client while keeping operations local to your machine.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
- Arduino CLI dependency diagnosis and guided installation
|
|
14
|
+
- Board/port detection with FQBN inference
|
|
15
|
+
- Core installation checks and optional auto-install
|
|
16
|
+
- Sketch compile/upload workflows
|
|
17
|
+
- Upload-and-wait serial readiness flow
|
|
18
|
+
- Stateful serial sessions (`open`, `read`, `expect`, `write`, `close`)
|
|
19
|
+
- Electrical safety preflight checks
|
|
20
|
+
- Board reference resource and setup prompts
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
- Node.js 20+
|
|
24
|
+
- `arduino-cli` on `PATH`, or install/configure it through provided tools
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
Install from npm:
|
|
7
28
|
|
|
8
29
|
```bash
|
|
9
30
|
npm install -g arduino-mcp-server
|
|
10
31
|
```
|
|
11
32
|
|
|
12
|
-
Add to
|
|
13
|
-
|
|
14
|
-
Claude Desktop (`claude_desktop_config.json`):
|
|
33
|
+
Add to Claude Desktop (`claude_desktop_config.json`):
|
|
15
34
|
|
|
16
35
|
```json
|
|
17
36
|
{
|
|
@@ -28,38 +47,57 @@ Claude Desktop (`claude_desktop_config.json`):
|
|
|
28
47
|
}
|
|
29
48
|
```
|
|
30
49
|
|
|
31
|
-
|
|
50
|
+
## Configuration
|
|
51
|
+
- `ARDUINO_CLI_PATH`: Arduino CLI command/path (default: `arduino-cli`)
|
|
52
|
+
- `ARDUINO_SKETCH_ROOT`: optional absolute root restricting sketch compile/upload paths
|
|
32
53
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"env": {
|
|
40
|
-
"ARDUINO_CLI_PATH": "arduino-cli",
|
|
41
|
-
"ARDUINO_SKETCH_ROOT": "D:/Projects/arduino-sketches"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
54
|
+
## Usage Examples
|
|
55
|
+
Example 1: Bootstrap missing Arduino CLI
|
|
56
|
+
|
|
57
|
+
User prompt:
|
|
58
|
+
```text
|
|
59
|
+
Check if Arduino CLI is installed and install it automatically if missing.
|
|
46
60
|
```
|
|
47
61
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
62
|
+
Expected tool sequence:
|
|
63
|
+
1. `arduino_cli_doctor`
|
|
64
|
+
2. `install_arduino_cli` (when missing)
|
|
65
|
+
3. `arduino_cli_doctor` (re-check)
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
- Node.js 20+
|
|
58
|
-
- `arduino-cli` available on `PATH` (or let the server install it via tools)
|
|
67
|
+
Example 2: Compile and upload a sketch
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
69
|
+
User prompt:
|
|
70
|
+
```text
|
|
71
|
+
Compile D:/Projects/arduino-sketches/Blink for arduino:avr:uno and upload it to COM6.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Expected tool sequence:
|
|
75
|
+
1. `compile_sketch` with sketch path + fqbn
|
|
76
|
+
2. `upload_sketch` with sketch path + fqbn + port
|
|
77
|
+
|
|
78
|
+
Example 3: Open serial monitor session and wait for ready text
|
|
79
|
+
|
|
80
|
+
User prompt:
|
|
81
|
+
```text
|
|
82
|
+
Open serial on COM6 at 115200 and wait until the device prints READY.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Expected tool sequence:
|
|
86
|
+
1. `serial_open_session`
|
|
87
|
+
2. `serial_expect`
|
|
88
|
+
3. `serial_read` (optional for additional output)
|
|
89
|
+
4. `serial_close_session` (when done)
|
|
90
|
+
|
|
91
|
+
Example 4: Safety preflight before writing to device
|
|
92
|
+
|
|
93
|
+
User prompt:
|
|
94
|
+
```text
|
|
95
|
+
Before sending commands over serial, run a safety preflight for an Arduino Uno with my wiring details.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Expected tool sequence:
|
|
99
|
+
1. `safety_preflight`
|
|
100
|
+
2. `serial_write` only if preflight does not block
|
|
63
101
|
|
|
64
102
|
## MCP Surface
|
|
65
103
|
Tools:
|
|
@@ -69,7 +107,15 @@ Tools:
|
|
|
69
107
|
- `ensure_core_installed`
|
|
70
108
|
- `compile_sketch`
|
|
71
109
|
- `upload_sketch`
|
|
110
|
+
- `upload_and_wait_ready`
|
|
72
111
|
- `read_serial_snapshot`
|
|
112
|
+
- `safety_preflight`
|
|
113
|
+
- `serial_open_session`
|
|
114
|
+
- `serial_list_sessions`
|
|
115
|
+
- `serial_read`
|
|
116
|
+
- `serial_expect`
|
|
117
|
+
- `serial_write`
|
|
118
|
+
- `serial_close_session`
|
|
73
119
|
- `list_connected_boards`
|
|
74
120
|
- `list_supported_boards`
|
|
75
121
|
- `list_serial_ports`
|
|
@@ -84,6 +130,32 @@ Prompts:
|
|
|
84
130
|
- `arduino-cli-bootstrap-policy`
|
|
85
131
|
- `arduino-setup-assistant`
|
|
86
132
|
|
|
133
|
+
## MCP Bundle (MCPB)
|
|
134
|
+
Build and package:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm run build
|
|
138
|
+
npm run mcpb:validate
|
|
139
|
+
npm run mcpb:pack
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Notes:
|
|
143
|
+
- `manifest.json` is consumed by `mcpb`.
|
|
144
|
+
- `.mcpbignore` excludes dev/reference files from bundle packaging.
|
|
145
|
+
- Bundle output is written as `<name>.mcpb` in the current directory by default.
|
|
146
|
+
|
|
147
|
+
## Privacy Policy
|
|
148
|
+
- Policy URL: https://github.com/akshatnerella/arduino-mcp-server/blob/main/PRIVACY.md
|
|
149
|
+
- Local copy: [PRIVACY.md](PRIVACY.md)
|
|
150
|
+
|
|
151
|
+
Summary:
|
|
152
|
+
- No built-in telemetry or analytics.
|
|
153
|
+
- Operations are local unless you explicitly invoke tooling that downloads dependencies.
|
|
154
|
+
- Data handling by your MCP host application is governed by that host's policies.
|
|
155
|
+
|
|
156
|
+
## Support
|
|
157
|
+
- GitHub Issues: https://github.com/akshatnerella/arduino-mcp-server/issues
|
|
158
|
+
|
|
87
159
|
## Development
|
|
88
160
|
```bash
|
|
89
161
|
git clone https://github.com/akshatnerella/arduino-mcp-server
|
|
@@ -99,4 +171,4 @@ npm run dev
|
|
|
99
171
|
- PRs must include exactly one bump label: `patch`, `minor`, or `major`.
|
|
100
172
|
|
|
101
173
|
## License
|
|
102
|
-
MIT, see [LICENSE](LICENSE).
|
|
174
|
+
MIT, see [LICENSE](LICENSE).
|
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:
|
|
14
|
-
sketchRoot:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Arduino CLI wrapper MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -20,7 +20,9 @@
|
|
|
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",
|