Skip to main content
Glama
@apple-music-agent/mcp-server

@apple-music-agent/mcp-server

🍎 Apple Music Agent

English | 简体中文

CI npm version License: MIT

Zero-developer-account open-source Apple Music AI assistant — an MCP Server, Agent Skill, and local-only Manifest V3 Chrome Extension powered by the Apple Music Web Player API (amp-api.music.apple.com).

Control your Apple Music catalog, library, playlists, favorites, cross-platform migrations, and AI recommendations in plain natural language from Claude Desktop, Claude Code, Cursor, Antigravity, or any MCP-compatible AI agent — without paying $99/year for an Apple Developer account.


WARNING

Disclaimer: This project is strictly for personal learning and self-hosted productivity. It communicates with Apple Music's unofficial Web Player API (amp-api.music.apple.com), is not affiliated with or endorsed by Apple Inc., and may break if Apple changes internal endpoints. All credentials remain 100% on your local machine. Do NOT publish the bundled token-capture Chrome extension to the Chrome Web Store or any public extension marketplace.


30-Second Quickstart

Requires Node.js >= 20 and an Apple Music subscription.

# Claude Code — one line, no clone needed
claude mcp add apple-music -- npx -y @apple-music-agent/mcp-server

Claude Desktop / Cursor / Antigravity — add to your MCP config and restart the client:

{
  "mcpServers": {
    "apple-music": {
      "command": "npx",
      "args": ["-y", "@apple-music-agent/mcp-server"]
    }
  }
}

Then sign in at music.apple.com and load the Chrome extension (see Auth setup below) — it syncs your session tokens automatically. That's it: try "List my Apple Music playlists" or "Move my NetEase playlist 'Running' into Apple Music".

Install from source instead? git clone https://github.com/zuoherry66-boop/apple-music-agent.git && cd apple-music-agent && npm install && npm run build, then point your MCP config at packages/mcp-server/dist/index.js (see Development).

Related MCP server: applemusic-mcp

Demo

Demo walkthrough (video coming soon): in one sentence, ask the agent to migrate a NetEase Cloud Music playlist into Apple Music — it parses the playlist, matches each track against Apple's catalog (ISRC-first), and creates the playlist with a match report. Then ask it to delete a song: instead of deleting immediately, it shows a dry-run preview and waits for your explicit confirmation before anything is removed.

Features

Feature

What it does

Zero Developer Account Cost

Reuses your own local music.apple.com web session tokens (Authorization Bearer + Music-User-Token) with automatic storefront region detection (cn, us, jp, etc.)

14 Strict-Typed MCP Tools

Catalog search (keyword + ISRC), library & playlist reading, recently played history, playlist creation, library/playlist additions, Favorites/Ratings, cross-platform import, safe deletion

Mandatory Anti-Accident Protection

remove_from_playlist and remove_from_library enforce Two-Step Confirmation — confirm: false returns a dry-run preview and a single-use, payload-bound confirmation_token (5-minute TTL); nothing is deleted until you confirm the exact track list

Smart Cross-Platform Migration

Built-in CSV / JSON / plain-text parser (Spotify, NetEase Cloud Music, QQ Music), marketing-noise title cleaner, version detector (Studio Original vs. Live / Remix / Cover / Instrumental), ISRC-first scorer, deduplicator

Privacy-First MV3 Extension

Captures headers locally via read-only webRequest.onSendHeaders, never transmits tokens to external servers; supports Copy .env, Download auth.json, or one-time 127.0.0.1 pairing sync

Ready-to-Use Agent Skill

skills/apple-music-manager/SKILL.md defines standard operating workflows for playlist migration, playability-verified AI curation, and safe library cleanup

Comparison

Honest comparison with the closest alternative, epheterson/applemusic-mcp (Python, 140 stars). Pick whichever fits your setup — the table states what each project actually does.

apple-music-agent (this project)

epheterson/applemusic-mcp

Install

npx -y @apple-music-agent/mcp-server

pipx install applemusic-mcp

Apple Developer account

Never needed (web session tokens)

Not needed on macOS; needed for API mode on Windows/Linux

Playback control

✗ Not possible via the amp-api REST interface

✓ Via Mac Music.app or web player

Engines

1 (Apple Music web API, any OS)

4 (Music.app, API, Safari/Chrome web player, full)

Token sync

✓ Chrome extension auto-syncs on every music.apple.com visit

Manual applemusic-mcp login

Cross-platform migration

✓ Built-in parsers for Spotify / NetEase / QQ Music

Playlist import only, no built-in source parsers

Delete safety

✓ Mandatory two-step confirmation + dry-run preview

No equivalent confirmation flow

Agent Skill

✓ Bundled skills/apple-music-manager/SKILL.md

✗

Language

TypeScript

Python

Architecture

