Skip to main content

FastMCP-powered Arduino CLI server with WireViz integration for circuit diagrams

Project description

๐Ÿš€ MCP Arduino Server

Talk to Your Arduino. Build Projects Faster. Debug with AI.

License: MIT PyPI version Python 3.10+ Tools: 70+

The Arduino development server that speaks your language.


๐ŸŽฏ What This Does

This MCP server lets you develop Arduino projects through natural conversation with Claude. Instead of clicking through menus and searching for commands, just describe what you want to build.

๐Ÿš€ Quick Start

# Install and run
uvx mcp-arduino

# Add to Claude Desktop
claude mcp add arduino uvx mcp-arduino

That's it. Now you can talk to your Arduino.

๐Ÿ’ฌ How You'll Actually Use This

Starting a New Project

You: "I want to blink an LED but with a breathing effect instead of harsh on/off"

Claude: I'll create a breathing LED effect using PWM. Let me set that up for you.

        โ†’ arduino_create_sketch with sketch_name="BreathingLED"
        โ†’ arduino_write_sketch with PWM fade code
        โ†’ arduino_compile_sketch
        โ†’ arduino_list_boards
        โœ“ Found Arduino Uno on /dev/ttyUSB0
        โ†’ arduino_upload_sketch

        Done! Your LED will now fade in and out smoothly.
        The effect uses PWM on pin 9 with a sine wave pattern.

You: "Can you make it respond to ambient light?"

Claude: I'll add a light sensor to make it adaptive.
        โ†’ arduino_write_sketch with photoresistor code added
        โ†’ arduino_compile_sketch
        โ†’ arduino_upload_sketch

        โœ“ Now it breathes faster in darkness, slower in bright light
        โœ“ Connect photoresistor to A0 with a 10k pulldown

Prototyping an IoT Sensor

You: "I have a BME280 sensor and want to log temperature to an SD card every 5 minutes"

Claude: I'll set up data logging with timestamps. Let me configure that.

        Checking what you'll need...
        โ†’ arduino_lib_deps with library_name="Adafruit_BME280"
        โœ“ Needs: Adafruit_Sensor, Adafruit_BusIO, SPI, Wire

        Installing everything...
        โ†’ arduino_lib_install_missing
        โ†’ arduino_install_library with library_name="SD"

        Creating the data logger...
        โ†’ arduino_sketch_new with template="sensor"
        โ†’ arduino_write_sketch with BME280 + SD card logging code

        โ†’ arduino_compile_sketch
        โœ“ Compiled successfully
        โ†’ arduino_upload_sketch

        Your data logger is running! File: TEMP_LOG.CSV
        Format: timestamp, temp_C, humidity_%, pressure_hPa

You: "Show me what it's logging"

Claude: โ†’ serial_connect with port="/dev/ttyUSB0"
        โ†’ serial_read

        [12:34:56] Writing: 2024-01-15 12:34:56, 22.3, 45, 1013
        [12:35:01] SD Card: 847 records saved
        [12:35:01] Free space: 14.2 GB

Debugging Weird Behavior

You: "My servo keeps jittering and I don't know why"

Claude: Let's debug this systematically. I'll help you find the issue.

        First, let's monitor what's happening...
        โ†’ serial_connect
        โ†’ serial_read

        I see the servo position jumping between 89ยฐ and 91ยฐ.
        Let's check your power supply...

        โ†’ arduino_debug_start with your sketch
        โ†’ arduino_debug_break at servo.write()
        โ†’ arduino_debug_watch with expression="analogRead(A0)"

        Found it! Your potentiometer reading is noisy.
        The analog value fluctuates ยฑ3 even when not moving.

        Here's the fix - adding hysteresis:
        โ†’ arduino_write_sketch with deadband code
        โ†’ arduino_upload_sketch

        โœ“ Servo now stays steady until you move the pot ยฑ5 units
        โœ“ No more jittering!

Building Something Fun

You: "I want to make a plant moisture monitor that texts me"

