Spotify MCP Server
Enables music playback control, playlist management, library organization, and personalized music recommendations while providing tools to search for tracks and analyze listening habits.
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 are my top 10 tracks this month?"
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 Model Context Protocol (MCP) server that integrates Spotify with Claude, enabling voice-controlled music playback, playlist management, and personalized music recommendations directly through conversational AI.
โจ Features
๐ต Playback Control
Get currently playing track with full details
Play specific tracks by name or ID
Pause/resume playback
Skip to next/previous tracks
Adjust volume levels
Toggle shuffle mode
โค๏ธ Library Management
Like/unlike songs
Add tracks to Liked Songs
Remove tracks from Liked Songs
๐ Playlist Operations
Create new playlists
Add tracks to existing playlists
Search and discover music
๐ Discovery & Search
Search for tracks, artists, albums, and playlists
Get personalized recommendations
View top tracks and artists (customizable time ranges)
๐ Analytics
View your most played tracks
See your top artists
Analyze listening habits over different time periods
Related MCP server: Spotify MCP Server
๐ Prerequisites
Node.js v18 or higher
Claude Desktop
Spotify Premium account (required for playback control)
Spotify Developer account
๐ฆ Installation
1. Create Spotify Developer App
Log in with your Spotify account
Click "Create app"
Fill in:
App name:
Claude MCP IntegrationApp description:
MCP server for Claude AIRedirect URI:
http://localhost:3000/callbackโ ๏ธ CRITICAL
Save and note your Client ID and Client Secret
2. Clone and Setup
# Clone the repository
git clone https://github.com/MadhurToshniwal/Spotify-MCP-Server.git
cd Spotify-MCP-Server
# Install dependencies
npm install
# Build the project
npm run build3. Configure Environment Variables
Create a .env file in the project root:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REFRESH_TOKEN=will_get_this_next4. Authorize Your Spotify Account
Run the OAuth helper script:
npm run authThis will:
Start a local server on port 3000
Open your browser to Spotify's authorization page
After you authorize, display your refresh token
Copy the refresh token and add it to your
.envfile
5. Configure Claude Desktop
Edit your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"spotify": {
"command": "node",
"args": [
"/absolute/path/to/spotify-mcp-server/dist/index.js"
],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id",
"SPOTIFY_CLIENT_SECRET": "your_client_secret",
"SPOTIFY_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}Important for Windows users: Use double backslashes in paths:
"args": ["C:\\Users\\YourName\\Desktop\\spotify-mcp-server\\dist\\index.js"]6. Restart Claude Desktop
Completely quit and restart Claude Desktop for changes to take effect.
๐ฎ Usage Examples
Once configured, you can ask Claude:
Playback Control
"What song am I listening to?"
"Pause the music"
"Play the next song"
"Set volume to 70%"
"Turn shuffle on"
Search & Discovery
"Search for songs by The Weeknd"
"Find some jazz playlists"
"Search for the album 'Abbey Road'"
Library Management
"Add this song to my liked songs"
"Unlike this track"
"Create a playlist called 'Workout Mix'"
"Add these 3 songs to my playlist"
Analytics
"What are my top 10 songs this month?"
"Show me my most played artists"
"What have I been listening to recently?"
Advanced
"Search for 'Bohemian Rhapsody' and play it"
"Create a playlist called 'Study Music' and add 5 calm songs"
"Find electronic music playlists and play the most popular one"
๐ ๏ธ Available Tools
Tool | Description |
| Search for tracks, artists, albums, or playlists |
| Get the currently playing track |
| Play a specific track by URI or ID |
| Pause current playback |
| Resume playback |
| Skip to next track |
| Skip to previous track |
| Add track to Liked Songs |
| Remove track from Liked Songs |
| Create a new playlist |
| Add tracks to a playlist |
| Get your top tracks |
| Get your top artists |
| Set playback volume (0-100) |
| Enable/disable shuffle |
๐ Security Notes
Never commit your
.envfile to version controlKeep your Client Secret secure
Refresh tokens are long-lived - store them safely
The server uses OAuth 2.0 with automatic token refresh
๐ API Limits
Spotify Web API rate limits:
Web API calls are rate-limited by Spotify
Most endpoints allow several requests per second
The server handles token refresh automatically
๐ Troubleshooting
"No active device found"
Solution: Open Spotify on your device and play any song to activate a device.
"Invalid refresh token"
Solution: Run npm run auth again to get a new refresh token.
Tools not appearing in Claude
Solution:
Verify the path in
claude_desktop_config.jsonis correctEnsure all environment variables are set
Restart Claude Desktop completely
"Premium required" errors
Solution: Some features (playback control) require Spotify Premium.
๐ Project Structure
spotify-mcp-server/
โโโ src/
โ โโโ index.ts # Main MCP server
โ โโโ get-refresh-token.ts # OAuth helper script
โโโ dist/ # Compiled JavaScript
โโโ .env # Environment variables (not in repo)
โโโ package.json
โโโ tsconfig.json
โโโ README.md๐ Development
# Build the project
npm run build
# Run the OAuth helper
npm run auth
# Run in development
npm start๐งช Technologies Used
TypeScript: Type-safe development
Model Context Protocol (MCP): Claude integration standard
Spotify Web API: Music streaming service API
OAuth 2.0: Secure authentication protocol
Express.js: Web server for OAuth flow
Axios: HTTP client for API requests
๐ License
MIT
๐ค Author
Madhur Toshniwal
๐ง Email: madhurtoshniwal03@gmail.com
๐ Acknowledgments
Spotify for their comprehensive Web API
Anthropic for the Model Context Protocol
Claude Desktop for AI integration
Built to showcase API integration, OAuth implementation, and modern development practices for campus placement interviews.
๐ Learning Outcomes
This project demonstrates:
OAuth 2.0 authentication flow implementation
RESTful API integration and error handling
Secure credential management
Real-time data synchronization
TypeScript for type-safe development
MCP protocol implementation
Asynchronous programming patterns
Available Tools
15 toolsadd_to_playlistC
Add tracks to a playlist
Inputs: playlist_id (required), track_uris (required).
create_playlistC
Create a new playlist
Inputs: name (required), description, public.
get_current_trackB
Get the currently playing track
Inputs: no named parameters.
get_top_artistsB
Get your top artists
Inputs: limit, time_range.
get_top_tracksC
Get your top tracks
Inputs: limit, time_range.
like_trackA
Add the current or specified track to your Liked Songs
Inputs: track_id.
pause_playbackB
Pause the current playback
Inputs: no named parameters.
play_trackC
Play a specific track by its URI or ID
Inputs: uri (required).
resume_playbackB
Resume the current playback
Inputs: no named parameters.
search_musicB
Search for songs, artists, albums, or playlists on Spotify
Inputs: query (required), type (required), limit.
set_volumeC
Set playback volume
Inputs: volume (required).
skip_to_nextB
Skip to the next track
Inputs: no named parameters.
skip_to_previousB
Skip to the previous track
Inputs: no named parameters.
toggle_shuffleC
Turn shuffle on or off
Inputs: state (required).
unlike_trackA
Remove the current or specified track from your Liked Songs
Inputs: track_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 15 tools
Each tool has a clearly distinct purpose targeting specific Spotify actions like playback control, playlist management, or user data retrieval. No tools overlap in functionality, making it easy for an agent to select the right one without confusion.
All tool names follow a consistent verb_noun pattern using snake_case, such as 'add_to_playlist', 'get_current_track', and 'toggle_shuffle'. This uniformity enhances readability and predictability across the toolset.
With 15 tools, the server is well-scoped for managing Spotify's core features like playback, search, playlists, and user preferences. Each tool serves a clear purpose, and the count aligns with the domain's complexity without being excessive or insufficient.
The toolset covers essential Spotify operations including playback control, search, playlist management, and user interactions like liking tracks. Minor gaps exist, such as missing album-specific actions or detailed playlist editing, but core workflows are well-supported.
Maintenance
Related MCP Connectors
Spotify MCP server for ChatGPT, Claude and any AI agent: search songs and artists, list playlists, read playlist songs, create playlist, add songs to playlist, remove songs from playlist, set playlist public or private and save to Liked Songs in your own Spotify account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Spotify yourself; Cotlet does not store your password and you need no Spotify API key. About the official Spotify API: Spotify has a full Web API and, since 23 Apr 2026, an official connector for Claude (checked 5 Nov 2026). The API needs an app you register, and in development mode the app owner must have Premium and the app allows 5 users; unlimited users need a registered business with at least 250,000 monthly users. Setup and FAQ: https://cotlet.dev/integrations/spotify-api-mcp-server
Generate AI music via the Lacuna Music API from MCP clients like Claude Desktop & Code.
Spotify: Spotify Data API for Millions of songs & podcasts, artists, albums, playlists and more.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceConnects Claude with Spotify to control playback, search music, get track information, and manage the queue through conversation.1-
- FlicenseDqualityDmaintenanceEnables Claude to interact with Spotify by searching songs, creating playlists, getting recommendations, and managing your music through your Spotify account.73-
- AlicenseNot gradedqualityNot gradedmaintenanceConnects Claude to Spotify for music discovery, playlist creation, and collection analysis through natural language. Enables searching songs, analyzing music diversity, creating playlists, and getting recommendations using Spotify's API.-
- AlicenseNot gradedqualityDmaintenanceEnables Claude to control Spotify features including playback control, playlist management, search, and accessing user's listening history and preferences through the Spotify API.1ISC