Integrates Apple Music with MCP clients to search and manage your library.
Apple Music MCP Server
An MCP (Model Context Protocol) server that integrates with Apple Music, allowing Claude and other MCP clients to search the catalog, manage playlists, and access your library.

Features
- Search the Apple Music catalog (songs, albums, artists, playlists)
- List your playlists and browse their tracks
- Create new playlists with optional initial tracks
- Add tracks to existing playlists
- Browse your library songs
- View recently played tracks
- Get personalized recommendations
Prerequisites
- Node.js 18+
- An Apple Developer Program membership
- A MusicKit identifier and private key
Apple Developer Setup
1. Create a MusicKit Identifier
- Go to Apple Developer > Certificates, Identifiers & Profiles
- Click + to register a new identifier
- Select MusicKit IDs (or Media IDs)
- Enter a description (e.g., "MCP Server") and an identifier (e.g.,
com.yourname.musicmcp) - Click Continue and Register
2. Create a MusicKit Private Key
- Go to Apple Developer > Keys
- Click + to create a new key
- Name it (e.g., "MusicKit MCP Key")
- Check MusicKit and configure it with your MusicKit identifier
- Click Continue and Register
- Download the .p8 file (you can only download it once!)
- Note the Key ID shown on the page
3. Find Your Team ID
Your Team ID is visible at the top right of the Apple Developer portal, or under Membership Details.
Installation
git clone <this-repo>
cd AppleMusicMCP
npm install
npm run build
Configuration
The server is configured via environment variables:
| Variable | Required | Description |
|---|---|---|
APPLE_MUSIC_TEAM_ID |
Yes | Your Apple Developer Team ID |
APPLE_MUSIC_KEY_ID |
Yes | Your MusicKit Key ID (from the key you created) |
APPLE_MUSIC_PRIVATE_KEY_PATH |
Yes | Absolute path to your .p8 private key file |
APPLE_MUSIC_STOREFRONT |
No | ISO 3166 alpha-2 country code (default: us) |
APPLE_MUSIC_CONFIG_DIR |
No | Config directory path (default: ~/.apple-music-mcp/) |
APPLE_MUSIC_AUTH_PORT |
No | Port for auth server (default: 7829) |
Authorization
Before using library features (playlists, library songs, recommendations), you need to authorize with your Apple Music account:
APPLE_MUSIC_TEAM_ID=YOUR_TEAM_ID \
APPLE_MUSIC_KEY_ID=YOUR_KEY_ID \
APPLE_MUSIC_PRIVATE_KEY_PATH=/path/to/AuthKey.p8 \
node dist/index.js auth
This will:
- Open your browser to a local authorization page
- You click "Authorize with Apple Music" and sign in with your Apple ID
- The Music User Token is captured and stored in
~/.apple-music-mcp/tokens.json - The token is valid for approximately 6 months
Note: Catalog search works without authorization. Only library/personal features require it.
Adding to Claude Desktop
Add this to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"apple-music": {
"command": "node",
"args": ["/absolute/path/to/AppleMusicMCP/dist/index.js"],
"env": {
"APPLE_MUSIC_TEAM_ID": "YOUR_TEAM_ID",
"APPLE_MUSIC_KEY_ID": "YOUR_KEY_ID",
"APPLE_MUSIC_PRIVATE_KEY_PATH": "/absolute/path/to/AuthKey_XXXXXXXX.p8",
"APPLE_MUSIC_STOREFRONT": "us"
}
}
}
}
Adding to Claude Code
Add to your Claude Code settings (.claude/settings.json or global settings):
{
"mcpServers": {
"apple-music": {
"command": "node",
"args": ["/absolute/path/to/AppleMusicMCP/dist/index.js"],
"env": {
"APPLE_MUSIC_TEAM_ID": "YOUR_TEAM_ID",
"APPLE_MUSIC_KEY_ID": "YOUR_KEY_ID",
"APPLE_MUSIC_PRIVATE_KEY_PATH": "/absolute/path/to/AuthKey_XXXXXXXX.p8"
}
}
}
}
Available Tools
`search_music`
Search the Apple Music catalog.
query(string, required): Search termtypes(array, optional):["songs", "albums", "artists", "playlists"](default: songs, albums, artists)limit(number, optional): 1-25 results per type (default: 10)storefront(string, optional): Country code
`get_user_playlists`
List your playlists.
limit(number, optional): 1-100 (default: 25)offset(number, optional): Pagination offset
`get_playlist_tracks`
Get tracks from a playlist.
playlist_id(string, required): Playlist IDlimit(number, optional): 1-100 (default: 100)offset(number, optional): Pagination offset
`create_playlist`
Create a new playlist.
name(string, required): Playlist namedescription(string, optional): Playlist descriptiontrack_ids(string[], optional): Song IDs to a
Tools (4)
search_musicSearch the Apple Music catalog for songs, albums, artists, or playlists.get_user_playlistsList your personal Apple Music playlists.get_playlist_tracksRetrieve the list of tracks from a specific Apple Music playlist.create_playlistCreate a new playlist in your Apple Music library.Environment Variables
APPLE_MUSIC_TEAM_IDrequiredYour Apple Developer Team IDAPPLE_MUSIC_KEY_IDrequiredYour MusicKit Key IDAPPLE_MUSIC_PRIVATE_KEY_PATHrequiredAbsolute path to your .p8 private key fileAPPLE_MUSIC_STOREFRONTISO 3166 alpha-2 country codeAPPLE_MUSIC_CONFIG_DIRConfig directory pathAPPLE_MUSIC_AUTH_PORTPort for auth serverConfiguration
{"mcpServers": {"apple-music": {"command": "node", "args": ["/absolute/path/to/AppleMusicMCP/dist/index.js"], "env": {"APPLE_MUSIC_TEAM_ID": "YOUR_TEAM_ID", "APPLE_MUSIC_KEY_ID": "YOUR_KEY_ID", "APPLE_MUSIC_PRIVATE_KEY_PATH": "/absolute/path/to/AuthKey_XXXXXXXX.p8", "APPLE_MUSIC_STOREFRONT": "us"}}}}