Claude: Cool project! I'll set up a WiFi-enabled moisture monitor.

        โ†’ arduino_sketch_new with sketch_name="PlantBuddy", template="wifi"

        Installing what we need...
        โ†’ arduino_install_library "WiFiManager"  // Easy WiFi setup
        โ†’ arduino_install_library "ThingSpeak"   // Free IoT platform

        โ†’ arduino_write_sketch with moisture sensor + WiFi code

        Here's what I built:
        - Reads moisture every 30 minutes
        - Connects to your WiFi (captive portal for setup)
        - Sends data to ThingSpeak
        - ThingSpeak can trigger IFTTT โ†’ SMS when dry

        โ†’ arduino_upload_sketch
        โ†’ serial_monitor

        โœ“ WiFi AP: "PlantBuddy-Setup"
        โœ“ Connect and enter your WiFi credentials
        โœ“ Then view data at: thingspeak.com/channels/YOUR_CHANNEL

You: "Can we add a little OLED display?"

Claude: โ†’ arduino_install_library "U8g2"  // Universal display library
        โ†’ arduino_write_sketch with display code added

        โœ“ Display shows: moisture %, WiFi status, last watering
        โœ“ Cute plant emoji changes based on moisture level ๐ŸŒฑ๐Ÿ’ง

Working with Existing Code

You: "I found this Arduino code online but it won't compile"
[pastes code with errors]

Claude: I see the issues. Let me fix them.

        โ†’ arduino_create_sketch "FixedCode"
        โ†’ arduino_write_sketch with your code
        โ†’ arduino_compile_sketch

        Error: 'dht' was not declared

        Missing library. Installing...
        โ†’ arduino_install_library "DHT sensor library"

        โ†’ arduino_compile_sketch
        Error: 'POSITIVE' was not declared

        That's from the old LiquidCrystal library.
        โ†’ arduino_write_sketch with LCD library fix

        โ†’ arduino_compile_sketch
        โœ“ Success! The code had 3 issues:
        1. Missing DHT library
        2. Old LCD library syntax
        3. Incorrect pin mode for analog input

        All fixed and ready to upload!

Exploring and Learning

You: "What can I build with just LEDs and resistors?"

Claude: Let me show you some fun LED projects you can build right now!

        1. **Knight Rider Scanner**
        โ†’ arduino_create_sketch "KnightRider"
        โ†’ arduino_write_sketch with 6-LED scanner effect
        โœ“ Creates that classic back-and-forth sweep

        2. **Binary Counter**
        โ†’ arduino_create_sketch "BinaryCounter"
        โ†’ arduino_write_sketch with 4-bit binary display
        โœ“ Counts 0-15 in binary on 4 LEDs

        3. **Morse Code Sender**
        โ†’ arduino_create_sketch "MorseCode"
        โ†’ arduino_write_sketch with text-to-morse converter
        โœ“ Type messages in serial monitor, see them in Morse!

        4. **LED Dice**
        โ†’ arduino_create_sketch "LEDDice"
        โ†’ arduino_write_sketch with 7-LED dice pattern
        โœ“ Press button to "roll" - shows dice dots

        Want to try any of these? I can upload one now!

๐Ÿ› ๏ธ Key Features for Your Workflow

๐Ÿ”„ Never Lose Serial Data

Our circular buffer means you can leave projects running for days without memory crashes:

You: "Show me the overnight temperature log"
Claude: โ†’ serial_read with cursor navigation
        โœ“ Showing last 1000 of 28,847 readings
        โœ“ Memory usage: still just 10MB (fixed size)

๐Ÿ†• Smart Port Conflict Detection

No more mysterious "device busy" errors - know exactly what's using your ports:

You: "Connect to my Arduino"
Claude: โ†’ serial_check_port /dev/ttyUSB0
        โŒ Port conflict detected!

        ๐Ÿ”ง Arduino IDE (PID 12345) is using this port
        ๐Ÿ’ก Solution: Close Arduino IDE Serial Monitor
        ๐Ÿ’ก Or use: kill 12345

        โ†’ serial_connect with automatic conflict prevention
        โœ“ Connected successfully after conflict resolved

