spotify-mcp-server
Controls Spotify playback (play, pause, skip, volume), searches for tracks/albums/artists/playlists, fetches recommendations, and manages the queue via the Spotify Web 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-server play some chill lo-fi music"
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 Server
A Python-based Model Context Protocol (MCP) server that connects your AI assistant (Claude Desktop, Cursor, etc.) directly to the Spotify Web API. This allows the AI to inspect your current playback state, search for music, trigger recommendations, and control your player (play, pause, skip, adjust volume, queue tracks).
Built using Python 3.12+, the official FastMCP SDK, uv for dependency/project management, and fully type-annotated with strict mypy validation.
Features
🛠️ Exposed Tools
get_current_playback: Retrieves details about your active device, current volume, track name, artist, album, and progress.pause_playback/resume_playback: Pauses or resumes playback.skip_next/skip_previous: Skips to the next or previous track.set_volume: Adjusts player volume (0 to 100).add_to_queue: Appends a specific track URI to the queue.search_spotify: Searches for tracks, albums, artists, or playlists.play_by_search: Searches for an item and immediately starts playing the top result.get_recommendations: Fetches track recommendations based on seed genres (e.g.lofi,chill).
📊 Exposed Resources
spotify://status: Exposes the text description of the currently playing track.
💬 Exposed Prompts
vibe_check: Guides the AI to curate and play a playlist matching your current coding task, energy level, and mood.
Related MCP server: Spotify MCP Node Server
Prerequisites
Spotify Premium: The Spotify Web API Player endpoints require a Spotify Premium subscription to accept control commands.
uvPackage Manager: Installuvif you haven't already:curl -LsSf https://astral.sh/uv/install.sh | sh
Setup & Installation
1. Register a Spotify Developer App
Go to the Spotify Developer Dashboard and log in.
Click Create App and fill in the details:
App name: E.g.
My Local MCP ServerRedirect URI:
http://127.0.0.1:8888/callback(Crucial for the authentication script to run successfully)
Under the app settings, copy your Client ID and Client Secret.
2. Configure Environment Secrets
Create a .env file in the root of this project:
cp .env.example .envOpen .env and fill in your client keys:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REDIRECT_PORT=88883. Generate Spotify Refresh Token
Run the built-in OAuth helper script:
uv run get_token.pyThis script spins up a temporary web server on
127.0.0.1:8888and opens your default web browser to authorize the required permissions (user-read-playback-state,user-modify-playback-state,user-read-currently-playing).After clicking "Agree", you will see a success message. Return to the terminal and copy the printed
SPOTIFY_REFRESH_TOKENto your.envfile:
SPOTIFY_REFRESH_TOKEN=your_generated_refresh_token_hereDevelopment & Type Checking
Ensure the codebase is type-safe and conforms to the static analysis rules:
uv run mypy .MCP Client Configuration
To register this server with your AI client, add the following configuration block:
Claude Desktop
Add this to your claude_desktop_config.json (usually located at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS).
Option A: Hiding Your Absolute Path (Recommended)
To keep your personal home directory paths private and avoid exposing them in configuration files, you can use an environment variable (e.g., SPOTIFY_MCP_DIR).
Export the variable in your shell profile (e.g.,
~/.zshrcor~/.bash_profile):export SPOTIFY_MCP_DIR="/path/to/spotify-mcp-server"Configure Claude Desktop to execute
uvvia a login shell, which resolves the environment variable dynamically:{ "mcpServers": { "spotify": { "command": "zsh", "args": [ "-l", "-c", "uv --directory \"$SPOTIFY_MCP_DIR\" run main.py" ] } } }(If you are using bash, replace
"command": "zsh"with"command": "bash"and load profile accordingly)
Option B: Standard Direct Configuration
If you do not mind exposing your directory path, configure the absolute path directly:
{
"mcpServers": {
"spotify": {
"command": "uv",
"args": [
"--directory",
"/path/to/spotify-mcp-server",
"run",
"main.py"
]
}
}
} (Note: Replace /path/to/spotify-mcp-server with the actual absolute path to this repository on your system)
Available Tools
8 toolsget_current_playbackC
Get information about the user's current Spotify playback state.
Inputs: access_token.
pause_playbackB
Pause the current audio playback on Spotify.
Inputs: access_token.
play_by_searchC
Play a track or playlist by searching for it first.
Inputs: query (required), type, access_token.
resume_playbackC
Resume the current audio playback on Spotify.
Inputs: access_token.
search_spotifyC
Search Spotify's catalog for tracks or playlists.
Inputs: query (required), type, access_token.
set_volumeB
Set the playback volume percentage on Spotify.
Inputs: volume_percent (required), access_token.
skip_nextB
Skip to the next track on Spotify.
Inputs: access_token.
skip_previousC
Skip to the previous track on Spotify.
Inputs: access_token.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a specific action (playback control, search, volume) with no overlapping purposes; an agent can clearly distinguish them.
All tool names follow a consistent verb_noun pattern (e.g., pause_playback, set_volume, skip_next), with clear and predictable naming.
8 tools are well-scoped for controlling Spotify playback and searching; not too many or too few for the intended functionality.
Covers core playback and search operations well, but misses device management, shuffle/repeat, and queue features, which are minor gaps for a playback-focused server.
Maintenance
Related MCP Connectors
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to hotel reservations, availability, rates, guests, and analytics with OAuth.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI assistants to control Spotify playback, search for music, manage playlists, and interact with your Spotify library through natural language commands.19-
- AlicenseBqualityDmaintenanceEnables AI assistants to control Spotify playback, manage playlists, search music, and access listening history. Requires Spotify Premium and uses secure OAuth 2.0 with PKCE authentication.13133 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to control Spotify playback, search music, manage playlists and library, and access user listening insights via the Spotify Web API.-
- AlicenseBqualityBmaintenanceEnables AI assistants to control Spotify playback, search the full catalog including podcasts and audiobooks, manage libraries and playlists, and understand listening taste.131158 npm1MIT