The Spotify MCP Server enables natural language control of Spotify through the Model Context Protocol, allowing comprehensive music playback and management via voice or text commands.
Capabilities:
Play Content - Play specific playlists, albums, or tracks by name with optional artist filtering
Search Music - Find tracks, albums, and artists using queries with customizable result limits
Playback Control - Play, pause, skip forward/backward, and adjust volume (0-100%)
Now Playing Info - Get details about the currently playing track
Sleep Timer - Set automatic playback pause after a specified duration in minutes
Timer Management - Cancel (specific or all) and list active sleep timers
Multi-Device Support - Target specific Spotify devices for playback control
Enables Siri voice command integration through Apple Shortcuts via an HTTP bridge, allowing voice-controlled Spotify operations on iOS devices.
Provides comprehensive Spotify control including playlist/album/track playback, music search, playback control (play, pause, skip, volume), current track information, and sleep timer functionality.
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 Serverplay 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 for Gemini CLI
A Model Context Protocol (MCP) server that enables Google Gemini CLI to control Spotify through natural language commands.
Features
Play Control: Play playlists, albums, and tracks
Search: Find music by song, artist, or album
Playback Control: Play, pause, skip, and adjust volume
Sleep Timer: Automatically pause playback after a specified duration
Prerequisites
Node.js 18+
npm or yarn
Spotify Developer account
Google Gemini CLI installed (
npm install -g @google/gemini-cli)
Quick Start
1. Install Dependencies
2. Spotify Developer Setup
Create a new app
Copy your Client ID and Client Secret
Click "Edit Settings" → Add redirect URI:
http://127.0.0.1:3000/callbackClick "Save"
Important: Spotify requires 127.0.0.1 (not localhost) for redirect URIs.
3. Configure Environment
Create a .env file in the project root:
4. Authenticate
This opens your browser for Spotify authorization and saves tokens to tokens.json (one-time setup).
5. Configure Gemini CLI
Generate .gemini/settings.json from your .env file:
This script automatically:
Reads your
.envfileCreates
.gemini/settings.jsonwith the correct paths and API keysPopulates all environment variables from your
.envfile
Note: Run npm run setup:gemini again whenever you update your .env file or after building the project.
6. Use It!
Once configured, start Gemini CLI and ask:
"Play my Discover Weekly playlist"
"Search for songs by The Beatles"
"Pause Spotify"
"Set a 30 minute sleep timer"
"What's currently playing?"
Available MCP Tools
play_playlist- Play a playlist by nameplay_album- Play an album by nameplay_track- Play a track by namesearch_music- Search for musiccontrol_playback- Control playback (play, pause, skip, volume)get_current_playing- Get currently playing trackset_sleep_timer- Set a sleep timercancel_sleep_timer- Cancel active timersget_active_timers- List active timers
Troubleshooting
Authentication Issues
Redirect URI mismatch: Ensure
.envand Spotify Dashboard have the exact same URI (http://127.0.0.1:3000/callback)Invalid redirect URI: Must use
127.0.0.1notlocalhost(Spotify requirement)Token expired: Delete
tokens.jsonand runnpm run authagain
Gemini CLI Not Finding Server
Verify absolute path to
dist/server.jsis correctCheck environment variables are set (if using Method 2)
Ensure Node.js is in PATH
Test server manually:
node dist/server.js(should start without errors)
Server Errors
Make sure Spotify app is open and a device is active
Verify
tokens.jsonexists and is validCheck network connectivity