# Arduino Agent Mcp (`syntellect_ai/arduino-agent-mcp`) Actor

**arduino-agent-mcp**platform designed to give AI agents (like Gemini, Claude, etc.) safe, deterministic, and powerful control over Arduino hardware. It acts as a bridge between LLMs and embedded hardware, enabling semantic understanding of boards, libraries, and firmware.

- **URL**: https://apify.com/syntellect_ai/arduino-agent-mcp.md
- **Developed by:** [christopher athans crow](https://apify.com/syntellect_ai) (community)
- **Categories:** AI, Developer tools, Agents
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## arduino-agent-mcp

> **AI-native Arduino development via Model Context Protocol (MCP)**

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![MCP](https://img.shields.io/badge/MCP-Enabled-green)](https://modelcontextprotocol.io/)

**arduino-agent-mcp** is an open-source platform designed to give AI agents (like Gemini, Claude, etc.) safe, deterministic, and powerful control over Arduino hardware. It acts as a bridge between LLMs and embedded hardware, enabling semantic understanding of boards, libraries, and firmware.

Unlike simple CLI wrappers, this project provides a structured state machine for hardware, handling dependency resolution, multi-board orchestration, and safety checks before any code touches silicon.

***

### 🌟 Features

#### 🧠 Core Agentic Capabilities

- **Semantic Board Awareness**: Agents don't guess pins; they query `list_boards` to understand architecture, ports, and capabilities.
- **Safe Library Management**: Automated dependency resolution and installation (`resolve_library`).
- **Structured Compilation**: JSON-based compiler output for AI self-correction.

#### 🛡️ Safety & Reliability

- **Hardware Assertions**: Pre-upload checks (`hardware_check`) for voltage, conflicts, and more.
- **Firmware Rollback**: Automatic snapshots of successful builds allow one-click recovery.
- **Compilation-First**: Code is never uploaded without a clean build.

#### 🚀 Advanced Tooling

- **Multi-Board Orchestration**: Manage fleets of devices (e.g., Sensor Node + Gateway) via `select_board`.
- **Power Profiling**: Static analysis and runtime estimation of power consumption (`estimate_power`).
- **Schematic Generation**: Turn code/intent into Graphviz/Mermaid diagrams (`generate_schematic`).
- **OTA Updates**: Safe Over-The-Air updates for ESP32/WiFi boards (`ota_upload`).

***

### 🏗️ Architecture

The system is a modular **MCP Server** built on Node.js that wraps the **Arduino CLI**.

```mermaid
graph TD
    AI[AI Agent] <-->|MCP Protocol| MCP[Arduino MCP Server]
    MCP <-->|JSON/IPC| CLI[Arduino CLI]
    CLI <-->|Serial/USB| BOARD[Arduino Hardware]
    
    subgraph "MCP Server Logic"
        ORCH[Board Orchestrator]
        SAFE[Safety Checks]
        LIB[Dep Resolver]
        PROF[Power Profiler]
    end
    
    MCP --- ORCH
    MCP --- SAFE
    MCP --- LIB
    MCP --- PROF
```

See [docs/architecture.md](docs/architecture.md) for a deep dive.

### 📦 Project Structure

```
arduino-agent-mcp/
├── packages/
│   ├── mcp-server/          # Main MCP Server (Node.js)
│   ├── cli/                 # (Future) User CLI
│   ├── templates/           # Starter templates (Simple/Advanced)
│   ├── schematics/          # Schematic generation assets
│   └── power-profiles/      # Board power definition models
├── docs/                    # Documentation
└── examples/                # Example usage patterns
```

### 🚀 Getting Started

#### Prerequisites

- Node.js >= 18 LTS
- [Arduino CLI](https://arduino.github.io/arduino-cli/latest/) installed and in your `PATH`.

#### Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/your-org/arduino-agent-mcp.git
   cd arduino-agent-mcp
   ```

2. Install dependencies:
   ```bash
   cd packages/mcp-server
   npm install
   ```

3. Build the server:
   ```bash
   npm run build
   ```

4. Configure your AI Client (e.g., Claude Desktop, Gemini) to use the MCP server.

#### Development

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md).

#### Docker Support

This project is container-ready and follows Apify Actor standards.

1. **Build Container**:
   ```bash
   cd packages/mcp-server
   docker build -t arduino-mcp .
   ```

2. **Run (Stdio Mode)**:
   ```bash
   docker run -i arduino-mcp
   ```

**Note**: When running in Docker/Cloud, physical hardware features (`upload`, `monitor`) are disabled unless you use the **Network Serial Bridge**.

#### 🔌 Network Serial Bridge (Remote Upload)

If running the MCP server in a container or cloud, you can use the `bridge-client` to flash code to your local machine.

1. **Start Bridge (Locally)**:
   ```bash
   cd packages/bridge-client
   npm install
   npm start
   # Bridge listening on port 3000
   ```

2. **Expose Bridge (via ngrok)**:
   ```bash
   ngrok http 3000
   # Copy the URL (e.g. https://xyz.ngrok.io)
   ```

3. **Run MCP Server (Remote)**:
   ```bash
   docker run -e BRIDGE_URL=https://xyz.ngrok.io -i arduino-mcp
   ```

The agent will now automatically route uploads through the bridge.

### 📜 License

This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.

# Actor input Schema

## `mode` (type: `string`):

Operation mode (stdio for MCP, stand-alone for direct tasks)

## `sketch_source` (type: `string`):

Source code for standalone compilation test

## Actor input object example

```json
{
  "mode": "stdio"
}
```

# Actor output Schema

## `compilationResults` (type: `string`):

Dataset containing compilation outputs, errors, and binary artifacts

## `artifacts` (type: `string`):

Key-value store containing compiled .hex files and other build artifacts

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("syntellect_ai/arduino-agent-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("syntellect_ai/arduino-agent-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call syntellect_ai/arduino-agent-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,syntellect_ai/arduino-agent-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/yNhOmSa9W8eg3oq6x/builds/C3k5J2BXnYjw1ZZA8/openapi.json
