Skip to main content
Glama
mcp-apple-music

mcp-apple-music

by Cifero74

mcp-apple-music šŸŽµ

mcp-name: io.github.Cifero74/mcp-apple-music

Python 3.10+ License: MIT MCP

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_catalog

Search Apple Music catalog (songs, albums, artists, playlists)

search_library

Search within your personal library

get_library_songs

List songs saved in your library (paginated)

get_library_albums

List albums in your library (paginated)

get_library_artists

List artists in your library

get_library_playlists

List all your playlists with IDs

get_playlist_tracks

Get tracks inside one of your playlists or an Apple Music catalog playlist (pl. IDs)

create_playlist

Create a new playlist

add_tracks_to_playlist

Add songs to a playlist (library or catalog tracks)

add_to_library

Save catalog songs, albums or playlists into your library

get_recently_played

See recently played albums/playlists/stations

get_recommendations

Get personalised Apple Music picks

favorite_song

Mark a catalog song as favorite (star)

unfavorite_song

Remove a catalog song from favorites

get_song_favorite_status

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

  1. Go to developer.apple.com → Certificates, Identifiers & Profiles

  2. Under Keys, click + to create a new key

  3. Give it any name, enable MusicKit, and click Continue → Register

  4. Download the .p8 file — you can only download it once, keep it safe!

  5. 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 .p8 file.

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.setup

The 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 .p8 private 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.com tab 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.md

Example 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 tools
add_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

    A3.7/5.0

    Scored across 15 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness3/5

    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

    ActivityMaintained
    ResponsivenessMixed handling

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Connects 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.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Integrates 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.
      15
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects 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 npm
      MIT