๐Ÿ” Auto-Detect Everything

No more guessing board types or ports:

You: "What's connected?"
Claude: โ†’ arduino_list_boards
        โœ“ Found: Arduino Uno on /dev/ttyUSB0
        โœ“ Found: ESP32-DevKit on /dev/ttyUSB1

๐Ÿ“š Smart Library Management

Never hunt for dependencies again:

You: "Add a GPS module"
Claude: โ†’ arduino_lib_deps "TinyGPSPlus"
        โ†’ arduino_lib_install_missing
        โœ“ Installed TinyGPSPlus and all dependencies

โšก Fast Compilation

Parallel builds with caching make iteration quick:

You: "Compile this"
Claude: โ†’ arduino_compile_advanced with jobs=4
        โœ“ Compiled in 8 seconds (using 4 CPU cores)

๐Ÿ› Real Debugging

Not just Serial.println() - actual breakpoints and variable inspection:

You: "Why does it crash in the interrupt handler?"
Claude: โ†’ arduino_debug_start
        โ†’ arduino_debug_break at ISR function
        โ†’ arduino_debug_watch with timer variables
        โœ“ Found it: Integer overflow at timer > 65535

๐Ÿ“ฆ What You Get

70+ Professional Tools organized into logical groups:

  • Sketch Operations: Create, read, write, compile, upload
  • Library Management: Search, install, dependency resolution
  • Board Management: Detection, configuration, core installation
  • Serial Monitoring: Memory-safe buffering, cursor pagination, conflict detection
  • Debugging: GDB integration, breakpoints, memory inspection
  • Project Templates: WiFi, sensor, serial, blink patterns
  • Circuit Diagrams: Generate wiring diagrams from descriptions
  • Client Debugging: MCP capability detection and troubleshooting

๐Ÿ”ง Complete Tool & Resource Reference

๐Ÿ“ Arduino Sketch Management (8 tools)

  • arduino_create_sketch - Create new sketch with boilerplate code
  • arduino_list_sketches - List all Arduino sketches
  • arduino_read_sketch - Read sketch file contents
  • arduino_write_sketch - Write/update sketch files
  • arduino_compile_sketch - Compile sketch without uploading
  • arduino_upload_sketch - Compile and upload to board
  • arduino_sketch_new - Create sketch from templates (blink, sensor, wifi, etc.)
  • arduino_sketch_archive - Create archive of sketch for sharing

๐Ÿ“š Library Management (12 tools)

  • arduino_search_libraries - Search Arduino library index
  • arduino_install_library - Install library from index
  • arduino_uninstall_library - Remove installed library
  • arduino_list_library_examples - List examples from library
  • arduino_lib_deps - Check library dependencies and compatibility
  • arduino_lib_download - Download libraries without installing
  • arduino_lib_install_missing - Install all missing dependencies automatically
  • arduino_lib_examples - List examples from installed libraries
  • arduino_lib_list - List installed libraries with version info
  • arduino_lib_upgrade - Upgrade libraries to latest versions
  • arduino_update_index - Update libraries and boards index
  • arduino_outdated - List outdated libraries and cores

๐Ÿ”ง Board Management (11 tools)

  • arduino_list_boards - List connected Arduino boards
  • arduino_search_boards - Search board definitions
  • arduino_install_core - Install board support packages
  • arduino_list_cores - List installed cores
  • arduino_update_cores - Update all cores to latest
  • arduino_install_esp32 - Install ESP32 board support with proper config
  • arduino_board_attach - Attach board to sketch persistently
  • arduino_board_details - Get detailed board information and properties
  • arduino_board_identify - Auto-detect board type from connected port
  • arduino_board_listall - List all available boards from installed cores
  • arduino_board_search_online - Search for boards in online index

