Skip to main content

HARDWARIO CLI Tools

Test Release PyPI License Twitter

Hardwario CLI is a command-line tool for developing, managing, and debugging devices in the HARDWARIO ecosystem. It supports workflows for CHESTER modules, Nordic SoCs (nRF5x, nRF91, etc.), firmware management, logging, and more.


✨ Features

  • Manage CHESTER-specific application SoC features
  • Open interactive device console for logs and shell access
  • Flash, erase, and reset firmware for supported SoCs
  • Work with HARDWARIO's Product Information Block (PIB)
  • Support for multiple chip families (nRF51, nRF52, nRF91, etc.)
  • Integration with SEGGER J-Link (serial number, speed control)
  • Built-in MCP server so AI tools can drive the device console

🛠️ Installation

pip install hardwario

🚀 Quick Start

hardwario --help
Usage: hardwario [OPTIONS] COMMAND [ARGS]...

  HARDWARIO Command Line Tool.

Options:
  --log-level [debug|info|success|warning|error|critical]
                                  Log level to stderr  [default: critical]
  --version                       Show the version and exit.
  --help                          Show this message and exit.

Commands:
  chester  Commands for CHESTER (configurable IoT gateway).
  device   Commands for devices.

🤖 MCP Server (AI Integration)

The device console can expose a built-in Model Context Protocol server, which lets AI tools (Claude, Cursor, etc.) drive the target: send shell commands, read the log, flash firmware, and inspect memory and registers.

The server is off by default. Add --mcp to any console command:

hardwario chester app console --mcp
hardwario device nrf52 console --mcp

It listens on 127.0.0.1:8090 unless --mcp-listen [HOST:]PORT says otherwise.

Claude Code Configuration

Add to your .mcp.json:

{
    "mcpServers": {
        "hardwario-console": {
            "type": "http",
            "url": "http://127.0.0.1:8090/mcp"
        }
    }
}

When the server runs with --mcp-token, add the matching header:

{
    "mcpServers": {
        "hardwario-console": {
            "type": "http",
            "url": "http://127.0.0.1:8090/mcp",
            "headers": {
                "Authorization": "Bearer <TOKEN>"
            }
        }
    }
}

Authentication

The MCP server has no authentication by default and binds to 127.0.0.1, which is fine for local use. Since the tools can flash the device and read or write its memory, set a token whenever the server leaves loopback (e.g. --mcp-listen 0.0.0.0:8090 on a shared debug box):

hardwario device nrf91 console --mcp --mcp-token "$(openssl rand -hex 16)"

Every request must then carry Authorization: Bearer <TOKEN>; anything else gets 401 Unauthorized. Binding off loopback without a token prints a warning. Note the transport is plain HTTP, so on an untrusted network the token is visible on the wire — use an SSH tunnel or a TLS reverse proxy for anything beyond a lab LAN.

Keeping the session alive

Flashing drops the RTT link, which leaves the console dead until it is re-attached. Pair --mcp with --auto-reconnect so the session comes back on its own instead of the AI client having to notice and call reconnect():

hardwario device nrf52 console --mcp --auto-reconnect

Available MCP Tools

Tool Description
send_command(command, timeout) Send a shell command to the device and wait for response
read_terminal(lines) Read recent terminal output (device responses and sent commands)
read_log(lines, after_cursor, pattern) Read log output from the device ring buffer, with optional regex filter
wait_for_state(pattern, timeout, command, ...) Poll the log or terminal until a pattern shows up
wait_for_connection(timeout, source) Block until the RTT link is up
status() Session statistics (line counts, buffer usage, cursors, link state)
flash(file_path, addr) Flash a firmware file (.hex, .bin, .elf, .srec) to the target device
reconnect(address) Re-attach a stuck RTT session without resetting the device
start() / stop() Resume / suspend the RTT readout
jlink_open() / jlink_close() Attach or release the J-Link probe
reset(halt) Reset the target; RTT re-attaches automatically (unless halting)
halt() / go() Stop / resume the target CPU
target_status() CPU halted flag and core identification
read_memory(address, length, width, to_file) Hexdump of RAM, peripherals or memory-mapped flash
write_memory(address, data, width, from_file) Write RAM or peripheral registers
write_flash(address, data, from_file) Program internal flash bytes (reset+halt, program, reboot)
read_registers() Core CPU registers (requires a halted target)
memory_zones() Memory zones supported by the J-Link for the target

License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤  by HARDWARIO a.s. in the heart of Europe.

Download files

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

Source Distribution

hardwario-1.7.1.tar.gz (29.8 kB view details)

Uploaded Source

Built Distribution

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

hardwario-1.7.1-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

Details for the file hardwario-1.7.1.tar.gz.

File metadata

  • Download URL: hardwario-1.7.1.tar.gz
  • Upload date:
  • Size: 29.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hardwario-1.7.1.tar.gz
Algorithm Hash digest
SHA256 e69350bad29f3daf22b1e9715d743202dc47a6f44ba43a930c7be0ea481c4dd0
MD5 e25745a890f317b8dd61663b3fb3777a
BLAKE2b-256 b3cb9bc17bd981bb6cfcb58446f869e30dd111a1f3eee9e6bc79afa95dcdfe8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hardwario-1.7.1.tar.gz:

Publisher: publish.yaml on hardwario/py-hardwario

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hardwario-1.7.1-py3-none-any.whl.

File metadata

  • Download URL: hardwario-1.7.1-py3-none-any.whl
  • Upload date:
  • Size: 35.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hardwario-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57a050813348881124a6c73101fedb4567305a3656a832407e27a4ec0cedbeec
MD5 04d6e5b23af45d95a087c20f346f194a
BLAKE2b-256 ae830ba31b3f464d33b7e21e839e8726617ca9da6ccee26bff65c591e13d957d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hardwario-1.7.1-py3-none-any.whl:

Publisher: publish.yaml on hardwario/py-hardwario

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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