AUDIO

Listen to this page

0:00
Chapters

    Media library (Music Assistant)

    The media_library plugin connects holai to a running Music Assistant server: the household's music library (local files, Spotify, YouTube Music, radio — whatever MA has as sources) becomes playable from holai's dashboard and by voice ("play some jazz in the kitchen"). A voice command from a named smart speaker plays on THAT speaker's player by default — name another room to play elsewhere. The integration speaks MA's native JSON API (POST http://<ma-host>:8095/api) — the same API the Home Assistant integration uses, here in plain Node — so no MCP setup is needed on the Music Assistant side.

    Tool media_library (user role)
    Dashboard Players with transport controls, now playing, library search, recently played, link to the MA dashboard
    Settings MA URL, long-lived token (write-only), default player
    State db rows plugin-media-library-config / -default-player — no files on disk
    External service Music Assistant server (Docker ghcr.io/music-assistant/server, web/API port 8095) — degrades gracefully when absent

    One-time setup

    1. Run the Music Assistant server (once, after enabling the plugin): the plugin ships an optional compose sidecar (server/plugins/media_library/docker-compose.yml). The installer merges it into the main stack (COMPOSE_FILE in .env — plugin compose autodiscovery), but it carries a compose profile, so a plain docker compose up -d will NOT install it. Start it only when the media_library plugin is enabled:

      docker compose --profile media-assistant up -d music-assistant
      

      That starts it on http://localhost:8095 (web dashboard + API) with its data in server/data/music-assistant/. MA wants host networking for player discovery (mDNS/uPnP) — on Docker Desktop enable "Host networking" in its settings; without it, software players still work but AirPlay/ Chromecast/Sonos discovery does not. You can equally run MA anywhere else — the plugin only needs the URL.

    2. Create a long-lived token in Music Assistant: Settings → Profile → Long-lived access tokens → create, copy.

    3. Configure the plugin (dashboard → Media Library → Settings): MA URL (default http://host.docker.internal:8095 inside the container, http://127.0.0.1:8095 on bare metal) and the token. The token is write-only — the field stays empty, saving a blank keeps the stored one. Pick the default player the voice commands should target.

    Dashboard page

    • Status line — reachability dot, the MA server address and a Open Music Assistant button that opens MA's own web dashboard (maximum-integration shortcut; library management, providers and MA settings live there).
    • Players — one row per MA player: name, state dot, what is playing (title · artist, artwork), transport buttons (play/pause, previous, next, stop) and a volume slider. Grouped players show their group name.
    • Search — one input searches the whole library (tracks, albums, artists, playlists, radio); every hit has a play button that starts it on the chosen player.
    • Recently played — the last items MA remembers, one tap to play again.

    Voice / agent

    The media_library tool is exposed to the agent (user role), so phrases like these work in every language holai speaks:

    say the agent does
    "play " / "play some jazz in the kitchen" play — searches the library, plays the best match on the default (or named) player
    "pause the music" / "resume" / "stop" pause / resume / stop
    "next track" / "previous" next / previous
    "set volume to 30" / "louder" / "quieter" volume (level / up / down)
    "what's playing?" now — current track and player
    "which speakers are there?" players — list with states
    "find " search — list library matches, then "play the second one"

    Actions: play, pause, resume, play_pause, stop, next, previous, volume, players, now, search, recent, status.

    API commands used

    All calls are POST <ma-url>/api with {message_id, command, args} and Authorization: Bearer <token> (full command catalog: http://<ma-host>:8095/api-docs):

    command used for
    players/all player list + states (dashboard, tool)
    players/cmd/play_pause · pause · resume · stop · next · previous transport
    players/cmd/volume_set · volume_up · volume_down volume (0–100)
    player_queues/play_media start media (uri from search) on a queue
    player_queues/all · player_queues/items now playing / queue contents
    music/search library search (search_query, media_types, limit)
    music/recently_played_items recently played

    Artwork is proxied through the plugin route (GET …/artwork?u=…&token=…) because <img> tags cannot send the Authorization header.

    Notes

    • When MA is unreachable, the status line shows an offline dot with a hint, and the tool answers with an actionable message — voice keeps working for everything else.
    • The holai db stores only the config rows above; MA's own state (library, players, queues) lives entirely in the MA server's data dir.
    • MA needs to be reachable from the core container — inside the compose network use host.docker.internal:8095 (Docker Desktop) or the MA container name / host IP of your setup.

    Last updated: November 2026