matthensleyio/Spotify.MCP
If you are the rightful owner of Spotify.MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that provides tools to interact with the Spotify Web API, exposing various Spotify endpoints as MCP tools for MCP-compatible clients.
Spotify MCP Server
A Model Context Protocol (MCP) server that provides tools to interact with the Spotify Web API. This server exposes various Spotify endpoints as MCP tools that can be used by MCP-compatible clients.
Features
This MCP server provides tools for:
Authentication
get_auth_url
- Generate authorization URLs for OAuth flowexchange_auth_code
- Exchange authorization codes for access tokensrefresh_token
- Refresh expired access tokensget_client_token
- Get access tokens for public data
Track Management
get_track
- Get details about a specific trackget_tracks
- Get details about multiple tracksget_audio_features
- Get audio features for a trackget_multiple_audio_features
- Get audio features for multiple tracks
Artist Management
get_artist
- Get details about an artistget_artist_albums
- Get all albums by an artistget_artist_top_tracks
- Get top tracks for an artist
Album Management
get_album
- Get details about an albumget_album_tracks
- Get all tracks from an album
Audiobook Management
get_audiobook
- Get details about an audiobookget_audiobooks
- Get details about multiple audiobooksget_audiobook_chapters
- Get chapters from an audiobookget_saved_audiobooks
- Get user's saved audiobooks (requires user token)save_audiobooks
- Save audiobooks to user's library (requires user token)remove_saved_audiobooks
- Remove audiobooks from user's library (requires user token)check_saved_audiobooks
- Check if audiobooks are in user's library (requires user token)
Playlist Management
get_playlist
- Get details about a playlistget_user_playlists
- Get user's playlists (requires user token)
Search
search
- Search for tracks, albums, artists, playlists, or audiobookssearch_tracks
- Search specifically for trackssearch_artists
- Search specifically for artistssearch_albums
- Search specifically for albumssearch_playlists
- Search specifically for playlistssearch_audiobooks
- Search specifically for audiobooks
Player Control (requires user authentication)
get_playback
- Get current playback statepause_playback
- Pause playbackstart_playback
- Start/resume playbackskip_next
- Skip to next trackskip_previous
- Skip to previous track
User Profile
get_current_user
- Get current user's profile
Setup
-
Spotify App Registration
- Go to Spotify Developer Dashboard
- Create a new app
- Note your Client ID and Client Secret
-
Configuration
- Update
appsettings.json
with your Spotify credentials:
{ "Spotify": { "ClientId": "your_client_id_here", "ClientSecret": "your_client_secret_here" } }
- Update
-
Build and Run
dotnet build dotnet run
Claude Desktop Integration
To use this MCP server with Claude Desktop, add it to your Claude Desktop configuration file.
Configuration File Location
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Configuration Example
Add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"spotify": {
"command": "dotnet",
"args": [
"run",
"--project", "C:\\path\\to\\your\\Spotify.MCP.Host\\Spotify.MCP.Host.csproj",
"--",
"--spotify-client-id", "your_spotify_client_id_here",
"--spotify-client-secret", "your_spotify_client_secret_here"
],
"icon": "file://C:\\path\\to\\your\\Spotify.MCP.Host\\assets\\spotify-icon.png"
}
}
}
Alternative: Using Built Executable
If you prefer to use the compiled executable:
{
"mcpServers": {
"spotify": {
"command": "C:\\path\\to\\your\\Spotify.MCP.Host.exe",
"args": [
"--spotify-client-id", "your_spotify_client_id_here",
"--spotify-client-secret", "your_spotify_client_secret_here"
],
"icon": "file://C:\\path\\to\\your\\Spotify.MCP.Host\\assets\\spotify-icon.png"
}
}
}
Setup Steps
- Replace
C:\\path\\to\\your\\
with the actual path to your project (in both the command and icon paths) - Replace
your_spotify_client_id_here
with your actual Spotify Client ID - Replace
your_spotify_client_secret_here
with your actual Spotify Client Secret - Save the configuration file
- Restart Claude Desktop
Once configured, you'll see the Spotify MCP server connected in Claude Desktop with the Spotify logo, and you'll be able to use all the Spotify tools directly in your conversations!
Usage
Public Data Access
Many endpoints work with just client credentials (no user authentication required):
- Track information
- Artist information
- Album information
- Audiobook information (market restrictions apply)
- Search functionality
User-Specific Data
Some endpoints require user authentication and appropriate scopes:
- User playlists
- User's saved audiobooks
- Playback control
- User profile information
Authentication Flow
- Use
get_auth_url
to generate an authorization URL - User visits the URL and authorizes your app
- Use
exchange_auth_code
to get access and refresh tokens - Use the access token for user-specific API calls
- Use
refresh_token
when the access token expires
Required Scopes
Different operations require different Spotify scopes:
user-read-private
- Read user profile datauser-read-email
- Read user emailplaylist-read-private
- Read private playlistsplaylist-read-collaborative
- Read collaborative playlistsuser-read-playback-state
- Read playback stateuser-modify-playback-state
- Control playbackuser-read-currently-playing
- Read currently playing trackuser-library-read
- Read user's saved audiobooksuser-library-modify
- Save/remove user's audiobooks
Notes
- The server uses client credentials flow by default for public data
- User authentication is required for personal data and playback control
- All responses are returned as formatted JSON strings
- Error handling is built into each tool with descriptive error messages
- The server supports both standalone track IDs and full Spotify URIs
- Audiobook availability: Audiobooks are only available in select markets (US, UK, Canada, Ireland, New Zealand, Australia)
- Market parameter is important for audiobook endpoints to ensure content availability
Dependencies
- .NET 9.0
- Microsoft.Extensions.Hosting
- Microsoft.Extensions.Http
- ModelContextProtocol
- System.Text.Json