EmbiMind MCP
<!-- mcp-name: io.github.channaveer-8/embimind-mcp -->
<div align="center">
<img src="https://raw.githubusercontent.com/channaveer-8/embimind-mcp/master/assets/logo.svg" alt="EmbiMind MCP Logo" width="120" />
<h1>EmbiMind MCP</h1>
<h3><em>Where AI Gets Embedded</em></h3>
<p>
Give your AI assistant real hardware hands—without taking yours off the wheel.<br/>
<strong>Compile • Inspect • Flash • Debug</strong> bare-metal ARM firmware in a <strong>closed human-in-the-loop</strong> workflow.
</p>
<p>
<a href="https://pypi.org/project/embimind-mcp/"><img src="https://img.shields.io/badge/PyPI-v1.0.2-blue.svg" alt="PyPI v1.0.2" /></a>
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/Python-3.13%2B-3776AB.svg" alt="Python 3.13+" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT License" /></a>
<a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-STDIO-8A2BE2.svg" alt="MCP STDIO" /></a>
</p>
</div>
---
## The Hardware Bridge
Most AI coding tools stop at the editor. The moment you hit a `HardFault`, a linker overflow, or a stubborn peripheral register, you're back to juggling terminals, OpenOCD scripts, and GDB windows.
**EmbiMind MCP** connects your AI IDE directly to your **ARM GNU Toolchain**, **OpenOCD**, and **GDB/MI2**—turning your assistant into an embedded co-pilot that stays **strictly under your command**.
- **Zero Guesswork**: Inspects real ELF sections, memory maps, and Cortex-M fault registers (`CFSR`, `HFSR`, `MMFAR`, `BFAR`).
- **Closed Human-in-the-Loop**: AI prepares the plan; **you** approve every flash erase, target reset, and memory write.
- **Zero Setup Friction**: One command (`uvx embimind-mcp`) auto-provisions the verified ARM toolchain and OpenOCD.
---
## How the Closed Human-in-the-Loop Works
```mermaid
flowchart LR
A["1. AI Diagnoses & Prepares<br/>(flash_preflight / triage_cortex_m)"] --> B["2. SHA-256 Plan Token<br/>(Exact Sectors & Memory Bounds)"]
B --> C{"3. Human Approval Gate<br/>(user_approved=true)"}
C -- Approved --> D["4. Atomic Flash & Verify<br/>(flash_and_verify + Reset)"]
C -- Rejected --> A
D --> E["5. Live GDB/MI2 Debug<br/>(Breakpoints, Registers, Memory)"]
E --> A
```
Every destructive operation is **plan-bound and fail-closed**—no silent flashes, no unvalidated memory writes, and no host shell escapes.
---
## What It Brings to Your Bench
| | Capability | What Your AI Can Do |
| :--- | :--- | :--- |
| **Build & Analyze** | ARM GNU Toolchain | Compile C/C++/ASM, link ELFs, generate `.bin`/`.hex`, and audit Flash/RAM usage & disassembly. |
| **Target Control** | OpenOCD Tcl RPC | Discover board configs, connect SWD/JTAG probes, and run allowlisted target commands. |
| **Live Debugging** | Persistent GDB/MI2 | Set hardware breakpoints/watchpoints, step instructions, read memory batches, and inspect call stacks. |
| **Fault Triage** | Cortex-M Diagnostics | Capture `CPUID`, `ICSR`, `CFSR`, `HFSR`, `MMFAR`, `BFAR`, and core registers in a single call. |
---
## 30-Second Setup
Add `embimind-mcp` to **Claude Code**, **Cursor**, **Codex**, **Antigravity**, or **Gemini CLI**:
```json
{
"mcpServers": {
"embimind-mcp": {
"command": "uvx",
"args": ["embimind-mcp"]
}
}
}
```
Or install globally with `pip` / `uv`:
```bash
pip install embimind-mcp
# or
uv tool install embimind-mcp
```
> On first launch, `embimind-mcp` verifies and provisions the ARM GNU Toolchain and OpenOCD over HTTPS with SHA-256 verification. All logs go to `stderr` so MCP STDIO stays clean.
---
## Supported Platforms & Configuration
- **Host OS**: Windows `x86_64` and Linux `x86_64` (auto-provisioned). macOS / ARM64 supported via `EMBIMIND_TOOLCHAIN_DIR`.
- **Python**: `>=3.13`
- **Target Hardware**: ARM Cortex-M targets via OpenOCD + GDB/MI2, with built-in memory-map profiles for `STM32F411VETx` and `STM32F411RE`.
<details>
<summary><strong>Environment Variables & Troubleshooting</strong></summary>
| Variable | Description | Default |
| :--- | :--- | :--- |
| `EMBIMIND_APP_DIR` | Override per-user app/data/toolchain directory | `%LOCALAPPDATA%\EmbiMind` (Win) / `~/.local/share/EmbiMind` (Linux) |
| `EMBIMIND_TOOLCHAIN_DIR` | Use a local ARM GNU + OpenOCD directory (offline/air-gapped) | `<EMBIMIND_APP_DIR>/toolchain` |
| `EMBIMIND_TOOLCHAIN_URL` | Override toolchain archive download URL (HTTPS only) | GitHub Release `v1.0.0` asset |
| `EMBIMIND_TOOLCHAIN_SHA256` | Expected SHA-256 checksum for custom toolchain archive | Pinned release SHA-256 |
| `EMBIMIND_OPENOCD_PORT` | Override OpenOCD Tcl RPC port | `6666` |
- **Offline / air-gapped setup**: Point `EMBIMIND_TOOLCHAIN_DIR` to a folder containing `arm-gnu-toolchain/bin/` and `openocd/bin/`.
- **Linux USB permissions**: Install `udev` rules for ST-Link/CMSIS-DAP and add your user to `plugdev`.
- **Port 6666 conflict**: Set `EMBIMIND_OPENOCD_PORT` or call `stop_all_sessions()`.
</details>
TDQS
Scored across 79 tools
Several tools have overlapping or near-identical purposes: get_registers vs get_register_values, inspect_elf_header vs inspect_all_elf_headers, elf_to_bin/elf_to_hex vs convert_elf, flash_elf vs flash_and_verify, and stop_all_sessions vs stop_gdb/stop_openocd. Clusters like compile_*/inspect_elf_*/get_*_status are distinguishable, but an agent must read carefully to avoid misselection among the many near-duplicates.
The set overwhelmingly follows a snake_case verb_object pattern (get_threads, add_breakpoint, stop_openocd, read_memory), which is predictable. Deviations exist, such as the bare verb 'disassemble', conversion-style names (elf_to_bin, address_to_source), and inconsistent prefixing (inspect_elf_header vs inspect_all_elf_headers), but these remain readable.
At 79 tools the surface is far beyond what an agent can hold comfortably, and many capabilities are fragmented into single-purpose variants (compile_c/compile_cpp/compile_assembly, four separate ELF inspect tools). The domain is genuinely broad, but much of this should be consolidated into fewer parameterized tools.
Coverage is unusually thorough: toolchain checking, project build, link/convert, flash preflight and verification, GDB breakpoints/watchpoints, memory and register access, fault triage, and session recovery. Minor gaps remain around target console/semihosting or SWO trace capture and RTOS-aware inspection, but no core workflow is a dead end.