spotify-mcp
This MCP server lets an AI agent control Spotify — playback, search, queue, library, and playlists via the Spotify Web API.
Playback Control: Get current track info, start/resume playback, pause, skip tracks (with optional number of skips), go to the previous track, seek to a specific position, and set playback volume.
Search: Find tracks, albums, artists, or playlists with configurable result type and limit.
Queue Management: View the current playback queue or add a specific track to the queue.
Item Details: Retrieve detailed information about a track, album, artist, or playlist by URI (artist info includes albums and top tracks; albums/playlists include their tracks).
Library Management: List liked/saved tracks, save tracks to, or remove tracks from the library.
Playlist Management: List playlists, create new playlists, add or remove tracks, and delete (unfollow) playlists.
Allows controlling Spotify playback (start, pause, skip), searching for tracks/albums/artists/playlists, retrieving detailed info about music entities, and managing the Spotify queue.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@spotify-mcpplay my Discover Weekly playlist"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
spotify-mcp
An MCP (Model Context Protocol) server that lets an AI agent such as Claude control Spotify — playback, search, queue, library, and playlists — through the Spotify Web API. Built on spotipy.
Table of Contents
Related MCP server: Spotify MCP Server
Overview
spotify-mcp exposes Spotify as a set of MCP tools so that an agent can start and control playback, search the catalog, manage the queue, curate your saved tracks, and build playlists on your behalf. It runs locally over stdio and talks to Spotify using your own developer credentials.
The server is organized into small, single-responsibility modules and authenticates lazily: it starts without contacting Spotify and only builds an authenticated client the first time a tool is actually called. A separate CLI command handles the one-time OAuth authorization, so the server itself never needs an interactive browser flow.
This is a personal, actively-maintained fork of varunneal/spotify-mcp.
Features
Playback control: start, pause, skip, previous, seek, and set volume
Search for tracks, albums, artists, and playlists
Get detailed info about a track, album, artist, or playlist
Manage the playback queue (add, get)
Manage your library: list, save, and remove liked tracks
Manage playlists: list, create, add/remove tracks, and delete
Lazy authentication with a dedicated
spotify-mcp-authCLI for first-time login
Available tools
The server exposes six domain-grouped tools. Most take an action argument.
Tool | Actions | Notes |
|
|
|
|
|
|
| — |
|
| — |
|
|
|
|
|
|
|
Playback and queue actions target the active Spotify device and require Premium. Search, get-info, library, and playlist management work without an open device.
Demo
Make sure to turn on audio.
Getting started
Prerequisites
Python 3.12 or newer
uv (recommended
>= 0.54)A Spotify account. Spotify Premium is required for playback control (search, library, and playlist management work without Premium).
A Spotify developer application (see below)
Create a Spotify app
Sign in at developer.spotify.com/dashboard and create an app.
Set the redirect URI to
http://127.0.0.1:8888. You may choose any port, but Spotify now requires the loopback IP127.0.0.1for HTTP redirects —localhostis rejected as insecure.Under the app's API settings, enable Web API.
While the app is in Development Mode, add the Spotify account you will authorize with under User Management. Accounts that are not on this list are rejected during authorization with a
server_error.Copy the Client ID and Client Secret.
Install and register the server
Clone the repository:
git clone https://github.com/chienchuanw/spotify-mcp.gitRegister it as an MCP server in your client. For the Claude desktop app, edit the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%/Claude/claude_desktop_config.json
"spotify": {
"command": "uv",
"args": [
"--directory",
"/path/to/spotify-mcp",
"run",
"spotify-mcp"
],
"env": {
"SPOTIFY_CLIENT_ID": "YOUR_CLIENT_ID",
"SPOTIFY_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:8888"
}
}Configuration
The server reads three variables, from the MCP client env block above or from a .env file in the project root:
Variable | Required | Description |
| yes | Client ID from your Spotify app |
| yes | Client Secret from your Spotify app |
| yes | Must exactly match the redirect URI configured in the dashboard, e.g. |
Example .env:
SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
SPOTIFY_REDIRECT_URI=http://127.0.0.1:8888First-time authorization
Because the MCP server communicates over stdio, it cannot run the interactive OAuth flow itself. Authorize once with the bundled CLI, which opens your browser and captures the redirect on a local server:
uv --directory /path/to/spotify-mcp run spotify-mcp-authThis caches an access/refresh token. The server then reads that cached token and refreshes it automatically. Re-run spotify-mcp-auth only if you revoke access or change scopes. If your account is not on the app's allowlist, the command prints guidance on how to fix it instead of a traceback.
Project structure
src/spotify_mcp/
__init__.py entry points: main() (server) and auth_main() (auth CLI)
server.py MCP wiring — list_tools / call_tool dispatch to the registry
tools.py tool schemas (Pydantic) + per-domain handlers + registry
client.py SpotifyClient facade over spotipy + the @validate decorator
parsers.py pure functions that narrow Spotify's verbose JSON
auth.py OAuth config, SCOPES, lazy get_client() factory, auth CLI
errors.py exception -> user-facing message formatting
tests/ pytest suite, mocks spotipy (no network, no credentials)
docs/ design spec, implementation plan, and session status filesKey design points:
Lazy auth — the Spotify client is built on first use via
get_client(), never at import time, so the server starts without credentials and only touches Spotify when a tool is called.@validate— decorates playback/queue methods to refresh the token if expired and inject a candidate device when none is active. Catalog, library, and playlist calls are intentionally undecorated because they need no device.Layered boundaries —
serverknows nothing of Spotify,toolshandlers know nothing of the MCP session, andclientknows nothing of MCP types. Each layer is unit-testable in isolation.
Development
Install dependencies (including the dev group) and run the test suite:
uv sync
uv run pytestThe tests mock spotipy and never touch the real Spotify API, so no credentials are needed to run them.
You can also inspect the server interactively with the MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /path/to/spotify-mcp run spotify-mcpTroubleshooting
Make sure
uvis up to date (>= 0.54recommended).Ensure the client has execution permissions for the project:
chmod -R 755 /path/to/spotify-mcp.Playback control requires Spotify Premium and an active device — open Spotify (desktop app, phone app, or the web player at open.spotify.com) and start playing so a device is available.
redirect_uri: insecureduring authorization means you are usinglocalhost; switch both the dashboard andSPOTIFY_REDIRECT_URItohttp://127.0.0.1:8888.server_error/access_deniedduring authorization usually means your account is not on the app's User Management allowlist while the app is in Development Mode.The server logs to stderr per the MCP spec. On macOS, the Claude desktop app writes these to
~/Library/Logs/Claude. See the MCP logging docs for other platforms.
Contributing
Contributions are welcome. Fork the repository, create a feature branch off dev, run the test suite (uv run pytest), and open a pull request against dev.
Deprecated Spotify recommendation endpoints are out of scope. Possible future work includes paginated search/playlist/album results and a deployment story for ephemeral (uvx) usage.
License
Released under the MIT License. This project is derived from the original spotify-mcp by Varun Srivastava, also MIT-licensed; the original copyright notice is retained in the LICENSE file.
Available Tools
6 toolsSpotifyGetInfoC
Get detailed info about a Spotify item (track, album, artist, or playlist).
| Name | Required | Description | Default |
|---|---|---|---|
| item_uri | Yes | URI like 'spotify:track:...'. artist->albums+top tracks; album/playlist->tracks. |
SpotifyLibraryB
Manage saved (liked) tracks. - get_liked: list saved tracks. - save / remove: add or remove track_ids from the library.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max items for 'get_liked'. | |
| action | Yes | 'get_liked', 'save', or 'remove'. | |
| track_ids | No | Track IDs for 'save'/'remove'. |
SpotifyPlaybackA
Manage playback: get current track, start/resume, pause, skip, previous, seek, set volume. - get: info about the current track. - start: play spotify_uri, or resume if omitted. - pause / skip / previous. - seek: jump to position_ms. - volume: set volume_percent (0-100).
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | One of: get, start, pause, skip, previous, seek, volume. | |
| num_skips | No | Number of tracks to skip for 'skip'. | |
| position_ms | No | Target position for 'seek', in ms. | |
| spotify_uri | No | URI for 'start'. If omitted, resumes. | |
| volume_percent | No | Volume 0-100 for 'volume'. |
SpotifyPlaylistA
Manage playlists. - list: the current user's playlists. - create: make a new playlist (name required). - add_tracks / remove_tracks: modify a playlist's items (playlist_id + track_ids required). - delete: remove a playlist from your library (playlist_id required). Spotify has no hard delete; this unfollows it, which removes owned playlists from your view.
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name for 'create'. | |
| action | Yes | 'list', 'create', 'add_tracks', 'remove_tracks', or 'delete'. | |
| public | No | Whether a created playlist is public. | |
| track_ids | No | Track IDs for add/remove. | |
| description | No | Description for 'create'. | |
| playlist_id | No | Playlist ID for add/remove. |
SpotifyQueueB
Manage the playback queue - get the queue or add a track.
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | 'add' or 'get'. | |
| track_id | No | Track ID to add (required for 'add'). |
SpotifySearchC
Search for tracks, albums, artists, or playlists on Spotify.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max number of items to return. | |
| qtype | No | track, album, artist, playlist, or comma-separated. | track |
| query | Yes | query term |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.3.0- Changed
SpotifyGetInfo2 fields changed- changed
Input schema / descriptionPrevious value: -"Get detailed information about a Spotify item (track, album, artist, or playlist)."New value: +"Get detailed info about a Spotify item (track, album, artist, or playlist)." - changed
Input schema / properties / item_uri / descriptionPrevious value: -"URI of the item to get information about. If 'playlist' or 'album', returns its tracks. If 'artist', returns albums and top tracks."New value: +"URI like 'spotify:track:...'. artist->albums+top tracks; album/playlist->tracks."
- Added
SpotifyLibrary - Changed
SpotifyPlayback6 fields changed- changed
Input schema / descriptionPrevious value: -"Manages the current playback with the following actions:\n- get: Get information about user's current track.\n- start: Starts playing new item or resumes current playback if called with no uri.\n- pause: Pauses current playback.\n- skip: Skips current track."New value: +"Manage playback: get current track, start/resume, pause, skip, previous, seek, set volume.\n- get: info about the current track.\n- start: play spotify_uri, or resume if omitted.\n- pause / skip / previous.\n- seek: jump to position_ms.\n- volume: set volume_percent (0-100)." - changed
Input schema / properties / action / descriptionPrevious value: -"Action to perform: 'get', 'start', 'pause' or 'skip'."New value: +"One of: get, start, pause, skip, previous, seek, volume." - changed
Input schema / properties / num_skips / descriptionPrevious value: -"Number of tracks to skip for `skip` action."New value: +"Number of tracks to skip for 'skip'." - added
Input schema / properties / position_msAdded value: +{ + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Target position for 'seek', in ms.", + "title": "Position Ms" +} - changed
Input schema / properties / spotify_uri / descriptionPrevious value: -"Spotify uri of item to play for 'start' action. If omitted, resumes current playback."New value: +"URI for 'start'. If omitted, resumes." - added
Input schema / properties / volume_percentAdded value: +{ + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Volume 0-100 for 'volume'.", + "title": "Volume Percent" +}
- Added
SpotifyPlaylist - Changed
SpotifyQueue3 fields changed- changed
Input schema / descriptionPrevious value: -"Manage the playback queue - get the queue or add tracks."New value: +"Manage the playback queue - get the queue or add a track." - changed
Input schema / properties / action / descriptionPrevious value: -"Action to perform: 'add' or 'get'."New value: +"'add' or 'get'." - changed
Input schema / properties / track_id / descriptionPrevious value: -"Track ID to add to queue (required for add action)"New value: +"Track ID to add (required for 'add')."
- Changed
SpotifySearch2 fields changed- changed
Input schema / properties / limit / descriptionPrevious value: -"Maximum number of items to return"New value: +"Max number of items to return." - changed
Input schema / properties / qtype / descriptionPrevious value: -"Type of items to search for (track, album, artist, playlist, or comma-separated combination)"New value: +"track, album, artist, playlist, or comma-separated."
4 tool updates
v0.2.0- First observed
SpotifyGetInfo - First observed
SpotifyPlayback - First observed
SpotifyQueue - First observed
SpotifySearch
TDQS
Scored across 6 tools
Each tool targets a distinct area of Spotify: info retrieval, library management, playback, playlists, queue, and search. No overlap in functionality.
All tool names follow a consistent PascalCase pattern with the prefix 'Spotify' and a noun indicating the function (e.g., SpotifyGetInfo, SpotifyPlayback).
With 6 tools, the server is well-scoped, covering the core Spotify operations without being too sparse or overloaded.
The tool set covers essential operations like search, get info, library, playlists, playback, and queue. Minor gaps such as editing playlist details or recommendations are missing, but core workflows are complete.
Maintenance
Related MCP Connectors
Full Spotify Web API coverage - albums, artists, playlists, player controls, and more.
Generate AI music via the Lacuna Music API from MCP clients like Claude Desktop & Code.
Spotify: Spotify Data API for Millions of songs & podcasts, artists, albums, playlists and more.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseBqualityBmaintenanceConnects Claude with Spotify, allowing users to control playback, search for content, get music information, and manage the Spotify queue.48365 PyPI12MIT
- FlicenseNot gradedqualityDmaintenanceConnects Claude with Spotify to control playback, search music, get track information, and manage the queue through conversation.1-
- FlicenseAqualityDmaintenanceConnects Claude with Spotify, allowing users to control playback, search for music, get track/artist information, and manage the queue via the Spotify API.51-
- FlicenseDqualityDmaintenanceEnables Claude to interact with Spotify by searching songs, creating playlists, getting recommendations, and managing your music through your Spotify account.73-