PlatformIO — Claude Code MCP server: what it does, how to install
Connects PlatformIO toolchains to AI coding agents for building firmware, flashing hardware, and reading serial logs. Designed for microcontroller projects.
MIT ★ 10 updated 2026-10-21
claude mcp add --env PLATFORMIO_MCP_POLICY=<PLATFORMIO_MCP_POLICY> --env PLATFORMIO_MCP_PROJECT_DIR=<PLATFORMIO_MCP_PROJECT_DIR> --env PLATFORMIO_MCP_PIO=<PLATFORMIO_MCP_PIO> --transport stdio platformio -- uvx platformio.mcpWhat PlatformIO does
The server gives coding assistants 40 tools to manage microcontroller lifecycles directly. The model runs project builds and tracks syntax issues by file and line number. Unit testing runs through Unity. It handles flashing firmware over a serial cable or over the air via OTA.
Raw terminal dumps stay out of the conversation context. The pio_flash_and_verify tool checks board output right after uploading. If an ESP32 crash occurs, the server decodes stack addresses back to specific lines of code. It also inspects memory tables and flash allocation.
You need Python 3.12 and the uv runner installed beforehand. The server searches PATH and ~/.platformio/penv for your PlatformIO setup. Missing binaries can be bundled using the --with-platformio option.
What it helps with
- compile firmware and pinpoint build errors down to the source line
- flash microcontrollers via USB or OTA and verify system startup
- decode ESP32 panic backtraces into file names and line numbers
- inspect flash partition tables and analyze RAM usage
- execute Unity unit test suites on target hardware
Example prompts for the agent
- Build the esp32dev target and show any compiler errors
- Flash the view environment and watch the serial console until setup completes
- Decode the crash backtrace from the serial log and find the failing line
How to install PlatformIO
Platform CLI
claude mcp add --env PLATFORMIO_MCP_POLICY=<PLATFORMIO_MCP_POLICY> --env PLATFORMIO_MCP_PROJECT_DIR=<PLATFORMIO_MCP_PROJECT_DIR> --env PLATFORMIO_MCP_PIO=<PLATFORMIO_MCP_PIO> --transport stdio platformio -- uvx platformio.mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from platformio.mcp <command>
Platform CLI
codex mcp add platformio --env PLATFORMIO_MCP_POLICY=<PLATFORMIO_MCP_POLICY> --env PLATFORMIO_MCP_PROJECT_DIR=<PLATFORMIO_MCP_PROJECT_DIR> --env PLATFORMIO_MCP_PIO=<PLATFORMIO_MCP_PIO> -- uvx platformio.mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from platformio.mcp <command>
Config file
{
"mcpServers": {
"platformio": {
"command": "uvx",
"args": [
"platformio.mcp"
],
"env": {
"PLATFORMIO_MCP_POLICY": "<PLATFORMIO_MCP_POLICY>",
"PLATFORMIO_MCP_PROJECT_DIR": "<PLATFORMIO_MCP_PROJECT_DIR>",
"PLATFORMIO_MCP_PIO": "<PLATFORMIO_MCP_PIO>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from platformio.mcp <command>
Config file
{
"servers": {
"platformio": {
"type": "stdio",
"command": "uvx",
"args": [
"platformio.mcp"
],
"env": {
"PLATFORMIO_MCP_POLICY": "<PLATFORMIO_MCP_POLICY>",
"PLATFORMIO_MCP_PROJECT_DIR": "<PLATFORMIO_MCP_PROJECT_DIR>",
"PLATFORMIO_MCP_PIO": "<PLATFORMIO_MCP_PIO>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from platformio.mcp <command>
Platform CLI
gemini mcp add -e PLATFORMIO_MCP_POLICY=<PLATFORMIO_MCP_POLICY> -e PLATFORMIO_MCP_PROJECT_DIR=<PLATFORMIO_MCP_PROJECT_DIR> -e PLATFORMIO_MCP_PIO=<PLATFORMIO_MCP_PIO> platformio uvx platformio.mcpReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from platformio.mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about PlatformIO
How to install PlatformIO in Claude Code?
Run claude mcp add platformio-mcp -- uvx platformio.mcp in your terminal. Ensure Python 3.12 and uv are available on your system.
What does the PlatformIO MCP server do?
It equips coding agents with 40 tools for embedded development. Models can configure projects, compile code, flash hardware, monitor serial output, and resolve crash traces.
How does the server locate PlatformIO Core?
It looks for pio in your system PATH and ~/.platformio/penv. You can point directly to a binary using PLATFORMIO_MCP_PIO or install PlatformIO automatically with the --with-platformio flag.