MCP HubMCP Hub
varunneal

spotify-mcp

by: varunneal

MCP to connect Claude with Spotify.

203created 01/12/2024
Visit
integration
API

📌Overview

Purpose: To create a framework that connects Claude with Spotify, leveraging the Spotipy API to enhance music playback capabilities.

Overview: The Spotify MCP server facilitates interaction with Spotify's music streaming service, allowing users to control playback, search for music, and manage their Spotify queue through a unified interface.

Key Features:

  • Playback Control: Start, pause, and skip songs, enabling seamless music enjoyment without direct interaction with the Spotify app.

  • Music Search: Search for tracks, albums, artists, and playlists, making it easy to discover new music or access existing favorites.

  • Information Retrieval: Get detailed information about tracks, albums, artists, and playlists, enhancing users' knowledge and engagement with music content.

  • Queue Management: Organize and manage the Spotify queue, offering customized playback experiences tailored to user preferences.


Spotify MCP Server

MCP project to connect Claude with Spotify, built on top of spotipy-dev's API.

Features

  • Start, pause, and skip playback
  • Search for tracks, albums, artists, and playlists
  • Get information about tracks, albums, artists, or playlists
  • Manage the Spotify queue

Configuration

Getting Spotify API Keys

  1. Create an account on developer.spotify.com.
  2. Navigate to the dashboard.
  3. Create an app with redirect_uri set to http://localhost:8888.

Running the Project Locally

Clone this repo to run the project locally:

git clone https://github.com/varunneal/spotify-mcp.git

Add this tool as an MCP server:

  • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • On Windows: %APPDATA%/Claude/claude_desktop_config.json

Example configuration:

"spotify": {
    "command": "uv",
    "args": [
        "--directory",
        "/path/to/spotify_mcp",
        "run",
        "spotify-mcp"
    ],
    "env": {
        "SPOTIFY_CLIENT_ID": "YOUR_CLIENT_ID",
        "SPOTIFY_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
        "SPOTIFY_REDIRECT_URI": "http://localhost:8888"
    }
}

Troubleshooting

If you encounter issues:

  1. Ensure uv is updated (recommended version >=0.54).
  2. Check that Claude has execution permissions: chmod -R 755.
  3. Confirm you have Spotify Premium for API usage.

TODO

  • Adding tests.
  • API support for managing playlists.
  • API support for paginated search results for playlists and albums.

PRs appreciated!

Deployment

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update the lockfile:

    uv sync
    
  2. Build package distributions:

    uv build
    
  3. Publish to PyPI:

    uv publish
    

Note: Set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD