Spotify MCP Server
Provides tools for searching tracks, artists, albums, and playlists, controlling playback (play, pause, skip, seek, volume), retrieving content details, and managing OAuth authentication with the Spotify Web API.
Click on "Install 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 Serversearch for 'Radiohead' and play the top result"
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 tools for interacting with the Spotify Web API.
Features
Authentication: OAuth 2.0 with PKCE support
Search: Search for tracks, artists, albums, and playlists
Playback Control: Play, pause, skip, seek, volume control, and more
Content Retrieval: Get detailed information about tracks, artists, albums, and playlists
Related MCP server: Spotify Streamable MCP Server
Setup
Clone this repository
Install dependencies:
npm installCreate a Spotify App:
Create a new app
Add
http://127.0.0.1:8888/callbackto the Redirect URIs (orhttp://localhost:8888/callback)Copy your Client ID and Client Secret
Set up environment variables:
cp .env.example .envEdit
.envand add your Spotify credentials:SPOTIFY_CLIENT_ID=your_client_id_here SPOTIFY_CLIENT_SECRET=your_client_secret_here SPOTIFY_REDIRECT_URI=http://127.0.0.1:8888/callback SPOTIFY_PERSIST_TOKENS=falseBuild the project:
npm run build
Usage
Running the Server
npm startFor development with auto-reload:
npm run devAvailable Tools
Authentication Tools
spotify_auth_url: Generate OAuth authorization URLspotify_exchange_code: Exchange authorization code for tokensspotify_set_tokens: Manually set access tokensspotify_refresh_token: Refresh the access token
Search Tools
spotify_search: Search for content on SpotifyParameters: query, type (track/artist/album/playlist), limit
Content Tools
spotify_get_track: Get track detailsspotify_get_artist: Get artist detailsspotify_get_album: Get album detailsspotify_get_playlist: Get playlist details
Playback Control Tools
spotify_play: Start or resume playbackspotify_pause: Pause playbackspotify_next: Skip to next trackspotify_previous: Skip to previous trackspotify_seek: Seek to position in trackspotify_set_volume: Set playback volumespotify_get_playback_state: Get current playback statespotify_get_devices: Get available devicesspotify_transfer_playback: Transfer playback to another devicespotify_toggle_shuffle: Toggle shuffle modespotify_set_repeat: Set repeat mode (track/context/off)
Authentication Flow
Use
spotify_auth_urlto generate an authorization URL with desired scopesDirect user to the URL to authorize the app
After authorization, use
spotify_exchange_codewith the code and state from the callbackThe server will automatically manage token refresh when needed
Important for WSL Users: The callback URL (http://127.0.0.1:8888/callback) won't automatically open in WSL. After authorizing in your browser, you'll be redirected to a URL that may not load. Copy the entire URL from your browser's address bar and paste it back to the LLM to complete the authentication process.
Token Persistence
By default, authentication tokens are stored only in memory and will be lost when the server restarts. To enable persistent token storage:
Set the environment variable
SPOTIFY_PERSIST_TOKENS=trueTokens will be securely stored in your home directory (
~/.spotify-mcp-tokens.json)The server will automatically load saved tokens on startup
Tokens are saved with proper file permissions (readable only by the owner)
Security Note: Tokens are stored in plaintext in your home directory. Only enable persistence if you trust the security of your system.
Example Usage with Claude Desktop
Add the server to your Claude Desktop configuration:
{
"mcpServers": {
"spotify": {
"command": "node",
"args": ["/path/to/spotify-mcp/dist/index.js"],
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id",
"SPOTIFY_CLIENT_SECRET": "your_client_secret",
"SPOTIFY_REDIRECT_URI": "http://127.0.0.1:8888/callback",
"SPOTIFY_PERSIST_TOKENS": "false"
}
}
}
}Configuration with Claude CLI
When using Claude CLI, configure the MCP server with the built JavaScript file:
claude mcp add spotify node /path/to/spotify-mcp/dist/index.jsImportant: Make sure to use the compiled JavaScript file from the dist/ directory, not the TypeScript source. The server requires Node.js to run and will automatically load environment variables from the .env file in the project root.
Required Scopes
Different features require different OAuth scopes:
Basic search and content retrieval: No user scopes needed (uses Client Credentials)
Playback control:
user-modify-playback-state,user-read-playback-stateUser profile:
user-read-private,user-read-emailLibrary access:
user-library-read,user-library-modifyPlaylist management:
playlist-read-private,playlist-modify-public,playlist-modify-private
Development
Project Structure
spotify-mcp/
├── src/
│ ├── index.ts # Main server implementation
│ ├── auth.ts # OAuth authentication logic
│ └── playback-tools.ts # Playback control tools
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.mdBuilding
npm run buildTesting
The server uses stdio transport for communication with MCP clients. You can test it using any MCP-compatible client.
License
ISC
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sespinosa/spotify-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server