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 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/playlists
  • Get info about a track/album/artist/playlist
  • Manage the Spotify queue

Demo

Make sure to turn on audio.

Configuration

Getting Spotify API Keys

Create an account on developer.spotify.com. Navigate to the dashboard.
Create an app with redirect_uri as http://localhost:8888. (You can choose any port but must use http and localhost).
Set "APIs used" to "Web Playback SDK".

Run this project locally

This project is not yet set up for ephemeral environments (e.g. uvx usage).
Run this project locally by cloning this repo:

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
"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 can't get this MCP working, consider the following:

  1. Ensure uv is updated (recommended version >=0.54).
  2. Ensure Claude has execution permissions for the project: chmod -R 755.
  3. Have Spotify premium (required for running developer API).

This MCP will emit logs to stderr as specified in the MCP spec.

You can launch the MCP Inspector via npm with:

npx @modelcontextprotocol/inspector uv --directory /path/to/spotify_mcp run spotify-mcp

The Inspector will display a URL for browser debugging.

TODO

Some features have been deprecated from the Spotify API. Future updates will focus on minor improvements and project health:

  • Tests
  • Adding API support for managing playlists
  • Adding API support for paginated search results/playlists/albums

PRs appreciated!

Deployment

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This creates source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:
uv publish

You need to set PyPI credentials via environment variables or command flags:

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