music-mcp-server
Plays Apple Music on a Mac and the AirPlay speakers it can reach. Provides tools to play presets and library playlists by name, search the Apple Music catalog for songs, albums and artists, play catalog items by reference, control playback (pause, resume, next, previous, stop), and report the current track, speakers and volume. It drives Music.app with AppleScript and searches the catalog through Apple's public iTunes Search API, including storefront handling for regions where the Search API finds no music.
AirPlay speakers such as an Apple TV can be named as a playback destination in a person's own words (a Music name, a configured alias, part of either, or the kind "Apple TV"). The server lists matching devices so a client can pick one, reports which speakers are playing and their volume, and can set or step the volume on the playing speakers or a named one.
Exposes a plain HTTP REST API alongside MCP so a home automation hub can show and control playback, turning the server into a Home Assistant media player via the LiveKit Voice integration. Endpoints provide playback state, track, artist, album, position, duration, volume and the speakers (GET /api/state) plus controls for play/pause/stop/next/previous, volume levels and source device selection; each POST returns the new state. The server was also built to work with the Home Assistant voice agent.
Uses Apple's public iTunes Search API to search the Apple Music catalog for songs, albums and an artist's most popular songs, returning item refs plus flags for live, instrumental, remix, cover and compilation versions. Also uses the API's lookup capability and storefront-aware searches for regions where the Search API finds no music.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@music-mcp-serverplay my Smooth Jazz preset on the kitchen speaker"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
music-mcp-server
An MCP server that plays Apple Music on a Mac and the AirPlay speakers it can reach. A voice or chat assistant can play a preset, a library playlist or anything in the catalog, send it to a speaker people name in their own words, and turn it up or down.
It drives Music.app with AppleScript and runs shortcuts with the shortcuts CLI, so it needs no Apple Music API key, and it works while the Mac's screen is locked.
It was built for the Home Assistant voice agent, but works with any MCP client.
Tools
Tool | What it does |
| Plays a preset or library playlist by name, or a song or album by the ref |
| Catalog songs, albums, or an artist's own songs most popular first, with refs and flags for live, instrumental, remix, cover and compilation versions |
| The presets and library playlists |
| AirPlay speakers with their aliases, which are playing and their volume |
| Sets the volume, or changes it by a step, on the playing speakers or a named one |
|
|
| The track, the speakers and their volume |
play_music lists the current presets and playlists in its own description, so a model can pick one without calling list_music first. It plays nothing it was not given exactly: the calling model reads the search results and chooses, since a result list mixes in other artists, covers and other versions.
A device is the speaker as a person says it: its name in Music, an alias from the config, part of either, or its kind ("Apple TV"). When more than one speaker fits, the tool lists them so the client can ask. With no device, music stays on the speakers already selected, unless only the Mac itself is, in which case it goes to default_device.
Related MCP server: Apple Music MCP Server
Presets
A preset is a shortcut in one Shortcuts folder (Music by default) whose only job is a Play Music action, so what it plays is edited in the Shortcuts app. The server picks the speaker and volume before it runs the shortcut, which keeps the shortcut free of macOS-only steps; iOS's Change Playback Destination action does not run on a Mac. A Play Music action made on an iPhone has to have its music picked again on the Mac.
How catalog items play
Music.app has no AppleScript for catalog search or playback, and its Siri intents are not offered to Shortcuts. The server searches with Apple's public iTunes Search API and starts an item by stopping Music, opening its album's music:// link, and sending play until it takes; a song is reached by skipping forward from the album's first track. An AirPlay speaker buffers every track it is sent, which makes skipping there slow, so the album loads and skips on the Mac's own speaker with Music's volume at 0, and once the song streams it is handed to the speakers that were selected. It takes 8 to 12 seconds, so play_music sends an MCP progress notification as soon as it knows what will play.
The Search API finds no music in some stores, China among them, though its lookup works there. So search_stores are searched instead, and only what storefront (the account's store) sells is kept, under the names that store gives it. A store only helps if it shares item ids with the account's: Taiwan's does with China's for Mandarin music, and the US one for English; Hong Kong's does not.
REST API
Beside MCP, the server answers plain HTTP for a home automation hub to show and control playback; the LiveKit Voice integration turns it into a Home Assistant media player.
Endpoint | |
|
|
|
|
|
|
|
|
Each POST answers with the new state. Neither API has authentication, so serve it only on a trusted network.
Run
Needs uv and Music.app signed in to Apple Music. Turn on Sync Library in Music to reach playlists made on other devices.
cp music.example.yaml music.yaml # speakers, aliases, presets
uv sync
uv run python server.py # serves http://0.0.0.0:8961/mcpOn macOS, to run it at login and restart it if it dies:
scripts/install-launchagent.shThe first call asks for permission to control Music; unlock the Mac and click Allow.
Variable | Default | |
|
| |
|
| |
|
| read once at start |
This server cannot be deployed
Maintenance
Related MCP Connectors
Sonos MCP server: control your Sonos speakers from any MCP client. Play songs, artists and playlists, set volume, group rooms, move music to another room, switch to TV, spoken announcements and reminders. 27 tools, English and Chinese. Works through the official Sonos cloud, so there is no home bridge to install; sign in with OAuth. Requires the free ZoneFoundry iOS app.
- mytesla.ioOAuthio.mytesla
Control your Tesla from your AI assistant - climate, charging, access, and security.
Manage digital signage screens, playlists and media from your AI assistant.
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to control Apple Music on macOS using AppleScript for playback, library management, and playlist operations. It supports features like searching tracks, managing the play queue, and retrieving detailed metadata through a structured interface.17 npm7MIT
- FlicenseNot gradedqualityDmaintenanceIntegrates Apple Music with MCP clients to search the global catalog, manage personal playlists, and access library data. It enables users to perform actions like creating playlists, adding tracks, and viewing recommendations through natural language commands.1-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to control Apple Music on macOS through AppleScript, providing tools for playback management, library searching, and playlist organization. It supports detailed track metadata retrieval and enhanced queue management for a seamless music experience.17 npmMIT
- AlicenseAqualityDmaintenanceEnables AI agents to manage macOS audio routing, device switching, volume control, and multi-zone playback.16MIT