- Home
- MCP servers
- Spotify
Spotify
- typescript
234
GitHub Stars
typescript
Language
4 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"marcelmarais-spotify-mcp-server": {
"command": "node",
"args": [
"spotify-mcp-server/build/index.js"
],
"env": {
"clientId": "YOUR_CLIENT_ID",
"expiresAt": ":",
"accessToken": "YOUR_ACCESS_TOKEN",
"redirectUri": "http://127.0.0.1:8888/callback",
"clientSecret": "YOUR_CLIENT_SECRET",
"refreshToken": "YOUR_REFRESH_TOKEN"
}
}
}
}You can use this lightweight MCP server to let AI assistants control Spotify playback, manage playlists, and query your Spotify data. It connects your Spotify account to your preferred MCP clients so you can issue natural language commands like playing a song, creating a playlist, or adjusting volume. This guide shows practical steps to install, configure, and run the server, plus how to integrate it with Claude Desktop, Cursor, and VsCode via the Cline model extension.
How to use
Use the MCP server to perform actions on Spotify through your AI assistant. You can search for tracks, get the currently playing item, fetch your playlists, play or create playlists, adjust volume, and queue items on available devices. Typical workflows include asking to play a specific song, creating or modifying playlists with prompts, or controlling playback hands-free while you work.
How to install
Prerequisites you need before starting:
Install and prepare the server with these commands:
git clone https://github.com/marcelmarais/spotify-mcp-server.git
cd spotify-mcp-server
npm install
npm run build
Additional setup and configuration
Create a Spotify Developer Application and configure API access. You will obtain a Client ID, Client Secret, and Redirect URI which you will use to authorize the server to access your Spotify account.
Create a Spotify configuration file at your project root and populate it with your credentials. You will reference this file during authentication.
Example configuration file content you should adapt to your values:
{
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"redirectUri": "http://127.0.0.1:8888/callback"
}
Authentication and token handling
The server uses OAuth 2.0 to authenticate with Spotify. You run an authentication script to generate an authorization URL, sign in to Spotify, and authorize the application. The script exchanges the authorization code for access and refresh tokens, which are saved to your spotify-config.json file.
Automatic token refresh keeps access active using the refresh token. If refresh fails, re-run the authentication flow to re-authenticate.
Integrating with Claude Desktop, Cursor, and VsCode Via Cline model extension
To enable Claude Desktop to use the MCP server, add a server entry that runs the MCP index file with Node.
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["spotify-mcp-server/build/index.js"]
}
}
}
Cursor integration
In Cursor, add a server under the MCP tab in Cursor Settings. Use the following command to run the MCP server locally.
node path/to/spotify-mcp-server/build/index.js
Cline model extension configuration
Ensure your Cline MCP settings point to the local server and authorize specific tools for automatic approval as needed.
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["~/../spotify-mcp-server/build/index.js"],
"autoApprove": ["getListeningHistory", "getNowPlaying"]
}
}
}
Available tools
searchSpotify
Search for tracks, albums, artists, or playlists on Spotify with a query and type, returning matching items and IDs.
getNowPlaying
Fetch details about the currently playing track, including device info, playback progress, and volume.
getMyPlaylists
Retrieve the current user's Spotify playlists with pagination options.
getPlaylistTracks
List tracks within a specific playlist with optional limit and offset.
getRecentlyPlayed
Retrieve a list of recently played tracks or a message if none are available.
getUsersSavedTracks
Get the user’s saved tracks with pagination and metadata like add date.
getQueue
Get the currently playing track and upcoming items in the queue.
getAvailableDevices
List available Spotify Connect devices with their status and volume.
playMusic
Play a track, album, artist, or playlist by URI, type, or ID on a specified device.
pausePlayback
Pause the current playback on a specific device.
resumePlayback
Resume playback on the active device.
skipToNext
Skip to the next track in the current playback queue.
skipToPrevious
Skip to the previous track in the current playback queue.
createPlaylist
Create a new playlist with a name, optional description, and public flag.
addTracksToPlaylist
Add tracks to an existing playlist by IDs or URIs and optional position.
addToQueue
Add a track, album, artist, or playlist to the current playback queue.
setVolume
Set the playback volume as a percentage on a chosen device (Premium required).
adjustVolume
Adjust the playback volume up or down by a relative amount on a chosen device (Premium required).
getAlbums
Fetch details for one or more albums by ID(s).
getAlbumTracks
List tracks from a specific album with pagination.
saveOrRemoveAlbumForUser
Save or remove albums from the user's library by IDs and action.
checkUsersSavedAlbums
Check if specified albums are saved in the user's library.