# music-assistant-ha: telling your agent to fix the music

*2026-11-11*

> A Hermes Agent skill that drives a Music Assistant server — playback, volume, queues, library search, favorites, multi-room grouping, transfers, and announcements — through one clean CLI.


If you run [Music Assistant](https://www.music-assistant.io/) with Home Assistant, you already have every speaker in the house on one server. What you probably don't have is a way to say *"play some Miles Davis in the office and move it to the kitchen when I leave"* without opening the app. That's the gap this skill fills.

**One integration point**

Everything routes through `scripts/mactl.py`, a CLI wrapping the official `music-assistant-client` library. No second protocol to learn, no vendored API code that rots when the schema changes — the client library handles that.

```bash
mactl players
mactl search "Blue in Green" --type track
mactl search-play "Miles Davis" --type artist
mactl --json status
```

`--json` for machine-readable output, `--quiet` to suppress confirmations, and four honest exit codes: `0` success, `1` operation failed, `2` configuration error, `3` connection/auth failure. The last two matter to an agent — "your token expired" and "the song didn't play" should not look the same in a script.

**Coverage**

Playback, volume, queue control, library search, favorites, multi-room grouping and transfer, announcements. Player IDs are discovered with `mactl players`, never hardcoded; the default player auto-detects and caches.

**Setup is three variables**

| Variable | Required | Notes |
|---|---|---|
| `MASS_SERVER_URL` | yes | e.g. `http://<ma-host>:8095` |
| `MASS_ACCESS_TOKEN` | yes | long-lived token from Settings → Security; never printed or logged |
| `MASS_DEFAULT_PLAYER` | no | fallback when `--player` is omitted |

**The verification habit worth copying**

Unit tests run against a mocked client — no network. There's also `tests/live_readonly_check.py` that runs against your real server and is guaranteed to make *no changes* to playback, volume, queues, groups, or favorites. `docs/VERIFICATION.md` lists which capabilities were verified and how, and `docs/FINDINGS.md` keeps the research notes. Claiming a thing works is cheap; showing the read-only pass that checked is not.

**Where to get it**

```bash
git clone https://github.com/rahlquist/music-assistant-ha
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
```

Python 3.14 (developed and tested on 3.14.7), server API schema 46+ (tested against 2.10.9 / schema 65), token over HTTPS if it crosses anything you don't own. MIT licensed. Drop `SKILL.md` + `scripts/` into `~/.hermes/skills/` and Hermes picks it up.

