spotify-mcp is an MCP server for Spotify, used to control Spotify from Claude, Cursor, or any MCP client. The project provides 100+ tools, covering playback, playlists, discovery, and curation features.
Purpose It connects Spotify's operational capabilities to AI clients that support MCP, allowing users to complete playback control, search, playlist management, and music library organization using natural language. You can get started quickly with uvx spotify-mcp.
Main capabilities The tools cover playback, search, playlist management, smart shuffle, mood analysis, natural language song search, artist exploration, and music library indexing. Example requests you can make include: play a certain song, make a playlist gradually rise from soothing to high energy, find songs by description, view how your music taste changes over time, map the network of related artists for an artist, compare two playlists, clean up unavailable tracks and duplicates from old playlists, analyze playlist mood, create a radio playlist based on an artist, view the time periods when you listen to the most songs.
Toolsets and safety mechanisms All tools are loaded by default, except destructive tools. For clients with a tool count limit, you can select toolsets via --toolsets, or set it via the environment variable SPOTIFY_MCP_TOOLSETS=core,power. Available toolsets include core, social, discovery, power, destructive, all. Destructive tools (removing tracks, unfollowing artists, deleting content) are loaded only after actively enabling them with --toolsets=all,destructive, so they are suitable for auto-accept mode because the AI cannot call tools that do not exist. The affected destructive tools include spotify_remove_from_playlist, spotify_remove_saved_tracks, spotify_remove_saved_albums, spotify_remove_saved_shows, spotify_unfollow_playlist, spotify_unfollow_artists, spotify_unfollow_users. Even when enabled, destructive tools default to dry_run=True, showing a preview first without executing; the operation is performed only when dry_run=False is passed.
Music library indexing You can sync your Spotify music library to a local index, then let the AI create playlists from existing songs, instead of randomly selecting tracks from the catalog. For example, if you request "create a playlist from my favorite indie rock songs this year," the AI will check music library statistics, select matching artists, query by date range, and build a playlist from existing songs. Data is stored in %LOCALAPPDATA%\spotify-mcp\library.json on Windows or ~/.cache/spotify-mcp/library.json on Linux/Mac. Only playlists you created are synced.
How to use Installation and configuration:
- Get a Spotify Client ID: go to the Spotify Developer Dashboard to create an app, and set the redirect URI to http://127.0.0.1:8888/callback,勾选 Web API and copy the Client ID. No client secret is needed (PKCE authentication is used).
- Installation and configuration: Claude Code with one command: claude mcp add spotify -e SPOTIFY_CLIENT_ID=your_client_id -- uvx spotify-mcp; for Claude Desktop, add it to claude_desktop_config.json; Cursor / VS Code use the same configuration, but only load the core tools to stay under the 40-tool limit. You can also install it with pip install spotify-mcp. The first time you use the Spotify tools, a browser will open for OAuth authorization; after granting access, the token is cached locally. Environment variables (recommended): set SPOTIFY_CLIENT_ID in the env field of the MCP client configuration, and optionally set SPOTIFY_CLIENT_SECRET. Interactive setup: guides you through credential configuration and saves it to ~/.config/spotify-mcp/.env on Linux/Mac or %APPDATA%\spotify-mcp.env on Windows. Manual .env file: create a .env in ~/.config/spotify-mcp/ (%APPDATA%\spotify-mcp\ on Windows), and if you prefer traditional OAuth over PKCE, you can add SPOTIFY_CLIENT_SECRET=your_secret. Finding Spotify IDs: most tools accept an ID, URI, or URL. You can first use spotify_search to find by name; right-click an item in Spotify -> Share -> Copy Spotify URI; extract it from the URL:https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC -> 4uLU6hMCjMI75M1A2tKUQC.
Use cases Suitable for users and developers who want to control Spotify with natural language through an AI client, organize playlists, explore artist relationships, and analyze listening habits.
Limitations and notes Spotify removed several endpoints in February 2026: audio-features, audio-analysis, recommendations, artist/top-tracks, all batch endpoints, and browse/categories. Search is capped at 10 results per page. Most Spotify MCP servers have therefore stopped working. This project is built around these limitations: discovery uses search + related artists + genre mapping instead of the old recommendations API; the mood engine estimates energy from genre data instead of audio-features. It is not perfect, but it works. Troubleshooting:
- "No active device found": open Spotify on any device before using playback commands.
- OAuth redirect failure: make sure the redirect URI exactly matches the Spotify Developer Dashboard. Default:http://127.0.0.1:8888/callback(不是 https).
- Token expired or corrupted: delete .spotify_token_cache under ~/.cache/spotify-mcp/ (or %LOCALAPPDATA%\spotify-mcp), then restart.
- Premium-only features: volume, skip, transfer, shuffle, and repeat require Spotify Premium. For development-related information, see CONTRIBUTING.md.