Skip to main content
Glama
README.md
<p align="center">
  <img src="assets/hardwaremcp-icon.png" width="104" height="104" alt="An open relay between two teal circuit traces">
</p>

<h1 align="center">HardwareMCP</h1>

<p align="center">
  Give your AI assistant access to sensors and switches.<br>
  You choose what it can read, what it can change, and when it needs to ask.
</p>

<p align="center">
  <a href="docs/getting-started.md"><strong>Beginner guide</strong></a> &nbsp;·&nbsp;
  <a href="#choose-your-device">Supported devices</a> &nbsp;·&nbsp;
  <a href="docs/04-permissions.md">Permissions</a> &nbsp;·&nbsp;
  <a href="docs/README.md">All docs</a>
</p>

---

HardwareMCP is a local server that connects an AI app to an ESP32, another compatible serial device, or Home Assistant. It speaks the **Model Context Protocol (MCP)**, the standard your app uses to discover tools and call them. The included mock device lets you try the whole conversation on your computer.

## Try it without hardware

You need **Python 3.10 or newer**. If you already have the project, open a terminal in the folder containing `pyproject.toml`. Otherwise, get a copy with Git.

```sh
git clone https://github.com/itfidele/hardware-mcp.git
cd hardware-mcp
```

**macOS or Linux**

```sh
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
hardware-mcp check -c examples/mock.yaml --read
```

<details>
<summary><strong>Windows Command Prompt</strong></summary>

```bat
py -3 -m venv .venv
.venv\Scripts\activate.bat
python -m pip install -e .
hardware-mcp check -c examples/mock.yaml --read
```

</details>

Look for **`[ok]   mock (MockDevice): 6 channels`**. You’ll see readings for `temp`, `humidity`, and `button`, followed by three outputs you can control. This check works before you connect an AI app.

## Your first conversation

After the terminal check, connect Claude Desktop or another MCP client. Then try these requests in the same session using the supplied mock configuration. [Connect Claude Desktop](docs/getting-started.md#3-connect-claude-desktop) · [Other clients](docs/06-connect-clients.md) · [Mock configuration](examples/mock.yaml)

| Ask your assistant | What to look for |
| --- | --- |
| “What’s the temperature on the mock device?” | A simulated reading in degrees Celsius. It varies slightly each time. |
| “Turn on the mock LED, then read it back.” | The LED reads `1`. The project’s policy allows this write directly. |
| “Turn on relay1 on the mock device.” | A client that supports approval forms asks you first. Decline, then ask for the relay state. On a fresh session it still reads `0`. |

The **channel** is the named part you interact with, such as `temp` or `led`. Each read or write goes through the server’s permission rules in order. The first match decides whether to allow it, ask you, or deny it. A write that needs approval can run only after the client receives your explicit consent. With the mock configuration, you can inspect write outcomes in `examples/audit.jsonl`. [How permissions and auditing work](docs/04-permissions.md)

## Choose your device

| Setup | What you can try | Where to start |
| --- | --- | --- |
| **Mock device** | Read simulated sensors, switch an LED, or set fan speed from 0 to 100%. | [Beginner guide](docs/getting-started.md) |
| **TCP simulator** | Exercise the same serial driver used for the board through a local socket. | [Simulator configuration](examples/simulator.yaml) |
| **ESP32 over USB** | Read chip temperature, uptime, and the BOOT button. Switch the LED or relay with the supplied firmware. | [Board setup and firmware](docs/03-esp32-firmware.md) |
| **Home Assistant** | Read a named sensor or control a light or switch from your selected entities. | [Home Assistant setup](docs/05-home-assistant.md) |

To try the TCP simulator, run `hardware-mcp sim` in one terminal. In a second terminal with the same environment active, run `hardware-mcp check -c examples/simulator.yaml --read`. Look for `sim-esp32`. Press Ctrl+C in the first terminal when you’re done.

**Connecting real hardware?** Start with a sensor or the onboard LED. For a relay, verify the module’s switching polarity with the load disconnected. The project tracks physical-board, live Home Assistant, and desktop-client checks separately from its automated tests. [Hardware safety](SECURITY.md) · [Test guide](docs/TESTING.md) · [Roadmap](docs/ROADMAP.md)

## Tool reference

| Tool | What your assistant can do |
| --- | --- |
| `list_devices` | Find devices named in your configuration. |
| `describe_device` | List a device’s channels, units, and which channels accept writes. |
| `get_policy` | Inspect the active permission rules. |
| `read_channel` | Read a sensor or check an output’s current value. |
| `write_channel` | Change an output, subject to your policy. |

Building a device that speaks the protocol? Start with the [wire format](docs/PROTOCOL.md). To work on the server, see the [architecture](docs/00-architecture.md) and [contributor guide](CONTRIBUTING.md).

[MIT license](LICENSE) © 2026 Nexttek Solutions LLC · [Code of conduct](CODE_OF_CONDUCT.md) · [CI](https://github.com/itfidele/hardware-mcp/actions/workflows/ci.yml) · [Public safety checks](https://github.com/itfidele/hardware-mcp/actions/workflows/public-safety.yml)