Spotify MCP Server
Provides tools for controlling Spotify playback, searching for tracks/albums/artists/playlists, managing playlists, queue, and devices.
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 liked songs 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
This package provides an MCP-compatible server exposing Spotify controls and queries via the Model Context Protocol (MCP).
Quick overview:
src/spotify_mcp_server/server.py— FastMCP server exposing tools for playback, search, queue, playlists and devices.Tools advertise their input schemas using Pydantic models so MCP clients can introspect them.
Running tests (recommended in a virtualenv):
# create and activate venv (macOS/Linux)
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
python -m pytest -qStart server locally (prints OAuth URL):
# Start in package root
python -m src.spotify_mcp_server.serverCI: a GitHub Actions workflow is included that installs dependencies and runs the test suite.
If you want additional changes (improved docs, example client calls, Dockerfile), tell me which and I'll add them.
Spotify MCP Server
A MCP (Model Context Protocol) server for controlling Spotify playback, searching for content, and managing playlists.
Features
OAuth authentication with Spotify
Playback control (play, pause, skip, queue management)
Search for tracks, albums, artists, and playlists
Playlist management (create, edit, add/remove tracks)
Device management
Prerequisites
Python 3.10+
Spotify Developer Account
Spotify Premium Account (required for playback control)
Setup
Spotify Developer Setup
Create a new app
Add
http://127.0.0.1:8080/callbackto your app's redirect URIsNote your Client ID and Client Secret
Environment Variables
Create a .env file in the project root with the following variables:
SPOTIFY_CLIENT_ID=your_client_id
SPOTIFY_CLIENT_SECRET=your_client_secret
SPOTIFY_REDIRECT_URI=http://127.0.0.1:8080/callbackInstallation
Install dependencies:
pip install -e .Run the server:
python -m spotify_mcp_server.serverOr using uvicorn directly:
uvicorn spotify_mcp_server.server:app --host 0.0.0.0 --port 8080Follow the authentication instructions printed in the console
Usage
The server exposes several MCP tools that can be used to control Spotify:
SpotifyPlayback: Control playback (get current track, start, pause, skip)SpotifySearch: Search for tracks, albums, artists, or playlistsSpotifyQueue: Manage the playback queueSpotifyGetInfo: Get detailed information about Spotify itemsSpotifyPlaylist: Manage playlistsSpotifyDevices: Get available devices
Project Structure
The server consists of several modules located in src/spotify_mcp_server/:
server.py: FastMCP server implementation with MCP tool handlersspotify_api.py: Spotify API client with OAuth handling and API interactionsspotify_helper.py: Comprehensive helper functions and utilitieslogging_config.py: Structured logging configuration
Authentication Flow
Start the server
Open the OAuth URL printed in the console
Authenticate with Spotify
The server will cache your authentication token
Server is ready to handle MCP requests
Testing
The project includes comprehensive unit and integration tests.
Installing Test Dependencies
To install the package with test dependencies:
# Install in editable mode with test dependencies
pip install -e ".[test]"Running Tests
Quick test run:
pytestRun with coverage:
pytest --cov=src/spotify_mcp_server --cov-report=term-missing --cov-report=htmlRun specific test types:
# Unit tests only
pytest tests/test_spotify_helper.py tests/test_spotify_api.py tests/test_server.py
# Integration tests only
pytest tests/test_integration.py
# Specific test file
pytest tests/test_spotify_helper.py
# Specific test function
pytest tests/test_spotify_helper.py::TestNormalizeRedirectUri::test_normalize_redirect_uri_localhost_to_127_0_0_1Using the test runner script:
# Run all tests with coverage
python run_tests.py --coverage
# Run only unit tests
python run_tests.py --type unit
# Run only integration tests
python run_tests.py --type integration
# Fast run without coverage
python run_tests.py --fast
# Verbose output
python run_tests.py --verbose
# Run specific test file
python run_tests.py --file test_spotify_helper.py
# Run specific test function
python run_tests.py --function test_normalize_redirect_uriInspired by
Inspired by the work of varunneal on his spotify-mcp
This server cannot be installed
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
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/garywwh/spotify_mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server