๐Ÿ› Debug Tools (15 tools)

  • arduino_debug_start - Start GDB debug session
  • arduino_debug_stop - Stop debug session and cleanup
  • arduino_debug_interactive - Interactive debugging with AI assistance
  • arduino_debug_break - Set breakpoints in code
  • arduino_debug_run - Run/continue/step execution
  • arduino_debug_print - Print variable values/expressions
  • arduino_debug_backtrace - Show call stack
  • arduino_debug_watch - Monitor variable changes
  • arduino_debug_memory - Examine memory contents at addresses
  • arduino_debug_registers - Show CPU register values
  • arduino_debug_list_breakpoints - List all active breakpoints
  • arduino_debug_delete_breakpoint - Delete specific or all breakpoints
  • arduino_debug_enable_breakpoint - Enable/disable breakpoints
  • arduino_debug_condition_breakpoint - Add conditional breakpoints
  • arduino_debug_save_breakpoints - Save breakpoints to file
  • arduino_debug_restore_breakpoints - Restore saved breakpoints

๐Ÿ“ก Serial Monitor Tools (15 tools) - ๐Ÿ†• Enhanced with Smart Conflict Detection

  • serial_check_port - ๐Ÿ†• Check port availability and detect conflicts
  • serial_connect - ๐Ÿ†• Enhanced connection with automatic conflict detection
  • serial_disconnect - Disconnect from serial port
  • serial_send - Send data/commands to serial port
  • serial_read - Read data with cursor-based pagination
  • serial_list_ports - List available serial ports (with Arduino detection)
  • serial_clear_buffer - Clear buffered serial data
  • serial_reset_board - Reset Arduino board (DTR/RTS/1200bps methods)
  • serial_monitor_state - Get current monitor state and statistics
  • serial_cursor_info - Get detailed cursor information
  • serial_list_cursors - List all active cursors
  • serial_delete_cursor - Delete specific cursor
  • serial_cleanup_cursors - Remove invalid/stale cursors
  • serial_buffer_stats - Get detailed circular buffer statistics
  • serial_resize_buffer - Resize circular buffer (100-1M entries)

๐ŸŽจ WireViz Circuit Diagrams (2 tools)

  • wireviz_generate_from_yaml - Create circuit diagram from YAML definition
  • wireviz_generate_from_description - AI-powered circuit generation from natural language

โš™๏ธ Advanced System Tools (13 tools)

  • arduino_compile_advanced - Advanced compilation with custom build properties
  • arduino_size_analysis - Analyze binary size and memory usage breakdown
  • arduino_export_compiled_binary - Export compiled binaries to custom location
  • arduino_cache_clean - Clean Arduino build cache
  • arduino_build_show_properties - Show all build properties for board
  • arduino_burn_bootloader - Burn bootloader using external programmer
  • arduino_config_init - Initialize Arduino CLI configuration
  • arduino_config_get - Get specific configuration values
  • arduino_config_set - Set configuration values
  • arduino_config_dump - Dump entire Arduino CLI configuration
  • arduino_monitor_advanced - Use Arduino CLI's built-in advanced serial monitor
  • arduino_show_directories - Show current directory configuration and MCP roots
  • arduino_sketch_archive - Create distributable archives of sketches

๐Ÿ” Client Debug Tools (5 tools)

  • client_debug_info - Show comprehensive MCP client debug information
  • client_capability_check - Test specific client capabilities (sampling, etc.)
  • client_declared_capabilities - Show what capabilities client declares
  • client_test_sampling - Test client sampling functionality with simple prompt
  • client_fix_capabilities - Suggest fixes for common capability issues

๐Ÿ“‹ MCP Resources (8 resources)

Real-time information resources that Claude can access to understand your current Arduino environment:

๐Ÿš€ Development Resources

  • arduino://sketches - List all Arduino sketches with sizes and paths
  • arduino://libraries - List all installed Arduino libraries with versions
  • arduino://boards - List all connected Arduino boards with details