flowchart LR
    EXT["MV3 Chrome Extension\n(Local Header Capture)"] -.->|"Copy / Download / 127.0.0.1 Sync"| AUTH["~/.config/apple-music-agent/auth.json"]
    SKILL["Agent Skill\n(SKILL.md)"] --> AGENT["AI Agent\n(Claude / Cursor / Antigravity)"]
    AGENT <-->|"MCP (stdio)"| MCP["@apple-music-agent/mcp-server"]
    MCP --> CORE["@apple-music-agent/core\n(Client / Matching / Safety)"]
    AUTH --> CORE
    CORE <-->|"HTTPS"| AMP["amp-api.music.apple.com"]

See docs/architecture.md for sequence diagrams and verified amp-api endpoint mappings.

Auth & Chrome Extension

While running, the MCP server listens on 127.0.0.1:48123 (strictly allowing only chrome-extension:// origins with a custom preflight header; set APPLE_MUSIC_DISABLE_LOCAL_SYNC=1 to disable) and reloads ~/.config/apple-music-agent/auth.json dynamically on every request.

Load packages/chrome-extension/dist as an unpacked extension in chrome://extensions (Developer mode ON):

  1. Open https://music.apple.com and sign in.

  2. Browse your library briefly — the extension captures your headers and silently auto-syncs them to ~/.config/apple-music-agent/auth.json (badge turns green OK). No terminal commands or pairing codes required!

  3. Whenever tokens expire in the future, simply refresh https://music.apple.com and they refresh automatically.

(Prefer manual export? Click Download auth.json or Copy .env in the popup, or follow docs/auth-setup.md.)

Copy or symlink skills/apple-music-manager into your agent's skills directory (e.g., ~/.agents/skills/apple-music-manager or .claude/skills/apple-music-manager) so your AI automatically follows the migration, recommendation, and safe-deletion SOPs.

Available MCP Tools

Tool

Description

check_auth_status

Verify credentials and detect active Apple Music storefront (cn/us/jp, etc.)

search_catalog

Search catalog by keyword or batch ISRCs (songs, albums, artists) with playability flag

get_library_playlists

List user's library playlists (paginated)

get_playlist_tracks

Read playlist tracks (paginated) with optional duplicate analysis

get_library_songs

List user's library songs (paginated)

get_recently_played

Fetch recently played tracks for taste profiling

create_playlist

Create a new library playlist with optional initial tracks

add_to_library

Add catalog songs, albums, or playlists to library

add_to_playlist

Append songs to an editable library playlist

set_favorite

Mark Favorite (POST /v1/me/favorites), Dislike (-1), or Clear rating

remove_from_playlist

Remove tracks from playlist (Two-Step Confirmation required)

remove_from_library

Delete songs from library (Two-Step Confirmation required)

import_playlist_preview

Parse CSV/JSON/text playlist, clean titles, and classify matches into 3 buckets

import_playlist_execute

Create or append confirmed catalog tracks with deduplication

Development & Testing

npm run lint        # ESLint across all packages
npm run typecheck   # TypeScript strict check
npm run build       # Build core, mcp-server, and chrome-extension
npm test            # Vitest unit tests (cleaner, scorer, dedup, parsers, confirmation, mocked API)

Troubleshooting

  • AUTH_EXPIRED (HTTP 401 / 403): Apple Music web tokens expire periodically. Reopen https://music.apple.com, ensure you are signed in, and re-sync with the Chrome extension. No MCP restart is needed.

  • RATE_LIMITED (HTTP 429): The client automatically retries with exponential backoff (respecting Retry-After). For very large playlists (200+ songs), split imports into batches of ~100 tracks.

  • Track marked unavailable_in_storefront: The song exists in Apple's catalog metadata, but lacks playParams in your account's storefront due to regional licensing.

  • Deleting a song from library removed it from playlists: This is standard Apple Music behavior. remove_from_library always warns about this during dry-run preview.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients to search the catalog, manage playlists, folders, and library items, and control playback, ratings, and the Up Next queue across macOS, Windows, and Linux. It selects among native Music.app, Safari, Chrome, and web API engines so an assistant can drive Apple Music with or without a subscription.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients to search and browse the Apple Music catalog, manage library items, ratings, favorites and playlists with nested folders, and control playback, volume, shuffle, repeat and the Up Next queue. Runs via native Music.app, Safari, Chrome, or the Apple Music web API, so it works on macOS, Windows and Linux with just a Mac or an Apple Music subscription.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Lets any MCP client search and browse the Apple Music catalog, manage library items, playlists and folders, and control playback and the Up Next queue through natural language. It works across macOS, Windows and Linux by picking among native Music.app, Safari, Chrome and the Apple Music API engines, needing only a Mac or an Apple Music subscription.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients to manage Apple Music playlists, library, catalog, discovery, playback, and the Up Next queue across macOS, Windows, and Linux using native Music.app, the Apple Music API, Safari, or Chrome engines.
      -