Spotify MCP Server
Used for loading environment variables from .env files to securely store Spotify API credentials.
Used for version control and cloning the repository during installation.
The server is built on Node.js runtime to create the MCP interface for Spotify.
Used for package management and running scripts to build and start the MCP server.
Provides tools for searching tracks, controlling playback (play/pause specific tracks), retrieving current playback state, and managing playlists through the Spotify Web API.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Spotify MCP Server
A Node.js-based server that integrates with the Spotify Web API and the Model Context Protocol (MCP) to provide tools for searching, controlling playback, and managing Spotify content. It allows users to interact with their Spotify account programmatically via a standardized MCP interface over stdio transport.
🧠 Project Overview
Name: Spotify MCP Server
Description: A programmable interface that connects Spotify Web API with the MCP standard, enabling search, playback control, and playlist management using JSON-based tools over stdio.
Key Features:
🔍 Search for tracks on Spotify
🎵 Check current playback state
▶️ Play specific tracks by URI
📋 Retrieve user playlists
⏸ Pause ongoing playback
🔐 OAuth authentication with Spotify
📉 Rate limit handling for Spotify API requests
Related MCP server: MCP Spotify Player
⚙️ Prerequisites
Node.js (v16 or higher recommended)
A Spotify Developer Account with app credentials
npm (Node Package Manager)
📦 Installation Steps
# 1. Clone the repository
git clone <repository-url>
cd spotify-mcp
# 2. Install dependencies
npm install
# 3. Create a .env file and add the following:SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
SPOTIFY_REDIRECT_URI=http://localhost:8888/callbackNote: Replace
your_spotify_client_idandyour_spotify_client_secretwith your Spotify Developer app credentials. The redirect URI must match the one set in your Spotify app settings.
# 4. Build
npm run build
# 5. Run the server
npm startThis will open a browser for Spotify authentication and start the server using stdio transport.
🔧 Tools
1. search_tracks
Description: Search for tracks on Spotify based on a query string.
Input Schema:
query(string, required): Search term (e.g., artist name, song title).
Output: JSON array of up to 5 track objects with
name,artist,album,release_date,popularity,id, anduri.Example:
{
"name": "search_tracks",
"arguments": {"query": "The Beatles"}
}2. get_playback_state
Description: Retrieve the current playback state of the user's Spotify account.
Input Schema: None
Output: JSON object with current track info, playback status, and device details, or "No active playback" if nothing is playing.
Example:
{
"name": "get_playback_state",
"arguments": {}
}3. play_track
Description: Play a specific track using its Spotify URI.
Input Schema:
uri(string, required): Spotify track URI (e.g.,spotify:track:xxx).
Output: JSON confirmation with
statusanduri.Example:
{
"name": "play_track",
"arguments": {"uri": "spotify:track:7KXjTSCq5nL1LoYtL7XAwS"}
}4. get_user_playlists
Description: Fetch the user's playlists from Spotify.
Input Schema:
limit(number, optional): Maximum number of playlists to return (default: 20).
Output: JSON array of playlist objects with
name,id,track_count,uri, andpublicstatus.Example:
{
"name": "get_user_playlists",
"arguments": {"limit": 10}
}5. pause_playback
Description: Pause the current playback on the user's active Spotify device.
Input Schema: None
Output: JSON confirmation with "Playback paused" status.
Example:
{
"name": "pause_playback",
"arguments": {}
}🌐 Use Cases
Music Discovery Bot:
Use
search_tracksandplay_trackto implement mood-based music chatbots.
Playlist Management Tool:
Use
get_user_playlistsandsearch_tracksto preview and organize playlists.
Playback Control Automation:
Automate playback actions using
get_playback_state,play_track, andpause_playback.
Spotify Dashboard:
Build a desktop widget using
get_playback_state,get_user_playlists,pause_playback, andplay_track.
Learning Spotify API:
Experiment with all tools to learn how the Spotify Web API works.
🔐 Authentication Details
On first run, the server opens a browser for Spotify OAuth authentication.
Receives code via
http://localhost:8888/callback.Exchanges the code for access and refresh tokens.
Automatically refreshes tokens within 5 minutes of expiration.
⏱ Rate Limiting
Handles Spotify API rate limits with retry strategies:
10-second cooldown after each request.
1-minute wait if a 429 Too Many Requests error occurs.
📊 Dependencies
npm install dotenv spotify-web-api-node @modelcontextprotocol/sdk opendotenv: Loads environment variables from.env.spotify-web-api-node: Spotify API client.@modelcontextprotocol/sdk: Implements the MCP server.http,url: Node.js built-ins for OAuth redirect server.open: Opens default browser for authentication.
📁 Development Info
Entry Point:
index.jsLanguage: JavaScript (Node.js with ES modules)
Run Command:
node index.jsDebugging: Check console logs for MCP or authentication errors.
⚠️ Limitations
Spotify Premium is required for playback control.
Supports only stdio transport (no HTTP, WebSocket, etc.).
search_tracksreturns max 5 results.Assumes a single active device for playback.
🚀 Contributing
Feel free to open issues or submit pull requests to:
Add new tools
Enhance existing functionality
Improve documentation
✍️ License
MIT License — free to use, modify, and distribute for personal or commercial use.
❤️ Footer
Built with ❤️ by Rakshitha C Devadiga on March 17, 2025
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
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 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 MCP — Web API via client_credentials OAuth
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables creating and searching Spotify playlists through natural language using the Model Context Protocol.21-
- AlicenseNot gradedqualityDmaintenanceControl Spotify directly from your AI assistant using the Model Context Protocol.22MIT
- AlicenseAqualityDmaintenanceEnables searching and managing Spotify playlists, tracks, and user information through the Spotify Web API.10MIT
- AlicenseNot gradedqualityCmaintenanceEnables control of Spotify playback via the official Web API, including search/play, pause, skip, volume, queue, and device management.118 npm1MIT