Spotify MCP Server
Provides tools for interacting with Spotify's API, enabling control of playback across devices (play, pause, skip, volume, shuffle, repeat), searching for tracks, albums, artists and playlists, creating and managing playlists, managing saved/library items, and retrieving user profile and listening statistics (e.g. top artists and tracks).
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 play my Discover Weekly playlist"
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 provides seamless integration with Spotify's API, enabling AI assistants to control and interact with Spotify playback, manage playlists, search for music, and retrieve user listening data.
Table of Contents
Related MCP server: Spotify MCP Server
Overview
The Spotify MCP Server bridges the gap between AI assistants and Spotify, allowing natural language interactions with your music library and playback. Whether you want to play specific songs, create playlists, discover new music, or analyze your listening habits, this server provides the tools to make it happen.
Features
Current Features
Authentication & Authorization: OAuth 2.0 Authorization Code flow for secure Spotify API access
Playback Control: Play, pause, skip, adjust volume, and control playback across devices
Search: Find tracks, albums, artists, and playlists
Library Management: Access and manage saved tracks, albums, and playlists
User Data: Retrieve user profile information and listening statistics
Planned Features
See ROADMAP.md for detailed feature timeline and future enhancements.
Quick Start
The fastest and easiest way to get started is using the interactive setup wizard:
# Run the setup wizard (no installation required!)
npx @darrenjaws/spotify-mcp setupThe wizard will:
✅ Guide you through creating a Spotify Developer app
✅ Open your browser to the right pages automatically
✅ Validate your credentials as you enter them
✅ Generate the correct configuration for your environment
✅ Give you copy-paste ready configs for Claude Desktop, Claude Code, Cursor, Windsurf, VS Code, or OpenCode
That's it! The whole setup takes about 2 minutes.
Installation
Option 1: NPM (Recommended)
Interactive Setup (Easiest):
# No installation required - run the setup wizard
npx @darrenjaws/spotify-mcp setupOr install globally first:
npm install -g @darrenjaws/spotify-mcp
# Then run setup
spotify-mcp setupUsing npx without setup wizard:
# Skip to manual configuration (see Configuration section below)
npx -y @darrenjaws/spotify-mcpOption 2: From Source
For development or contributing:
# Clone the repository
git clone https://github.com/darrenjaworski/spotify-mcp.git
cd spotify-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Run the setup wizard
npm run build && node build/bin.js setupConfiguration
Automated Setup (Recommended)
Use the interactive setup wizard for the easiest configuration experience:
npx @darrenjaws/spotify-mcp setupThe wizard walks you through:
Creating a Spotify Developer app
Getting your Client ID and Secret
Choosing your AI tool (Claude Desktop, Claude Code, Cursor, Windsurf, VS Code, OpenCode)
Generating the correct config file
Manual Setup
If you prefer to configure manually or need to update credentials:
Spotify App Setup
Go to the Spotify Developer Dashboard
Create a new application
Note your Client ID and Client Secret
Add
http://127.0.0.1:3000/callbackto your app's Redirect URIs (note: use127.0.0.1, notlocalhost)
Environment Variables
For NPM/npx users: Configure environment variables in your Claude Desktop config (see MCP Configuration above).
For development from source: Create a .env file in the project root:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REDIRECT_URI=http://127.0.0.1:3000/callbackMCP Configuration
Claude Desktop
Add to your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"spotify": {
"command": "npx",
"args": ["-y", "@darrenjaws/spotify-mcp"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
}
}
}
}Restart Claude Desktop after saving.
Claude Code (CLI)
The easiest way is the claude mcp add command:
claude mcp add spotify \
-e SPOTIFY_CLIENT_ID=your_client_id_here \
-e SPOTIFY_CLIENT_SECRET=your_client_secret_here \
-e SPOTIFY_REDIRECT_URI=http://127.0.0.1:3000/callback \
-- npx -y @darrenjaws/spotify-mcpOr add it manually to ~/.claude.json (global) or .claude/settings.json (project):
{
"mcpServers": {
"spotify": {
"command": "npx",
"args": ["-y", "@darrenjaws/spotify-mcp"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
}
}
}
}Verify with claude mcp list — you should see spotify in the list.
Cursor
Add to .cursor/mcp.json in your project (or ~/.cursor/mcp.json for global):
{
"mcpServers": {
"spotify": {
"command": "npx",
"args": ["-y", "@darrenjaws/spotify-mcp"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
}
}
}
}Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"spotify": {
"command": "npx",
"args": ["-y", "@darrenjaws/spotify-mcp"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
}
}
}
}VS Code (GitHub Copilot)
Add to .vscode/mcp.json in your project (or VS Code User Settings for global):
{
"servers": {
"spotify": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@darrenjaws/spotify-mcp"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
}
}
}
}OpenCode
{
"$schema": "https://opencode.ai/config.json",
"spotify": {
"command": ["npx", "-y", "@darrenjaws/spotify-mcp@latest"],
"environment": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
},
"type": "local"
}
}From Source (Development)
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["/absolute/path/to/spotify-mcp/build/bin.js"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here",
"SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback"
}
}
}
}Note: When using npx or global install, environment variables must be specified in the MCP config (not in a .env file).
Usage
Once configured, you can interact with Spotify through natural language:
"Play my Discover Weekly playlist"
"Play the album Thriller by Michael Jackson"
"What song is currently playing?"
"Create a playlist called 'Workout Mix' with these songs..."
"Skip to the next track"
"Turn on shuffle"
"Set repeat to track"
"Show me my top artists from the last month"
"Search for songs by The Beatles"
"Add this song to my liked songs"
Available Tools (32 total)
Playback & Device Control (10 tools)
spotify_play- Start or resume playback of tracks, albums, playlists, or artistsspotify_pause- Pause playbackspotify_next- Skip to next trackspotify_previous- Skip to previous trackspotify_set_volume- Adjust volume level (0-100)spotify_get_playback_state- Get current playback information (includes shuffle/repeat status)spotify_get_devices- List available Spotify Connect devicesspotify_transfer_playback- Transfer playback to a different devicespotify_shuffle- Enable or disable shuffle modespotify_repeat- Set repeat mode (track, context, or off)
Search & Discovery (1 tool)
spotify_search- Search for tracks, albums, artists, or playlists with optional field filters (artist, album, genre, year, tag)
Playlist Management (8 tools)
spotify_get_playlists- Get user's playlistsspotify_get_playlist- Get specific playlist detailsspotify_create_playlist- Create a new playlistspotify_add_to_playlist- Add tracks to a playlistspotify_remove_from_playlist- Remove tracks from a playlistspotify_reorder_playlist_tracks- Reorder tracks in a playlistspotify_delete_playlist- Delete (unfollow) a playlistspotify_update_playlist- Update playlist details (name, description, public/private, collaborative)
Library Management (9 tools)
spotify_get_saved_tracks- Get tracks saved in your libraryspotify_get_saved_albums- Get albums saved in your libraryspotify_get_followed_artists- Get artists you followspotify_save_tracks- Save tracks to your libraryspotify_remove_saved_tracks- Remove tracks from your libraryspotify_save_albums- Save albums to your libraryspotify_remove_saved_albums- Remove albums from your libraryspotify_follow_artists- Follow artistsspotify_unfollow_artists- Unfollow artists
User Data (3 tools)
spotify_get_user_profile- Get user profile informationspotify_get_top_items- Get user's top artists or tracksspotify_get_recently_played- Get recently played tracks
System (1 tool)
spotify_open- Open the Spotify desktop app (supports macOS, Windows, Linux)
Local Development
Prerequisites
Node.js >= 18.0.0
npm or yarn
Spotify Developer account with app credentials
Initial Setup
Clone and install dependencies
git clone https://github.com/darrenjaworski/spotify-mcp.git
cd spotify-mcp
npm installConfigure environment variables
cp .env.example .env
# Edit .env with your Spotify credentialsBuild the project
npm run buildDevelopment Workflow
Watch Mode (Recommended)
Run TypeScript compiler in watch mode for automatic rebuilds:
npm run devThis continuously watches for file changes and rebuilds automatically. Keep this running in one terminal while you develop.
Manual Build
npm run build # Compile TypeScript to build/
npm run clean # Remove build directoryTesting Your MCP Server
Option 1: MCP Inspector (Recommended)
The MCP Inspector is the official interactive testing tool for MCP servers. It provides a browser-based UI to test tools, see protocol messages, and debug your server.
Start the Inspector:
npx @modelcontextprotocol/inspector node build/bin.jsThis opens a browser at http://localhost:6274 with:
Server Connection Pane: Configure transport and environment variables
Tools Tab: See all available tools and test them interactively
Resources Tab: View server resources
Notifications Pane: See real-time protocol messages
With Environment Variables:
npx @modelcontextprotocol/inspector node build/bin.js -- \
SPOTIFY_CLIENT_ID=your_id \
SPOTIFY_CLIENT_SECRET=your_secret \
SPOTIFY_REDIRECT_URI=http://127.0.0.1:3000/callbackEnable Debug Logging:
DEBUG=true npx @modelcontextprotocol/inspector node build/bin.jsBenefits:
✅ Interactive UI to test all 32 tools
✅ See JSON-RPC messages in real-time
✅ No need to configure Claude Desktop during development
✅ Quickly iterate on tool implementations
Option 2: Test with Claude Desktop
Add to your Claude Desktop config for real-world testing:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"spotify-dev": {
"command": "node",
"args": ["/absolute/path/to/spotify-mcp/build/bin.js"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id",
"SPOTIFY_CLIENT_SECRET": "your_client_secret",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:3000/callback",
"LOG_LEVEL": "debug"
}
}
}
}Restart Claude Desktop after config changes.
Option 3: Manual stdio Testing
For low-level debugging, you can send JSON-RPC messages directly:
# Build first
npm run build
# Test list tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node build/bin.js
# Test a tool call
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"spotify_get_user_profile","arguments":{}}}' | node build/bin.jsDevelopment Tips
1. Use Watch Mode + Inspector Together
Terminal 1:
npm run dev # Watch mode - rebuilds on changesTerminal 2:
npx @modelcontextprotocol/inspector node build/bin.jsRefresh the Inspector after each rebuild to test changes.
2. Enable Debug Logging
Set LOG_LEVEL=debug in your .env file to see detailed logs:
LOG_LEVEL=debug node build/bin.js3. Test Individual Tools
Use the Inspector's Tools tab to test each tool with different inputs before integrating with Claude.
4. Check stderr for Logs
The server logs to stderr (not stdout) to avoid interfering with stdio transport:
node build/bin.js 2> server.log # Capture logs to fileTesting
Run the test suite to verify tool registration and functionality:
npm test # Run all tests
npm run test:watch # Run tests in watch modeTest Coverage:
✅ 310 tests across 16 test files
✅ Tool-level unit tests for playback, search, playlists, library, user, and system
✅ Auth tests (credentials, token management, file permissions, refresh, OAuth callback)
✅ Logger tests (sensitive data redaction, log levels)
✅ Error handling tests (all HTTP status codes, security)
✅ Server registration and integration tests
✅ Client tests (token orchestration, retry logic, rate limiting)
✅ Validation tests (URI format, array size, numeric range)
✅ Setup wizard and CLI argument tests
Linting and Code Quality
npm run lint # Check code style
npm run lint:fix # Auto-fix linting issues
npm run static-checks # Run lint, build, and test togetherTroubleshooting
Build Errors:
Ensure TypeScript is installed:
npm installCheck Node version:
node --version(should be >= 18)
Inspector Not Loading:
Check if port 6274 is available
Try clearing browser cache
Restart the inspector
OAuth Errors:
Verify Spotify credentials in
.envCheck redirect URI matches in Spotify Dashboard
Ensure scopes are correct in
src/spotify/auth.ts
Server Not Responding:
Check logs:
LOG_LEVEL=debug node build/bin.jsVerify build succeeded:
ls -la build/Test with simple tool like
spotify_get_user_profile
Authentication Flow
The server uses Spotify's OAuth 2.0 Authorization Code flow:
First request triggers the auth flow
User is redirected to Spotify login with secure state parameter for CSRF protection
After authorization, tokens are exchanged using client_secret
Tokens are stored securely in
~/.spotify-mcp/tokens.jsonwith 0600 permissionsTokens are automatically refreshed when expired
Security
OAuth tokens are stored securely with restricted file permissions (0600) and never logged
Cryptographically secure state parameter prevents CSRF attacks
Client secrets are kept in environment variables, never in source code
All API requests use HTTPS
Uses Authorization Code flow appropriate for confidential server applications
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
MIT License - see LICENSE file for details
Acknowledgments
Built on the Model Context Protocol
Uses the Spotify Web API
Support
Report bugs via GitHub Issues
Join discussions in GitHub Discussions
Related Projects
Resources
MCP Development Tools
MCP Inspector Documentation - Official testing tool
MCP Inspector GitHub - Source code
Testing MCP Servers Guide - Comprehensive testing strategies
MCP Inspector Tutorial - Step-by-step guide
Spotify API
Available Tools
32 toolsspotify_add_to_playlistC
Add tracks to a playlist
Inputs: uris (required), playlist_id (required), position.
spotify_create_playlistC
Create a new playlist
Inputs: name (required), public, description.
spotify_delete_playlistA
Delete (unfollow) a playlist. You can only delete playlists you own.
Inputs: playlist_id (required).
spotify_follow_artistsC
Follow one or more artists
Inputs: artist_ids (required).
spotify_get_devicesB
List available Spotify Connect devices
Inputs: no named parameters.
spotify_get_followed_artistsB
Get artists followed by the current user
Inputs: after, limit.
spotify_get_playback_stateB
Get current playback state including track, artist, album, and playback status
Inputs: no named parameters.
spotify_get_playlistC
Get details of a specific playlist
Inputs: playlist_id (required).
spotify_get_playlistsC
Get current user's playlists
Inputs: limit.
spotify_get_recently_playedC
Get user's recently played tracks
Inputs: limit.
spotify_get_saved_albumsB
Get albums saved in the current user's library
Inputs: limit, offset.
spotify_get_saved_tracksC
Get tracks saved in the current user's library
Inputs: limit, offset.
spotify_get_top_itemsC
Get user's top artists or tracks
Inputs: type (required), limit, time_range.
spotify_get_user_profileB
Get current user's profile information
Inputs: no named parameters.
spotify_nextB
Skip to next track
Inputs: device_id.
spotify_openB
Open the Spotify desktop app on this machine
Inputs: wait_seconds.
spotify_pauseC
Pause current playback
Inputs: device_id.
spotify_playB
Start or resume playback of a track, album, artist, or playlist
Inputs: uri, device_id.
spotify_previousB
Skip to previous track
Inputs: device_id.
spotify_remove_from_playlistC
Remove tracks from a playlist
Inputs: uris (required), playlist_id (required), snapshot_id.
spotify_remove_saved_albumsB
Remove albums from the current user's library
Inputs: album_ids (required).
spotify_remove_saved_tracksC
Remove tracks from the current user's library
Inputs: track_ids (required).
spotify_reorder_playlist_tracksC
Reorder tracks in a playlist
Inputs: playlist_id (required), range_start (required), insert_before (required), snapshot_id, +1 more.
spotify_repeatB
Set repeat mode: 'track' repeats current track, 'context' repeats album/playlist, 'off' disables repeat
Inputs: state (required), device_id.
spotify_save_albumsC
Save albums to the current user's library
Inputs: album_ids (required).
spotify_save_tracksB
Save tracks to the current user's library
Inputs: track_ids (required).
spotify_searchB
Search for tracks, albums, artists, or playlists with optional field filters
Inputs: type (required), query (required), tag, year, +4 more.
spotify_set_volumeC
Set playback volume (0-100)
Inputs: volume_percent (required), device_id.
spotify_shuffleB
Enable or disable shuffle mode
Inputs: state (required), device_id.
spotify_transfer_playbackA
Transfer playback to a different device (use spotify_get_devices to find device IDs)
Inputs: device_id (required), play.
spotify_unfollow_artistsC
Unfollow one or more artists
Inputs: artist_ids (required).
spotify_update_playlistC
Update playlist details (name, description, public/private, collaborative)
Inputs: playlist_id (required), name, public, description, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 32 tools
Tools are mostly cleanly separated by resource and action: playback controls, playlist CRUD, library saves, and user data are distinct. Minor potential confusion exists between spotify_play and spotify_transfer_playback, and between library saves versus playlist additions, but descriptions clarify these.
All tools use a consistent spotify_ prefix with snake_case, and almost all follow a predictable verb_noun pattern such as spotify_create_playlist or spotify_get_saved_tracks. The bare playback verbs like spotify_play and spotify_pause are conventional and still readable within the same namespace.
With 32 tools, the server is comprehensive but heavy relative to the typical well-scoped range. Most tools represent distinct operations rather than redundancy, but the surface is large enough to feel borderline overextended for an agent to navigate efficiently.
The tool set covers core Spotify workflows: playback control, device transfer, search, playlist management, library saves, artist follow, and user listening history. Gaps remain around queue management, detailed track/album/artist lookup, and podcast/episode support, but agents can mostly work around them via search.
Maintenance
Related MCP Connectors
Full Spotify Web API coverage - albums, artists, playlists, player controls, and more.
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
Spotify: Spotify Data API for Millions of songs & podcasts, artists, albums, playlists and more.
Create songs from prompts or lyrics, check credits, and access your private library with OAuth.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI assistants to control Spotify playback, search for music, manage playlists, and interact with your Spotify library through natural language commands.19-
- FlicenseAqualityDmaintenanceEnables AI assistants to control Spotify playback, search for music, manage playlists, and access library information through the Spotify API. Requires Spotify Premium for playback control features.4-
- AlicenseBqualityDmaintenanceEnables AI assistants to control Spotify playback, manage playlists, search music, and access listening history. Requires Spotify Premium and uses secure OAuth 2.0 with PKCE authentication.13MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to control Spotify playback, search music, manage playlists and library, and access user listening insights via the Spotify Web API.-