mcp-apple-music
Full Apple Music integration for Claude: search the catalog, browse your personal library, manage playlists, and get personalised recommendations.
README
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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.