music-library-mcp
Enables management of an Apple Music library through the Music app, including searching tracks, editing track and album tags, managing playlists, deleting tracks with confirmation and undo, re-adding tracks, and running library health checks.
Provides genre lookups from MusicBrainz to fill in track genres, with rate limiting and mapping to Apple's genre names.
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-library-mcpfind tracks missing genres and fill them in from MusicBrainz"
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-library-mcp
An MCP server that lets Claude look after an Apple Music library: search it, fix tags, fill in genres from MusicBrainz, sort out albums that show up twice, manage playlists, delete songs (with confirmation, to the Bin) and re-add songs that iCloud has stopped serving. Every change can be undone.
It runs on the Mac that hosts the library and drives the Music app through Apple Events (JavaScript for Automation). Nothing is clicked and no windows move; changes go through Music, so the file, the library and iCloud Music Library stay in step.
Tools
Read | Edit | Playlists | Safety |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
Bulk edits (more than 25 tracks) and genre fills return a preview and a one-time confirmation token; nothing changes until the call is repeated with the token.
Deletes always preview first. The token is tied to the exact tracks, expires after 10 minutes and works once. Files go to the Bin, so
undocan bring them back.Re-adding (
rematch_tracks) fixes songs that are "matched" but greyed out on other devices: each file is backed up, the library entry removed and the file added again, keeping stars, plays, favourite and playlists.Snapshots: before changes, every track's details are saved to
data/snapshots/(gzipped JSON, at most one per 10 minutes, last 50 kept). If the snapshot can't be saved, nothing changes.Health check finds library entries without a file ("ghosts" left when a file was replaced), entries whose file has gone, and audio files in the Music folder that aren't in the library.
One Apple Event request runs at a time, so a slow Mac isn't flooded.
Back up
Music Library.musiclibrarytoo before big clean-ups: it holds playlists, plays and ratings, which snapshots record but can't recreate.
Related MCP server: mcp-apple-music
Requirements
macOS with the Music app, signed in to the library you want to manage, in a logged-in session
uv (installs Python and the one dependency,
mcp)A way for Claude to reach it over HTTPS, e.g. a Cloudflare Tunnel (OAuth is built in)
Setup
git clone https://github.com/BowerHarry/music-library-mcp.git && cd music-library-mcp
curl -LsSf https://astral.sh/uv/install.sh | sh # if you don't have uv
cp .env.example .env # set PUBLIC_URL and a password
uv run python -m library_mcp.cli status # macOS asks to let Terminal control Music
uv run python -m library_mcp.cli issues # read-only health check
./scripts/install-launch-agent.sh # run at login; approve the Music prompt againPoint your tunnel at http://localhost:8091 (from a container: http://host.docker.internal:8091),
then add https://<your host>/mcp as a custom connector in Claude and sign in with the password.
Logs are in data/server.log; the change history and OAuth state in data/library.db.
Tests
uv run python -m unittest tests/test_all.pyThe tests run against an in-memory fake of the Music app, so they work on any OS. library_mcp.cli
gives read-only checks against the real library.
Layout
library_mcp/
bridge.js Apple Events side: every operation on the Music app
bridge.py runs bridge.js via osascript, one call at a time, with timeouts
index.py in-memory snapshot of the library: search, album checks, health check
service.py the operations behind each tool: confirmations, change history, undo
musicbrainz.py genre lookups (1 request/second), mapped to Apple's genre names
server.py MCP tools and instructions; auth.py single-user OAuthLicence
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Run Apple Search Ads from Claude: performance, recommendations, keywords, budgets, launches.
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
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.15 npm7MIT
- AlicenseAqualityBmaintenanceFull Apple Music integration for Claude: search the catalog, browse your personal library, manage playlists, and get personalised recommendations.1144MIT
- 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.15 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to automate macOS applications, manage files, control music, send messages, and more through AppleScript.20 npm1GPL 3.0