MCP Server for Apple Music โ search, library, playlist management via Claude
Project description
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_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 a specific playlist |
create_playlist |
Create a new playlist |
add_tracks_to_playlist |
Add songs to a playlist (library or catalog tracks) |
get_recently_played |
See recently played albums/playlists/stations |
get_recommendations |
Get personalised Apple Music picks |
Requirements
- Python 3.10+
- uv (recommended) or pip
- An Apple Developer account (free tier is fine) with a MusicKit key
- 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/marioinghilleri/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
.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.
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 11 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_apple_music_server-1.0.0.tar.gz.
File metadata
- Download URL: mcp_apple_music_server-1.0.0.tar.gz
- Upload date:
- Size: 59.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0d81369e5a10b2dde293e8af2c3fe1730dcf2e74408b89552bcb489ef256e9
|
|
| MD5 |
3d418e466760ec4cc4f2a9ca220ad774
|
|
| BLAKE2b-256 |
05d766e7caaec4d9deff3dacf1dfe3c03a64d1953d9cb3a797ef932e4b88a3cf
|
File details
Details for the file mcp_apple_music_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mcp_apple_music_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce7d7ade883714493dd7ccefde9cbd5110bac2d26e6bfdff449bab52c2efd294
|
|
| MD5 |
fcf8f4cbd1d444a15387334dbd11023c
|
|
| BLAKE2b-256 |
d27a11aa91dafd423599dc657e18c7379d4268a273453db655c30587b2306ec2
|