A Model Context Protocol (MCP) server that provides Claude with tools to interact with the Spotify API — search music, manage playlists, control playback, and explore your listening history.
- Node.js 18+
- A Spotify account
- A Spotify Developer application (free or Premium — Premium required for playback control)
- Go to Spotify Developer Dashboard
- Click Create App
- Fill in the details:
- App Name: anything (e.g., "Claude MCP")
- Redirect URI:
http://127.0.0.1:8888/callback - APIs used: Web API
- Save and note your Client ID and Client Secret
git clone https://github.com/popand/SpotifyMCP.git
cd SpotifyMCP
npm install
npm run buildSet your credentials and run the auth flow:
export SPOTIFY_CLIENT_ID=your_client_id
export SPOTIFY_CLIENT_SECRET=your_client_secret
node dist/index.js authThis opens a browser window for Spotify login. After approval, tokens are saved to ~/.spotify-mcp/tokens.json (auto-refreshed on expiry).
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["/path/to/SpotifyMCP/dist/index.js"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id",
"SPOTIFY_CLIENT_SECRET": "your_client_secret"
}
}
}
}Add to your project's .mcp.json:
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["/path/to/SpotifyMCP/dist/index.js"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id",
"SPOTIFY_CLIENT_SECRET": "your_client_secret"
}
}
}
}Search Spotify for tracks, artists, albums, or playlists.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string | required | Search query |
type |
"track" | "artist" | "album" | "playlist" |
"track" |
Content type |
limit |
number (1-50) | 10 | Number of results |
Get the current user's playlists.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
number (1-50) | 20 | Number of playlists |
offset |
number | 0 | Pagination offset |
Get tracks in a playlist.
| Parameter | Type | Default | Description |
|---|---|---|---|
playlist_id |
string | required | Spotify playlist ID |
limit |
number (1-50) | 20 | Number of tracks |
offset |
number | 0 | Pagination offset |
Create a new playlist.
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
string | required | Playlist name |
description |
string | "" |
Playlist description |
public |
boolean | false |
Public visibility |
Add tracks to a playlist.
| Parameter | Type | Default | Description |
|---|---|---|---|
playlist_id |
string | required | Spotify playlist ID |
track_uris |
string[] | required | Array of Spotify track URIs |
position |
number | end | Insert position (0-based) |
Remove tracks from a playlist.
| Parameter | Type | Default | Description |
|---|---|---|---|
playlist_id |
string | required | Spotify playlist ID |
track_uris |
string[] | required | Array of Spotify track URIs |
Get the user's saved/liked tracks.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
number (1-50) | 20 | Number of tracks |
offset |
number | 0 | Pagination offset |
Get recently played tracks.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
number (1-50) | 20 | Number of tracks |
Get top artists or tracks by listening history.
| Parameter | Type | Default | Description |
|---|---|---|---|
type |
"artists" | "tracks" |
required | Item type |
time_range |
"short_term" | "medium_term" | "long_term" |
"medium_term" |
Time range |
limit |
number (1-50) | 20 | Number of items |
offset |
number | 0 | Pagination offset |
Get current playback state. No parameters.
Control playback (requires Spotify Premium).
| Parameter | Type | Description |
|---|---|---|
action |
"play" | "pause" | "next" | "previous" | "shuffle" | "repeat" | "volume" |
Action to perform |
device_id |
string? | Target device (uses active device if omitted) |
context_uri |
string? | Context to play (album/playlist URI). play only. |
track_uris |
string[]? | Track URIs to play. play only. Mutually exclusive with context_uri. |
offset_position |
number? | Position in context. play with context_uri only. |
shuffle_state |
boolean? | Required for shuffle action |
repeat_state |
"off" | "track" | "context"? |
Required for repeat action |
volume_percent |
number (0-100)? | Required for volume action |
Note: Playback control requires a Spotify Premium subscription. Free accounts will receive a "Premium Required" error.
Ask Claude things like:
- "Search for Taylor Swift's latest album"
- "Show me my playlists"
- "Create a playlist called 'Chill Vibes' and add some lo-fi tracks"
- "What am I listening to right now?"
- "Skip to the next track"
- "Show me my top artists from the last month"
MIT