MCP Claude Spotify
<table style="border-collapse: collapse; width: 100%;"> <tr> <td style="padding: 15px; vertical-align: middle; border: none; text-align: center;"> <a href="https://mseep.ai/app/imprvhub-mcp-claude-spotify"> <img src="https://mseep.net/pr/imprvhub-mcp-claude-spotify-badge.png" alt="MseeP.ai Security Assessment Badge" /> </a> </td> <td style="width: 50%; padding: 15px; vertical-align: middle; border: none;">An integration that allows Claude Desktop to interact with Spotify using the Model Context Protocol (MCP).</td> <td style="width: 50%; padding: 0; vertical-align: middle; border: none;"><a href="https://glama.ai/mcp/servers/@imprvhub/mcp-claude-spotify"><img src="https://glama.ai/mcp/servers/@imprvhub/mcp-claude-spotify/badge" alt="Claude Spotify MCP server" style="max-width: 100%;" /></a></td> </tr> </table>Features
- Spotify authentication
- Search for tracks, albums, artists, and playlists
- Playback control (play, pause, next, previous)
- Full playlist management (create, update, delete, reorder tracks, manage cover images)
- Get personalized recommendations
- Access user's top played tracks over different time periods
- View recently played tracks
Demo
<p> <a href="https://www.youtube.com/watch?v=WNw5H9epZfc"> <img src="public/assets/preview.png" width="600" alt="Claude Spotify Integration Demo"> </a> </p>Requirements
- Node.js 16 or higher
- Spotify account
- Claude Desktop
- Spotify API credentials (Client ID and Client Secret)
Installation
Installing via Smithery
To install MCP Claude Spotify for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @imprvhub/mcp-claude-spotify --client claudeInstalling Manually
- Clone or download this repository:
git clone https://github.com/imprvhub/mcp-claude-spotify
cd claude-spotify-mcp- Install dependencies:
npm install- Build the project (if you want to modify the source code):
npm run buildThe repository already includes pre-built files in the build directory, so you can skip step 3 if you don't plan to modify the source code.
Setting up Spotify Credentials
To use this MCP, you need to obtain Spotify API credentials:
- Go to Spotify Developer Dashboard
- Log in with your Spotify account
- Click "Create App"
- Fill in your app information:
- App name: "MCP Claude Spotify" (or whatever you prefer)
- App description: "Spotify integration for Claude Desktop"
- Website: You can leave this blank or put any URL
- Redirect URI: Important - Add
http://127.0.0.1:8888/callback
- Accept the terms and conditions and click "Create"
- In your app dashboard, you'll see the "Client ID"
- Click "Show Client Secret" to reveal your "Client Secret"
Save these credentials as you'll need them for configuration.
Running the MCP Server
There are two ways to run the MCP server:
Option 1: Running manually (recommended for first-time setup and troubleshooting)
- Open a terminal or command prompt
- Navigate to the project directory
- Run the server directly:
node build/index.jsKeep this terminal window open while using Claude Desktop. The server will run until you close the terminal.
Option 2: Auto-starting with Claude Desktop (recommended for regular use)
The Claude Desktop can automatically start the MCP server when needed. To set this up:
Configuration
The Claude Desktop configuration file is located at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Edit this file to add the Spotify MCP configuration. If the file doesn't exist, create it:
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here"
}
}
}
}Important: Replace:
ABSOLUTE_PATH_TO_DIRECTORYwith the complete absolute path where you installed the MCP- macOS/Linux example:
/Users/username/mcp-claude-spotify - Windows example:
C:\\Users\\username\\mcp-claude-spotify
- macOS/Linux example:
your_client_id_herewith the Client ID you obtained from Spotifyyour_client_secret_herewith the Client Secret you obtained from Spotify
If you already have other MCPs configured, simply add the "spotify" section inside the "mcpServers" object.
Setting up auto-start scripts (Optional)
For a more reliable experience, you can set up auto-start scripts:
<details> <summary><b>Windows auto-start instructions</b></summary>- Create a file named
start-spotify-mcp.batin the project directory with the following content:
@echo off
cd %~dp0
node build/index.js- Create a shortcut to this BAT file
- Press
Win+R, typeshell:startupand press Enter - Move the shortcut to this folder to have it start with Windows
- Create a file named
com.spotify.mcp.plistin~/Library/LaunchAgents/with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.spotify.mcp</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/spotify-mcp.err</string>
<key>StandardOutPath</key>
<string>/tmp/spotify-mcp.out</string>
<key>EnvironmentVariables</key>
<dict>
<key>SPOTIFY_CLIENT_ID</key>
<string>your_client_id_here</string>
<key>SPOTIFY_CLIENT_SECRET</key>
<string>your_client_secret_here</string>
</dict>
</dict>
</plist>- Replace the path and credentials with your actual values
- Load the agent with:
launchctl load ~/Library/LaunchAgents/com.spotify.mcp.plist
- Create a file named
spotify-mcp.servicein~/.config/systemd/user/(create the directory if it doesn't exist):
[Unit]
Description=Spotify MCP Server for Claude Desktop
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/node ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js
Restart=on-failure
Environment="SPOTIFY_CLIENT_ID=your_client_id_here"
Environment="SPOTIFY_CLIENT_SECRET=your_client_secret_here"
[Install]
WantedBy=default.target- Replace the path and credentials with your actual values
- Enable and start the service:
systemctl --user enable spotify-mcp.service
systemctl --user start spotify-mcp.service- Check status with:
systemctl --user status spotify-mcp.serviceUsage
- Restart Claude Desktop after modifying the configuration
- In Claude, use the
auth-spotifycommand to start the authentication process - A browser window will open for you to authorize the application
- Log in with your Spotify account and authorize the application
- Important: After successful authentication, restart Claude Desktop to properly initialize the MCP's tool registry and WebSocket session token cache
- After restarting, all Spotify MCP tools will be properly registered and available for use
The MCP server runs as a child process managed by Claude Desktop. When Claude is running, it automatically starts and manages the Node.js server process based on the configuration in claude_desktop_config.json.
Available Tools
Authentication
auth-spotify
Initiates the Spotify authentication process.
Search
search-spotify
Searches for tracks, albums, artists, or playlists.
Parameters:
query: Search texttype: Type of search (track, album, artist, playlist)limit: Number of results (1-10, default: 5)
Playback Control
get-current-playback
Gets information about the current playback state.
play-track
Plays a specific track on an active device.
Parameters:
trackId: Spotify track IDdeviceId: (Optional) Spotify device ID to play on
pause-playback
Pauses the current playback.
next-track
Skips to the next track.
previous-track
Returns to the previous track.
Playlist Management
get-user-playlists
Gets a list of the user's playlists.
Parameters:
limit: (Optional) Number of playlists to return (1-50, default: 20)offset: (Optional) Index of the first playlist to return (default: 0)
create-playlist
Creates a new playlist for the current user.
Parameters:
name: Playlist namedescription: (Optional) Descriptionpublic: (Optional) Whether it's public or private
update-playlist
Updates a playlist's name, description, public/private status, or collaborative setting.
Parameters:
playlistId: Spotify ID of the playlistname: (Optional) New name for the playlistdescription: (Optional) New description for the playlistpublic: (Optional) Whether the playlist should be publiccollaborative: (Optional) Whether the playlist should be collaborative (must set public to false first)
delete-playlist
Unfollows (removes) a playlist from your library. The playlist still exists on Spotify but is no longer in your library.
Parameters:
playlistId: Spotify ID of the playlist
get-playlist-tracks
Gets the tracks in a playlist with pagination support.
Parameters:
playlistId: Spotify ID of the playlistlimit: (Optional) Number of tracks to return (1-50, default: 20)offset: (Optional) Index of the first track to return (default: 0)
add-tracks-to-playlist
Adds tracks to a playlist.
Parameters:
playlistId: Playlist IDtrackIds: Array of track IDs
remove-tracks-from-playlist
Removes tracks from a playlist.
Parameters:
playlistId: Spotify ID of the playlisttrackIds: Array of Spotify track IDs to remove
reorder-playlist-tracks
Reorders tracks in a playlist by moving a range of tracks to a new position.
Parameters:
playlistId: Spotify ID of the playlistrangeStart: Position of the first track to moveinsertBefore: Position where the tracks should be insertedrangeLength: (Optional) Number of tracks to move (default: 1)
get-playlist-cover
Gets the cover image of a playlist.
Parameters:
playlistId: Spotify ID of the playlist
upload-playlist-cover
Uploads a custom cover image for a playlist (base64 encoded JPEG, max 256KB).
Parameters:
playlistId: Spotify ID of the playlistimageBase64: Base64 encoded JPEG image
Discovery & History
get-recommendations
Gets track recommendations based on seed tracks, artists, or genres.
Parameters:
seedTracks: (Optional) Array of Spotify track IDsseedArtists: (Optional) Array of Spotify artist IDsseedGenres: (Optional) Array of genre nameslimit: (Optional) Number of recommendations (1-100, default: 20)
get-top-tracks
Gets the user's most played tracks over a specified time range.
Parameters:
limit: (Optional) Number of tracks to return (1-50, d
…