mcp-apple-music
This MCP server lets Claude search Apple Music and work with your library and playlists.
Search the Apple Music catalog and your personal library for songs, albums, artists, and playlists.
List saved library songs, albums, artists, and playlists with pagination/limits.
Inspect tracks in a specific playlist.
Create new playlists and add library or catalog tracks to existing playlists.
View recently played albums/playlists/stations and personalized recommendations.
Per the provided schema, it does not expose playback control, adding items to your library, or favorite/unfavorite tools.
Provides tools to search the Apple Music catalog, manage personal library (songs, albums, artists, playlists), create and modify playlists, and retrieve recently played items and recommendations.
mcp-apple-music šµ
mcp-name: io.github.Cifero74/mcp-apple-music
An MCP (Model Context Protocol) server that gives Claude full access to your Apple Music account ā search the catalog, browse your personal library, manage playlists, and explore your listening history and recommendations.
Ask Claude things like:
"Based on what I've been listening to lately, recommend 15 songs I don't have yet and add them to a new playlist"
"Show me all my playlists and tell me which artists appear most"
"Search for albums by Nick Cave and add my three favourites to a playlist called Dark Picks"
Features
Tool | Description |
| Search Apple Music catalog (songs, albums, artists, playlists) |
| Search within your personal library |
| List songs saved in your library (paginated) |
| List albums in your library (paginated) |
| List artists in your library |
| List all your playlists with IDs |
| Get tracks inside one of your playlists or an Apple Music catalog playlist ( |
| Create a new playlist |
| Add songs to a playlist (library or catalog tracks) |
| Save catalog songs, albums or playlists into your library |
| See recently played albums/playlists/stations |
| Get personalised Apple Music picks |
| Mark a catalog song as favorite (star) |
| Remove a catalog song from favorites |
| Check which catalog songs are favorited |
Related MCP server: Spotify MCP Server
Requirements
Python 3.10+
uv (recommended) or pip
A paid Apple Developer Program membership (99 USD/year) to create a MusicKit key. The free Apple Developer account can't create MusicKit keys.
An active Apple Music subscription
Setup
1. Create a MusicKit Key
Go to developer.apple.com ā Certificates, Identifiers & Profiles
Under Keys, click + to create a new key
Give it any name, enable MusicKit, and click Continue ā Register
Download the
.p8file ā you can only download it once, keep it safe!Note your Key ID (e.g.
ABC123DEF4) and your Team ID (found under Membership Details)
ā ļø The Key ID is the alphanumeric code shown next to the key name ā not the filename of the
.p8file.
2. Clone and install
git clone https://github.com/Cifero74/mcp-apple-music
cd mcp-apple-music
# with uv (recommended)
uv sync
# or with pip
pip install -e .3. Run the one-time setup wizard
# with uv
uv run mcp-apple-music-setup
# or directly
python -m mcp_apple_music.setupThe wizard will ask for your Team ID, Key ID, and the path to your .p8 file. It then opens a browser page where you click "Authorise Apple Music" ā this uses Apple's official MusicKit JS to obtain your Music User Token, which is stored securely at ~/.config/mcp-apple-music/config.json (file permissions: 600).
4. Add to Claude Desktop
Open your Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"apple-music": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/mcp-apple-music",
"mcp-apple-music"
]
}
}
}Restart Claude Desktop ā you should see the apple-music tools available in the toolbar.
How it works
Apple Music requires two separate tokens:
Developer Token ā a JWT you sign locally with your
.p8private key. Valid up to 6 months; the server regenerates it automatically before expiry. Your key never leaves your machine.Music User Token ā obtained once via MusicKit JS OAuth in the browser (the setup wizard handles this). Stored locally at
~/.config/mcp-apple-music/config.json.
Your .p8 key āāāŗ Developer Token (JWT, auto-renewed) āā
āāāāŗ Apple Music API
Browser OAuth āāāŗ Music User Token (stored locally) āāā ļø Playback control (play/pause/skip) is not available via Apple's REST API. It requires native MusicKit frameworks (iOS/macOS app) or MusicKit JS running in a browser context.
For playback control, check out chrome-relay ā a companion CLI that lets an MCP server drive a
music.apple.comtab already open in Chrome, enabling play/pause/skip without shipping a MusicKit JS shim.
Project structure
mcp-apple-music/
āāā src/
ā āāā mcp_apple_music/
ā āāā __init__.py
ā āāā auth.py ā Developer Token generation + User Token management
ā āāā client.py ā Async HTTP client for api.music.apple.com
ā āāā server.py ā FastMCP server with all 14 tools
ā āāā setup.py ā One-time setup wizard (browser-based OAuth)
āāā config.example.json ā Example config structure (no secrets)
āāā pyproject.toml
āāā README.mdExample prompts
Once connected, you can ask Claude:
"What have I been listening to this week? Based on that, find 10 songs
I don't own yet that I'd probably enjoy and create a playlist with them."
"Search for all albums by Joni Mitchell and tell me which ones
I already have in my library."
"List my playlists, pick the one that looks most like a workout mix,
and add 5 high-energy songs from the catalog to it."
"Create a playlist called 'Rainy Sunday' with the 10 most mellow tracks
you can find from my library."Authors
Built by Cifero74 and Claude (Anthropic) as part of a personal MCP ecosystem for Claude Desktop.
This project was conceived, designed, debugged, and shipped entirely through a collaborative conversation between Mario and Claude ā from API research and auth flow design, through the setup wizard, to live testing with a real Apple Music library.
Contributions, issues and PRs are welcome!
License
MIT ā use it, fork it, build on it.
Available Tools
15 toolsadd_to_libraryA
Save Apple Music catalog songs, albums or playlists into the user's library.
Use this when the user wants to keep something found with search_catalog, get_playlist_tracks or get_recommendations. Saved playlists then appear in get_library_playlists.
Args: song_ids: Comma-separated catalog song IDs (numeric). album_ids: Comma-separated catalog album IDs (numeric). playlist_ids: Comma-separated catalog playlist IDs (start with 'pl.').
Inputs: song_ids, album_ids, playlist_ids. Returns: result
add_tracks_to_playlistA
Add tracks to an existing playlist.
Args: playlist_id: The target playlist ID (starts with 'p.'). track_ids: List of track IDs to add. track_type: 'library-songs' for tracks from your library (default), 'songs' for catalog tracks (from search_catalog or a catalog 'pl.' playlist).
Inputs: track_ids (required), playlist_id (required), track_type. Returns: result
create_playlistC
Create a new playlist in your Apple Music library.
Args: name: Name for the new playlist. description: Optional short description.
Inputs: name (required), description. Returns: result
favorite_songA
Mark a catalog song as favorite (the star in Apple Music).
Args: song_id: Catalog song ID (use search_catalog to find it).
Inputs: song_id (required). Returns: result
get_library_albumsA
List albums saved in your Apple Music library.
Args: limit: Number of albums to return, 1ā100 (default 25). offset: Pagination offset (default 0).
Inputs: limit, offset. Returns: result
get_library_artistsB
List artists in your Apple Music library.
Args: limit: Number of artists to return, 1ā100 (default 25). offset: Pagination offset (default 0).
Inputs: limit, offset. Returns: result
get_library_playlistsB
List all playlists in your Apple Music library.
Args: limit: Maximum number of playlists to return, 1ā100 (default 100).
Inputs: limit. Returns: result
get_library_songsA
List songs saved in your Apple Music library.
Args: limit: Number of songs to return, 1ā100 (default 25). offset: Pagination offset for retrieving subsequent pages (default 0).
Inputs: limit, offset. Returns: result
get_playlist_tracksA
Get the tracks inside a playlist: one of the user's own playlists, or an Apple Music catalog playlist (editorial, themed, curator playlists).
Apple Music returns at most 100 tracks per request. Use offset to page
through a large playlist, or set fetch_all=True to automatically fetch
every page (up to max_tracks).
Args: playlist_id: Library playlist ID (starts with 'p.', from get_library_playlists) or catalog playlist ID (starts with 'pl.', from search_catalog or get_recommendations). limit: Maximum tracks to return for a single page, 1ā100 (default 100). Ignored when fetch_all is True (always uses page size 100). offset: Pagination offset for single-page requests (default 0). Ignored when fetch_all is True. fetch_all: If True, follow pagination and return every track in the playlist (up to max_tracks). Default False. max_tracks: Safety cap when fetch_all is True, 1ā5000 (default 2000).
Inputs: playlist_id (required), limit, offset, fetch_all, +1 more. Returns: result
get_recently_playedA
Get your recently played albums, playlists, and stations.
Note: Apple Music API returns recently-played containers (albums, playlists, stations) rather than individual tracks.
Args: limit: Number of items to return, 1ā10 (default 10). The /me/recent/played endpoint rejects anything above 10.
Inputs: limit. Returns: result
get_recommendationsA
Get personalised Apple Music recommendations.
Args: limit: Number of recommendation groups to return, 1ā10 (default 5).
Inputs: limit. Returns: result
get_song_favorite_statusB
Check which catalog songs are marked as favorite.
Args: song_ids: Comma-separated catalog song IDs (e.g. "1276760751,123").
Inputs: song_ids (required). Returns: result
search_catalogA
Search all of Apple Music (not just the user's library) for songs, albums, artists and playlists.
Use this whenever the user asks for music that may not be in their library. For moods, genres, activities or eras (e.g. "relax", "workout", "jazz anni 60") search with types="playlists" to find Apple's themed playlists, then open one with get_playlist_tracks.
Args: query: Search term (e.g. "Radiohead", "Bohemian Rhapsody", "relax"). types: Comma-separated resource types to include. Options: songs, albums, artists, playlists (default: all four). limit: Results per type, 1ā25 (default 5).
Inputs: query (required), limit, types. Returns: result
search_libraryA
Search only what the user has saved in their Apple Music library.
To search all of Apple Music, use search_catalog instead.
Args: query: Search term. types: Comma-separated types. Options: library-songs, library-albums, library-artists, library-playlists limit: Results per type, 1ā25 (default 10).
Inputs: query (required), limit, types. Returns: result
unfavorite_songA
Remove a catalog song from favorites (clears its rating).
Args: song_id: Catalog song ID.
Inputs: song_id (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 15 tools
Catalog vs library search is explicitly distinguished, and most tools target clearly distinct resources (playlists, favorites, recommendations, recently played). Minor overlap remains between get_library_songs and search_library with types=library-songs, and the three "add" tools (add_to_library, add_tracks_to_playlist, favorite_song) require reading descriptions to separate.
All names are snake_case and verb-first (search_, get_, add_, create_, favorite_/unfavorite_), with predictable prefixes (get_library_* for library listings, get_playlist_tracks for contents). The pattern is uniform across all 15 tools.
15 tools sits comfortably in the well-scoped range for a music service covering catalog, library, playlists, favorites and recommendations. The four get_library_* tools are slightly repetitive but each maps to a distinct resource type.
Read/create paths are well covered, but destructive and detail operations are absent: no remove_tracks_from_playlist, delete_playlist, remove_from_library, and no way to list the tracks of a saved library album (only playlist tracks). These gaps create dead ends for common library-management workflows.
Maintenance
Related MCP Connectors
Run Apple Search Ads from Claude: performance, recommendations, keywords, budgets, launches.
Search, read, create and edit your Memol notes from Claude. Team note-taking with AI search.
Connect Claude to your Intervals.icu watch data for fitness, workout review, and plan writing.
Search and ask the podcasts you follow inside Claude, with the exact quote and timestamp.
Related MCP Servers
- FlicenseDqualityDmaintenanceEnables Claude to interact with Spotify by searching songs, creating playlists, getting recommendations, and managing your music through your Spotify account.73-
- AlicenseNot gradedqualityNot gradedmaintenanceConnects Claude to Spotify for music discovery, playlist creation, and collection analysis through natural language. Enables searching songs, analyzing music diversity, creating playlists, and getting recommendations using Spotify's API.-
- AlicenseAqualityDmaintenanceIntegrates Spotify with Claude to enable voice-controlled music playback, playlist management, and personalized recommendations through conversational AI. It provides comprehensive tools for searching tracks, managing liked songs, and analyzing listening habits.151MIT
- AlicenseNot gradedqualityDmaintenanceConnects Claude Code to Apple Music using only your Apple ID, without needing a developer account. Enables access to recently played, playlists, search, recommendations, and playlist creation.14 npmMIT