Spotify MCP Server
Provides 51 granular tools for controlling Spotify playback, managing playlists and library, searching for music, monitoring playback state, controlling devices and volume, and accessing detailed track, artist, and album information through the Spotify 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 MCP Server what's the current track name and artist?"
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 MCP Server
A comprehensive Model Context Protocol (MCP) server for Spotify
Provides 51 granular tools perfect for building dynamic HUDs, music visualizers, and AI-powered music control interfaces
Why This MCP Server?
This MCP server is specifically designed for dynamic HUD applications where you need individual data points. Instead of parsing large JSON responses, each tool returns exactly what you need.
Use Case | Traditional Approach | This Server |
Get track name | Parse JSON → Extract |
|
Get artist | Parse JSON → Extract |
|
Show countdown timer | Parse JSON → Calculate remaining time → Format |
|
Progress bar | Parse JSON → Calculate percentage |
|
Play/pause button | Parse JSON → Check |
|
Related MCP server: Spotify MCP Server
Complete Tool Coverage
51 tools organized into 9 categories for maximum flexibility
Category | Tool Count | Description |
Bulk State Tools | 2 | Get complete playback state or track info in one call |
Granular Track Info | 16 | Individual tools for artist, track name, album, duration, progress, artwork, and more |
Granular Device Info | 6 | Get device name, type, volume, ID, and active status individually |
Granular Playback State | 5 | Individual tools for play state, shuffle, repeat mode, and context |
Playback Control | 7 | Play, pause, next, previous, seek, shuffle, and repeat controls |
Volume & Device Control | 2 | Set volume and transfer playback between devices |
Queue Management | 3 | View queue, add tracks, and see recently played |
Search & Discovery | 5 | Search tracks, albums, artists, and get detailed information |
Library Management | 5 | Manage saved tracks and playlists |
Key Features
Feature | Description |
Granular Data Access | 51 specialized tools for precise data retrieval |
HUD Optimized | Returns plain text values perfect for UI components |
Production Ready | Comprehensive error handling and automatic token refresh |
Full Test Coverage | 94 tests covering all 51 tools and edge cases |
Type Safe | Built with TypeScript and Zod schema validation |
OAuth Authentication | Automatic token management and refresh |
Zero Dependencies | Only requires Node.js 18+ and Spotify account |
Installation
Step | Instructions |
1. Prerequisites | • Node.js 18+ installed• Spotify Account (Premium recommended)• Spotify Developer App credentials |
2. Get Credentials | 1. Go to Spotify Developer Dashboard2. Create a new app3. Note your Client ID and Client Secret4. Add |
3. Install |
|
4. Configure | Copy example env: |
5. Authenticate |
|
6. Build |
|
7. Configure Client | Add to |
Usage
Once configured, restart your MCP client and you'll have access to all 51 tools!
Example Queries
Category | User Query | Tool Used |
Dynamic HUDs | "What's the current track name?" |
|
"Get the artist" |
| |
"What's the time remaining?" |
| |
"What's the playback progress percentage?" |
| |
"Is music playing?" |
| |
Playback Control | "Pause the music" |
|
"Skip to the next song" |
| |
"Set volume to 50%" |
| |
"Enable shuffle" |
| |
Discovery | "Search for tracks by The Beatles" |
|
"Add this song to my library" |
|
Complete API Reference
Bulk State Tools (2)
Tool | Returns | Use Case |
| Complete playback state (JSON) | Get all playback info at once |
| Complete track info (JSON) | Get all track info at once |
Granular Track Info Tools (16)
Tool | Returns | Perfect For |
| Track name only | HUD track display |
| Primary artist name | HUD artist display |
| All artists (comma-separated) | Full artist credits |
| Album name only | HUD album display |
| Duration in milliseconds | Calculations |
| Duration as "M:SS" | HUD duration display |
| Current position in ms | Calculations |
| Current position as "M:SS" | HUD position display |
| Time left in ms | Calculations |
| Time left as "M:SS" | HUD countdown timer |
| Progress as 0-100 | Progress bars |
| Spotify URI | Playback control |
| Spotify ID | API calls |
| Album artwork URL | HUD artwork display |
| "true" or "false" | Explicit content indicator |
| Popularity 0-100 | Track metrics |
Granular Device Tools (6)
Tool | Returns | Perfect For |
| Device name | HUD device display |
| Device type | Device icons |
| Volume 0-100 | Volume displays |
| Device ID | Device switching |
| "true" or "false" | Active device indicator |
| All devices (JSON) | Device selection |
Granular Playback State Tools (5)
Tool | Returns | Perfect For |
| "true" or "false" | Play/pause button states |
| "true" or "false" | Shuffle button states |
| "off", "track", or "context" | Repeat button states |
| Context type | Playlist/album indicators |
| Context URI | Context switching |
Playback Control Tools (7)
Tool | Parameters | Description |
| device_id?, context_uri?, uris?, position_ms? | Start/resume playback |
| device_id? | Pause playback |
| device_id? | Skip to next track |
| device_id? | Skip to previous track |
| position_ms, device_id? | Seek to position |
| state (bool), device_id? | Toggle shuffle |
| state (track/context/off), device_id? | Set repeat mode |
Volume & Device Control Tools (2)
Tool | Parameters | Description |
| volume_percent (0-100), device_id? | Set playback volume |
| device_id, play? | Transfer playback to device |
Queue Management Tools (3)
Tool | Parameters | Description |
| - | Get current playback queue |
| uri, device_id? | Add track to queue |
| limit? | Get recently played tracks |
Search & Discovery Tools (5)
Tool | Parameters | Description |
| query, type[], limit? | Search for tracks/albums/artists/playlists |
| track_id | Get detailed track information |
| album_id | Get detailed album information |
| artist_id | Get detailed artist information |
| artist_id, market? | Get artist's top tracks |
Library Management Tools (5)
Tool | Parameters | Description |
| limit?, offset? | Get user's saved tracks |
| track_id | Save (like) a track |
| track_id | Remove (unlike) a track |
| limit?, offset? | Get user's playlists |
| playlist_id | Get playlist details |
Architecture
spotify-mcp-server/
├── src/
│ ├── auth/
│ │ ├── setup.ts # OAuth authentication flow
│ │ └── token-manager.ts # Token storage and refresh
│ ├── tools/
│ │ └── spotify-api.ts # Spotify API wrapper
│ └── index.ts # Main MCP server with all 51 tools
├── tests/ # Comprehensive test suite (94 tests)
├── dist/ # Compiled JavaScript (generated)
├── package.json
├── tsconfig.json
├── eslint.config.mjs
└── .env # Your credentials (not committed)Token Management
Token Details |
Tokens are stored in |
Access tokens are automatically refreshed when they expire |
You only need to run |
Tokens persist across server restarts |
Error Handling
The server provides clear, actionable error messages:
Error Code | Meaning |
401 Unauthorized | Re-run |
403 Forbidden | Feature may require Spotify Premium |
404 Not Found | No active device or track |
429 Rate Limit | Too many requests, wait a moment |
Development
Task | Command |
Run Tests |
|
Run Linter |
|
Clean Build |
|
Debugging | Server logs to stderr |
Use Cases
Dynamic HUD Applications
Perfect for creating real-time music displays:
// Get individual values for your HUD components
const trackName = await callTool("spotify_get_track_name");
const artist = await callTool("spotify_get_artist_name");
const progress = await callTool("spotify_get_track_progress_percentage");
const timeRemaining = await callTool("spotify_get_time_remaining_formatted");
const isPlaying = await callTool("spotify_is_playing");
const albumArt = await callTool("spotify_get_album_art_url");Music Visualizers
Get precise timing and state info:
const progressMs = await callTool("spotify_get_track_progress_ms");
const durationMs = await callTool("spotify_get_track_duration_ms");
const isPlaying = await callTool("spotify_is_playing");AI Music Assistants
Natural language control:
User: "What's playing?"
AI: Uses spotify_get_track_name and spotify_get_artist_name
User: "How much time is left?"
AI: Uses spotify_get_time_remaining_formatted
User: "Skip this song"
AI: Uses spotify_nextAvailable Tools
51 toolsspotify_add_to_queueB
Add a track to the user's playback queue.
Inputs: uri (required), device_id.
spotify_get_album_art_urlA
Get ONLY the URL of the album artwork for the currently playing track. Returns the largest available image URL - perfect for displaying in HUDs.
Inputs: no named parameters.
spotify_get_album_infoB
Get detailed information about a specific album by its Spotify ID.
Inputs: album_id (required).
spotify_get_album_nameA
Get ONLY the album name of the currently playing track. Returns plain text - perfect for HUD displays.
Inputs: no named parameters.
spotify_get_all_artistsA
Get all artist names of the currently playing track (comma-separated). Returns plain text.
Inputs: no named parameters.
spotify_get_artist_infoB
Get detailed information about a specific artist by their Spotify ID.
Inputs: artist_id (required).
spotify_get_artist_nameA
Get ONLY the primary artist name of the currently playing track. Returns plain text - perfect for HUD displays.
Inputs: no named parameters.
spotify_get_artist_top_tracksC
Get an artist's top tracks.
Inputs: artist_id (required), market.
spotify_get_available_devicesA
Get a list of all available Spotify devices. Returns JSON array of devices with their details.
Inputs: no named parameters.
spotify_get_context_typeA
Get ONLY the type of playback context (album, artist, playlist, etc.). Returns context type as text.
Inputs: no named parameters.
spotify_get_context_uriA
Get ONLY the URI of the playback context (album, playlist, etc.). Returns URI as text.
Inputs: no named parameters.
spotify_get_current_trackB
Get complete information about the currently playing track, including all metadata. Returns comprehensive JSON data.
Inputs: market.
spotify_get_device_idA
Get ONLY the ID of the currently active playback device. Returns ID as text.
Inputs: no named parameters.
spotify_get_device_nameA
Get ONLY the name of the currently active playback device. Returns plain text - perfect for HUD displays.
Inputs: no named parameters.
spotify_get_device_typeA
Get ONLY the type of the currently active playback device (Computer, Smartphone, Speaker, etc.). Returns plain text.
Inputs: no named parameters.
spotify_get_device_volumeA
Get ONLY the current volume percentage of the active device (0-100). Returns number as text - perfect for volume displays.
Inputs: no named parameters.
spotify_get_playback_stateA
Get complete information about the user's current playback state, including track, artist, album, progress, device, and all settings. Returns comprehensive JSON data.
Inputs: market.
spotify_get_playlistB
Get detailed information about a specific playlist.
Inputs: playlist_id (required).
spotify_get_playlistsC
Get the user's playlists.
Inputs: limit, offset.
spotify_get_queueA
Get the user's current playback queue, including currently playing and upcoming tracks.
Inputs: no named parameters.
spotify_get_recently_playedB
Get tracks from the user's recently played history.
Inputs: limit.
spotify_get_repeat_modeA
Get ONLY the current repeat mode. Returns 'off', 'track', or 'context' as text - perfect for repeat button states in HUDs.
Inputs: no named parameters.
spotify_get_saved_tracksB
Get the user's saved (liked) tracks.
Inputs: limit, offset.
spotify_get_shuffle_stateA
Get ONLY whether shuffle is enabled. Returns 'true' or 'false' as text - perfect for shuffle button states in HUDs.
Inputs: no named parameters.
spotify_get_time_remaining_formattedA
Get ONLY the time remaining in the current track in formatted time (M:SS or H:MM:SS). Returns formatted text - perfect for HUD countdown displays.
Inputs: no named parameters.
spotify_get_time_remaining_msA
Get ONLY the time remaining in the current track in milliseconds. Returns number as text - perfect for countdown timers.
Inputs: no named parameters.
spotify_get_track_duration_formattedA
Get ONLY the total duration of the current track in formatted time (M:SS or H:MM:SS). Returns formatted text - perfect for HUD displays.
Inputs: no named parameters.
spotify_get_track_duration_msA
Get ONLY the total duration of the current track in milliseconds. Returns number as text.
Inputs: no named parameters.
spotify_get_track_explicitA
Get ONLY whether the current track is explicit. Returns 'true' or 'false' as text.
Inputs: no named parameters.
spotify_get_track_idA
Get ONLY the Spotify ID of the currently playing track. Returns ID as text.
Inputs: no named parameters.
spotify_get_track_infoA
Get detailed information about a specific track by its Spotify ID.
Inputs: track_id (required).
spotify_get_track_nameA
Get ONLY the name of the currently playing track. Returns plain text - perfect for HUD displays.
Inputs: no named parameters.
spotify_get_track_popularityA
Get ONLY the popularity score of the current track (0-100). Returns number as text.
Inputs: no named parameters.
spotify_get_track_progress_formattedA
Get ONLY the current playback position in formatted time (M:SS or H:MM:SS). Returns formatted text - perfect for HUD displays.
Inputs: no named parameters.
spotify_get_track_progress_msA
Get ONLY the current playback position in milliseconds. Returns number as text.
Inputs: no named parameters.
spotify_get_track_progress_percentageA
Get ONLY the playback progress as a percentage (0-100). Returns number as text - perfect for progress bars in HUDs.
Inputs: no named parameters.
spotify_get_track_uriA
Get ONLY the Spotify URI of the currently playing track. Returns URI as text.
Inputs: no named parameters.
spotify_is_device_activeA
Get ONLY whether a device is currently active. Returns 'true' or 'false' as text.
Inputs: no named parameters.
spotify_is_playingA
Get ONLY whether music is currently playing. Returns 'true' or 'false' as text - perfect for play/pause button states in HUDs.
Inputs: no named parameters.
spotify_nextB
Skip to the next track in the user's queue.
Inputs: device_id.
spotify_pauseB
Pause playback on the user's account.
Inputs: device_id.
spotify_playB
Start or resume playback. Can optionally specify device, context (album/playlist URI), specific tracks, or starting position.
Inputs: uris, device_id, context_uri, position_ms.
spotify_previousA
Skip to the previous track in the user's queue.
Inputs: device_id.
spotify_remove_saved_trackB
Remove (unlike) a track from the user's library.
Inputs: track_id (required).
spotify_save_trackB
Save (like) a track to the user's library.
Inputs: track_id (required).
spotify_searchC
Search for tracks, albums, artists, or playlists on Spotify.
Inputs: type (required), query (required), limit.
spotify_seekB
Seek to a specific position in the currently playing track.
Inputs: position_ms (required), device_id.
spotify_set_repeatB
Set the repeat mode for playback.
Inputs: state (required), device_id.
spotify_set_shuffleC
Toggle shuffle mode on or off.
Inputs: state (required), device_id.
spotify_set_volumeC
Set the volume for the user's current playback device.
Inputs: volume_percent (required), device_id.
spotify_transfer_playbackB
Transfer playback to a different device.
Inputs: device_id (required), play.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 51 tools
Each tool has a clearly distinct purpose, with very specific actions and targets. Even though there are many tools for retrieving individual attributes of the current track, their names and descriptions unambiguously indicate what each returns.
All tools follow the consistent pattern 'spotify_verb_noun' (e.g., spotify_get_track_name, spotify_set_volume). There are no mixed conventions or deviations.
With 51 tools, the set is overly large for the domain. Many granular getters (e.g., spotify_get_track_name, spotify_get_track_id) could be consolidated into fewer tools, making the surface bloated and harder to navigate.
The set covers playback control, current state, search, and basic library management well, but lacks playlist creation/modification and other common operations like following artists or user profile retrieval. Some gaps remain.
Related MCP Connectors
Full Spotify Web API coverage - albums, artists, playlists, player controls, and more.
Spotify: Spotify Data API for Millions of songs & podcasts, artists, albums, playlists and more.
Spotify play counts, monthly listeners, charts, artist stats, albums, playlists and ISRC lookup.
Spotify play counts for any track, album, artist or playlist, plus monthly listeners and followers.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceIntegrates with Spotify Web API through the Model Context Protocol, allowing users to search tracks, control playback, and manage playlists programmatically.133 npmMIT
- FlicenseAqualityDmaintenanceEnables control of Spotify playback through OAuth authentication, including play/pause, track navigation, volume control, device management, and searching/playing songs by artist or track name.111-
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Spotify through MCP, providing tools for searching tracks, artists, albums, playlists, and accessing user data like top tracks and recently played.-
- FlicenseAqualityDmaintenanceExposes Spotify controls as MCP tools for playback, playlist management, and AI playlist generation; includes a web app and supports multi-user profiles.14-