Spotify MCP
Provides tools for searching tracks, controlling playback (play, pause, skip), retrieving currently playing content, creating playlists, and adding songs to playlists via the Spotify API.
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 MCP search for 'Blinding Lights' by The Weeknd"
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
A minimal FastMCP server for Spotify with Authorization Code + PKCE auth.
Features
Search Spotify tracks with
search_songControl playback with
play,pause,skip_forward, andskip_backwardsRead currently playing content with
get_currently_playingCreate playlists with
create_playlistAdd songs to playlists with
add_songs_to_playlistBuild vibe playlists with
create_vibe_playlistPKCE login flow with local loopback callback
Tokens stored in the OS keyring
Automatic access-token refresh
Related MCP server: Spotify MCP Server
Prerequisites
Python 3.10+
A Spotify Developer app: Spotify Developer Dashboard
Spotify App Setup
Create an app in the Spotify Developer Dashboard.
Add this redirect URI:
http://127.0.0.1:8888/callback
Do not use
http://localhost.Copy your Client ID.
Local Setup
python -m venv .venv
.venv\Scripts\activate
pip install -e .
copy .env.example .envEdit .env:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_REDIRECT_URI=http://127.0.0.1:8888/callbackLogin (PKCE)
Run once before using the MCP tools:
python -m spotify_mcp.auth loginThis opens your browser, completes Spotify authorization, and stores tokens in your OS keyring.
By default, login requests the minimum scopes needed by the current tools:
user-read-currently-playinguser-modify-playback-stateplaylist-modify-privateplaylist-modify-public
If you logged in before playback or playlist tools were added, run login again so Spotify grants the new scopes.
If login times out waiting for the callback:
Make sure the Spotify Developer Dashboard has the exact redirect URI
http://127.0.0.1:8888/callback.Complete the authorization page in the browser before the timeout.
Keep the terminal running until Spotify redirects back to
127.0.0.1.If you need more time, run
python -m spotify_mcp.auth login --timeout 600.
To remove stored tokens:
python -m spotify_mcp.auth logoutRun the MCP Server
python -m spotify_mcp.serverOr:
spotify-mcpCursor MCP Config
Add this to your Cursor MCP settings (.cursor/mcp.json or Cursor Settings > MCP):
{
"mcpServers": {
"spotify": {
"command": "C:\\Users\\vihoh\\Coding Projects\\Spotify-MCP\\.venv\\Scripts\\python.exe",
"args": ["-m", "spotify_mcp.server"],
"cwd": "C:\\Users\\vihoh\\Coding Projects\\Spotify-MCP"
}
}
}Adjust the Python path if your virtual environment lives elsewhere.
Tool: search_song
Searches Spotify tracks via GET /v1/search with type=track.
Parameters:
query(required): search textlimit(optional, default5, range0-10)market(optional): ISO country codeoffset(optional, default0, range0-1000)
Example prompt in Cursor:
Use search_song to find "Blinding Lights" by The Weeknd.Playback Tools
Playback endpoints require a Spotify Premium account and an active Spotify device.
play(device_id: str | None = None): resume playback.pause(device_id: str | None = None): pause playback.skip_forward(device_id: str | None = None): skip to the next track.skip_backwards(device_id: str | None = None): skip to the previous track.get_currently_playing(market: str | None = None, additional_types: str | None = None): get the current track or episode.
Example prompts in Cursor:
Use get_currently_playing to tell me what's playing.Pause Spotify.Playlist Tools
Playlist endpoints use:
POST /v1/me/playliststo create playlistsPOST /v1/playlists/{playlist_id}/itemsto add tracksGET /v1/searchwithtype=trackto resolve song queries
Tools:
create_playlist(name, description=None, public=False, collaborative=False): create an empty playlist.add_songs_to_playlist(playlist_id, song_queries, market=None): search for each query and add the best match.create_vibe_playlist(name, vibe, song_queries, description=None, public=False, market=None): create a playlist and add matched songs for a vibe.
Vibe playlist workflow
The LLM should turn your vibe prompt into a list of song_queries, then call create_vibe_playlist.
Example prompt in Cursor:
Create a late-night rainy drive playlist with create_vibe_playlist.
Use a name like "Rainy Night Drive" and pick about 15 songs that fit the vibe.The LLM might call:
create_vibe_playlist(
name="Rainy Night Drive",
vibe="late-night rainy drive, mellow and atmospheric",
song_queries=[
"The Weeknd Blinding Lights",
"Frank Ocean Pink + White",
"Tame Impala The Less I Know The Better"
],
public=false
)If some queries do not match, the tool returns unresolved_queries for the ones it could not find.
Notes
Search uses PKCE user auth even though catalog search is public data. This keeps auth ready for playlist and library tools.
Playback uses Spotify's documented Player endpoints.
Playlist tools request
playlist-modify-privateandplaylist-modify-public.This project does not use deprecated Spotify recommendation or audio-features endpoints for vibe playlists.
If auth expires or is revoked, run
python -m spotify_mcp.auth loginagain.Spotify content is attributed in tool responses and not cached beyond immediate use.
Project Layout
src/spotify_mcp/
auth.py # PKCE login, token storage, refresh helpers
spotify_client.py # Spotify API requests and error handling
server.py # FastMCP server and toolsLicense
Use in compliance with the Spotify Developer Terms.
Available Tools
9 toolsadd_songs_to_playlistA
Search for songs and add the best match for each query to a playlist.
Inputs: playlist_id (required), song_queries (required), market. Returns: object
create_playlistB
Create an empty playlist for the current Spotify user.
Inputs: name (required), public, description, collaborative. Returns: object
create_vibe_playlistA
Create a playlist from a vibe prompt by searching and adding matched songs.
The LLM should provide song_queries that fit the requested vibe. This tool creates the playlist, resolves each query to a Spotify track, and adds them.
Inputs: name (required), vibe (required), song_queries (required), market, +2 more. Returns: object
get_currently_playingB
Get the track or episode currently playing on the user's Spotify account.
Inputs: market, additional_types. Returns: object
pauseA
Pause playback on the active Spotify device or an optional device ID.
Inputs: device_id. Returns: object
playA
Resume playback on the active Spotify device or an optional device ID.
Inputs: device_id. Returns: object
search_songA
Search Spotify for tracks matching a query string.
Inputs: query (required), limit, market, offset. Returns: object
skip_backwardsA
Skip to the previous track on the active Spotify device or an optional device ID.
Inputs: device_id. Returns: object
skip_forwardA
Skip to the next track on the active Spotify device or an optional device ID.
Inputs: device_id. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have distinct purposes, such as search_song vs. play, and the playback controls are clearly separate actions. However, add_songs_to_playlist and create_vibe_playlist overlap in that both add songs to a playlist, but the descriptions clarify that one adds to an existing playlist while the other creates a new one.
Names mix styles: verb_noun (search_song, create_playlist), bare verb (play, pause), and verb_adverb (skip_forward, skip_backwards). While intuitive, the lack of a uniform pattern makes the naming less predictable.
With 9 tools covering playback control and playlist creation, the scope is well-sized for a Spotify-focused MCP server. Each tool addresses a distinct need without excessive fragmentation.
Core playback and playlist creation are covered, but there is no way to list or retrieve existing playlists, which creates a gap when adding songs to an existing playlist. Additional playback controls like shuffle/repeat are also missing.
Related MCP Connectors
A simple MCP server built with FastMCP and python
The Stytch MCP server is a reference implementation that demonstrates remote MCP server authentication and authorization using Stytch Connected Apps. It provides OAuth 2.1-compliant authorization (including PKCE), Dynamic Client Registration, and validates Stytch-issued access tokens to enable AI agents to securely interact with external services through permissioned access, supporting scopes like openid, email, profile, and manage:project_data.
An MCP server that provides tools to discover and retrieve podcast episodes transcripts.
Demo banking MCP server: accounts, transactions and payments. OAuth 2.1 with DPoP.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceAn MCP server that enables users to control Spotify playback, search for music, and manage playlists through MCP-compatible clients. It supports features like track recommendations and playback management using secure OAuth authentication.MIT
- FlicenseNot gradedqualityDmaintenanceA MCP server for controlling Spotify playback, searching for content, and managing playlists via OAuth authentication.1-
- FlicenseNot gradedqualityDmaintenanceA FastMCP server that exposes Spotify's catalog and user context as tools for Claude, enabling track search, audio features, artist discography, recommendations, currently playing, and playlist creation.-
- AlicenseNot gradedqualityDmaintenanceA remote MCP server for Spotify with brokered OAuth and server-side intelligence, enabling search, playlist management, playback control, library analysis, and listening trends via natural language.118 npm4MIT