music-assistant-client
A simple synchronous HTTP client for the Music Assistant API.
Installation
pip install ma-http-client
Usage
from ma_http_client import SimpleHTTPMusicAssistantClient
client = SimpleHTTPMusicAssistantClient(
server_url="http://localhost:8095",
token="YOUR_TOKEN", # required for MA >= 2.7.2
)
# Get all players
players = client.get_players()
# Search for media
results = client.search_media("Radiohead", limit=5)
# Resolve one item by name; the server matches across types, or narrow it
album = client.get_item_by_name("Abbey Road", artist="The Beatles")
track = client.get_track_by_name("Come Together", artist_name="The Beatles")
# Play media on a player (a uri or a list of uris; shuffle is optional)
client.play_media(queue_id=players[0].player_id, media="library://artist/204")
client.play_media(queue_id=players[0].player_id, media=album["uri"], shuffle=True)
# Queue controls and modes
client.queue_command_pause(players[0].player_id)
client.queue_command_next(players[0].player_id)
client.queue_set_shuffle(players[0].player_id, True)
client.queue_set_repeat(players[0].player_id, RepeatMode.ALL) # from music_assistant_models.enums
# Favorites
client.add_favorite(track["uri"])
# Library listings and genres ("play some jazz", "play some music")
from ma_http_client import SORT_RANDOM
jazz = client.search_genres("jazz")[0]
tracks = client.genre_tracks(jazz["item_id"], limit=30, sort_field=SORT_RANDOM)
random_tracks = client.library_items(MediaType.TRACK, limit=20, sort_field=SORT_RANDOM)
client.play_media(players[0].player_id, [t["uri"] for t in tracks], shuffle=True)
# Playlists
workout = client.library_playlists(search="workout") or [client.create_playlist("Workout")]
client.add_playlist_tracks(workout[0]["item_id"], [track["uri"]])
client.save_queue_as_playlist(players[0].player_id, "Tonight")
# Browse provider folders, e.g. radio stations by country, language, or tag
stations = client.browse("radiobrowser://category/tag/jazz", limit=10)
client.play_media(players[0].player_id, [s["uri"] for s in stations])
# Volume
client.player_command_volume_set(players[0].player_id, 50)
Claude Code Skill
Control Music Assistant with natural language from Claude Code. See CLAUDE.md for full setup.
pip install ma-http-client
ma-install-skill
Then in any Claude Code session:
/music-assistant play some Radiohead
Or just ask naturally — Claude auto-invokes the skill when it matches.
Standalone Agent
For use outside Claude Code (scripts, OVOS, etc.), install the claude extra:
pip install "ma-http-client[claude]"
from ma_http_client.claude_tools import MusicAssistantAgent
agent = MusicAssistantAgent(
ma_url="http://homeassistant.local:8095",
ma_token="YOUR_MA_TOKEN",
default_player="Living Room",
)
print(agent.run("Play some Radiohead"))
Debug Client
The DebugMusicAssistantClient extends the base client with fixture capture for troubleshooting:
from ma_http_client.debug import DebugMusicAssistantClient
client = DebugMusicAssistantClient(
"http://localhost:8095",
fixture_capture=True,
fixture_dir="./debug_fixtures",
)
players = client.get_players()
# API responses are automatically saved to ./debug_fixtures/
Metadata
Release files for ma-http-client 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ma_http_client-0.2.2.tar.gz | 28.2 kB | Without provenance | Details for ma_http_client-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ma_http_client-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for ma_http_client-0.2.2-py3-none-any.whl |
Total release size: 49.7 kB
Release files / ma_http_client-0.2.2.tar.gz
| Download URL | ma_http_client-0.2.2.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c1c11fafdfdacf5cade10097ccefa178d25a3a787b2a11ab9379a09a7406c36
|
|
BLAKE2b-256 checksum How to use checksums |
0c8e95c58ec8cd66309a0296a8539a5fb53336fc44aa4057023ba2116906fd26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / ma_http_client-0.2.2-py3-none-any.whl
| Download URL | ma_http_client-0.2.2-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d5da4a79cde850d23e30e17cd19a8d98277bde68f78c371b264990e87c22d00
|
|
BLAKE2b-256 checksum How to use checksums |
987667b1439c1af1a8292284737d51102e796cff76c60e07151e1423e6dce051
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for ma-http-client 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.