home / mcp / spotify mcp server
Lightweight MCP server for Spotify
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.
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.
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 buildCreate 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"
}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.
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"]
}
}
}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.jsEnsure 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"]
}
}
}Search for tracks, albums, artists, or playlists on Spotify with a query and type, returning matching items and IDs.
Fetch details about the currently playing track, including device info, playback progress, and volume.
Retrieve the current user's Spotify playlists with pagination options.
List tracks within a specific playlist with optional limit and offset.
Retrieve a list of recently played tracks or a message if none are available.
Get the user’s saved tracks with pagination and metadata like add date.
Get the currently playing track and upcoming items in the queue.
List available Spotify Connect devices with their status and volume.
Play a track, album, artist, or playlist by URI, type, or ID on a specified device.
Pause the current playback on a specific device.
Resume playback on the active device.
Skip to the next track in the current playback queue.
Skip to the previous track in the current playback queue.
Create a new playlist with a name, optional description, and public flag.
Add tracks to an existing playlist by IDs or URIs and optional position.
Add a track, album, artist, or playlist to the current playback queue.
Set the playback volume as a percentage on a chosen device (Premium required).
Adjust the playback volume up or down by a relative amount on a chosen device (Premium required).
Fetch details for one or more albums by ID(s).
List tracks from a specific album with pagination.
Save or remove albums from the user's library by IDs and action.
Check if specified albums are saved in the user's library.