Spotify Model Context Protocol
Enables creation of Spotify playlists based on text descriptions, with OAuth authentication handling for accessing Spotify's 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 Model Context Protocol create a chill study playlist with lo-fi beats and ambient sounds"
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 Model Context Protocol (MCP)
A Spotify MCP for creating playlists based on a description.
Prerequisites
Python 3.6 or higher
Spotify Developer credentials (Client ID and Client Secret)
Related MCP server: Spotify MCP Node Server
Setup
Clone this repository:
git clone https://github.com/yourusername/spotify-mcp.git cd spotify-mcpInstall the required dependencies:
pip install -r requirements.txtSet up your Spotify Developer credentials:
Create a new application
Set up your environment variables:
echo SPOTIFY_CLIENT_ID='your_client_id' >> .env echo SPOTIFY_CLIENT_SECRET='your_client_secret' >> .env
Usage
Starting the Authentication Server
Set up your redirect URI in the Spotify Developer Dashboard:
Go to your app in the Spotify Developer Dashboard
Click "Edit Settings"
Add
http://localhost:5000/callbackto the Redirect URIsSave the changes
Start the authentication server:
python main.pyThis will start a local server on port 5000 that handles Spotify OAuth authentication.
Visit
http://localhost:5000in your browser to authenticate with Spotify. After successful authentication, your access token will be saved for use with the MCP.
Integrating with Cursor
Open Cursor and go to Settings
Navigate to the "Model Context Protocols" section
Click "Add MCP"
Enter the following details in your mcp.json, replacing PATH-TO-BASE-DIR:
{
"mcpServers": {
"spotify": {
"command": "uv",
"args": [
"--directory",
"PATH-TO-BASE-DIR/spotify-mcp",
"run",
"spotify.py"
]
}
}
}Now you can use the Spotify MCP commands in Cursor to create and manage playlists directly from your editor!
Available Tools
3 toolscreate_playlistB
Create a new playlist on Spotify and add tracks to it.
Args:
name: Name of the playlist
track_uris: List of Spotify track URIs to add to the playlist
description: Optional description for the playlist
public: Whether the playlist should be public (default: False)
Inputs: name (required), track_uris (required), description, public.
get_track_urisA
Look up Spotify track URIs for a list of songs.
Args:
songs: List of dictionaries containing song information.
Each dictionary should have 'name' and 'artist' keys.
Example: [{"name": "Yesterday", "artist": "The Beatles"}]
Returns:
List of Spotify track URIs for the found songs.
Songs that couldn't be found will be skipped.
Inputs: songs (required).
update_playlistB
Update an existing Spotify playlist's details and/or tracks.
Args:
playlist_id: The Spotify ID of the playlist to update
name: New name for the playlist (optional)
track_uris: New list of track URIs to replace the playlist's tracks (optional)
description: New description for the playlist (optional)
public: New public/private status for the playlist (optional)
Inputs: playlist_id (required), name, track_uris, description, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose with no overlap: create_playlist makes new playlists, get_track_uris looks up song metadata, and update_playlist modifies existing playlists. The descriptions clearly differentiate their functions, eliminating any ambiguity.
All tools follow a consistent verb_noun pattern (create_playlist, get_track_uris, update_playlist) with clear, descriptive names. There are no deviations in style or convention across the set.
With only 3 tools, the set feels thin for a Spotify integration, lacking operations like searching for playlists, deleting playlists, or managing user profiles. While the tools cover basic playlist creation and updating, the scope is limited compared to typical music service APIs.
There are significant gaps in the tool surface for a Spotify domain. Missing are tools for reading or listing existing playlists, deleting playlists, searching for tracks or artists beyond URI lookup, and user-related operations. This incompleteness will likely cause agent failures when trying to perform common Spotify tasks.
Maintenance
Related MCP Connectors
Read your Formy forms and responses over OAuth. For Claude, ChatGPT, Cursor and VS Code.
Design and edit Bloom canvases from AI coding agents with browser OAuth.
Generate images and video, run Spaces and build canvases from your agent. OAuth sign-in.
Connect AI agents to Filepad workspaces through OAuth MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables interaction with Spotify through LLMs using OAuth2 authentication. Supports music search, playback control, playlist management, and device management through natural language commands.142MIT
- 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.13118 npmMIT
- AlicenseAqualityDmaintenanceEnables interaction with Spotify through OAuth 2.0 authentication, supporting search for tracks/artists/albums/playlists, user profile access, and playlist management including creation and adding tracks.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to create, manage, and populate Spotify playlists using the Spotify Web API.3MIT