๐Ÿ”ง Active Session Monitoring

  • arduino://debug/sessions - List all active debug sessions with status
  • arduino://serial/state - Get current serial monitor state and connections

๐Ÿ“š Documentation & Configuration

  • wireviz://instructions - WireViz usage instructions and circuit examples
  • server://info - Complete server configuration and capabilities overview
  • arduino://roots - Current MCP roots configuration and directory setup

๐ŸŽฏ Smart Features

๐Ÿ†• Intelligent Port Conflict Detection

  • Process Identification: Recognizes Arduino IDE, PlatformIO, terminal programs
  • Specific Solutions: Tailored advice for each type of conflicting application
  • Command Suggestions: Provides exact kill commands and troubleshooting steps
  • Graceful Fallbacks: Works even when detection tools are unavailable

๐Ÿง  Memory-Safe Architecture

  • Circular Buffer: Fixed 10MB memory usage regardless of runtime duration
  • Cursor Pagination: Navigate through millions of serial entries efficiently
  • Auto-Cleanup: Removes stale cursors and manages buffer health

๐Ÿ”— MCP Roots Integration

  • Automatic Detection: Uses client-provided project directories
  • Smart Selection: Prefers Arduino-specific directories
  • Environment Override: MCP_SKETCH_DIR for custom locations
  • Multi-Client Support: Works across different MCP clients

๐ŸŽ“ Perfect For

  • Beginners: "How do I connect a button?" โ†’ Get working code instantly
  • Makers: "Add WiFi to my weather station" โ†’ Dependencies handled automatically
  • Students: "Debug my robot code" โ†’ Find issues with AI assistance
  • Engineers: "Profile memory usage" โ†’ Professional debugging tools included

๐Ÿ”ง Configuration

Set your preferences via environment variables:

ARDUINO_CLI_PATH=arduino-cli
ARDUINO_SERIAL_BUFFER_SIZE=10000     # Circular buffer size
MCP_SKETCH_DIR=~/Arduino_Projects    # Where sketches are saved

๐Ÿšฆ Requirements

  • Python 3.10+
  • arduino-cli (install guide)
  • Claude Desktop or any MCP-compatible client

๐Ÿ“š Examples Repository

Check out examples/ for complete projects:

  • IoT weather station
  • LED matrix games
  • Sensor data logger
  • Bluetooth robot controller
  • Home automation basics

๐Ÿค Contributing

We love contributions! Whether it's adding new templates, fixing bugs, or improving documentation.

git clone https://git.supported.systems/MCP/mcp-arduino
cd mcp-arduino
uv pip install -e ".[dev]"
pytest tests/

๐Ÿ“œ License

MIT - Use it, modify it, share it!

๐Ÿ™ Built With


Ready to start building?

uvx mcp-arduino

Talk to your Arduino. Build something awesome.

Documentation โ€ข Report Issues โ€ข Discord Community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_arduino-2025.9.27.4.tar.gz (89.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_arduino-2025.9.27.4-py3-none-any.whl (104.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_arduino-2025.9.27.4.tar.gz.

File metadata

  • Download URL: mcp_arduino-2025.9.27.4.tar.gz
  • Upload date:
  • Size: 89.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for mcp_arduino-2025.9.27.4.tar.gz
Algorithm Hash digest
SHA256 4f47084f38abf5210ee3a1e6b78e76a42fd28993991f1aad6c77e343f6a00e7c
MD5 27e797fea22878d95d45d4e0cc301023
BLAKE2b-256 0d125dfddaa5dd7fd080e1ff6574feaef5a53b17e354bfccc37e6f02c3774bc7

See more details on using hashes here.

File details

Details for the file mcp_arduino-2025.9.27.4-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_arduino-2025.9.27.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2ea68d990fb21bb35c1d1531a712a57da9f1d03e8fa2964f0c44a7d9ee0a20
MD5 9c29661cd621827cc303f840624218b3
BLAKE2b-256 8b01ec8be0724b04ea661d2da8da66c8eb034462c4087ebe2f431a497e3e6c47

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page