Spotify MCP server

Integrates with Spotify to enable music search, playback control, and playlist management for Premium users through specialized tools that work with any active Spotify device.
Back to servers
Setup instructions
Provider
EJ Fox
Release date
Mar 23, 2025
Language
TypeScript
Stats
1 star

The Vulpes Spotify MCP Server enables AI assistants like Claude to interact with Spotify, allowing them to search for and play tracks, manage playlists, and control playback on your Spotify devices.

Features

  • Search for tracks by artist, title, or custom query
  • Play tracks directly on your active Spotify device
  • Get information about your currently playing track
  • Find available Spotify playback devices
  • Search and play tracks in a single operation
  • List and access your Spotify playlists
  • View tracks within specific playlists
  • Play playlists (with optional shuffle mode)
  • Find and play playlists by name

Requirements

  • Node.js (v16+)
  • Spotify Developer Account
  • Spotify Premium account (for playback functionality)
  • An MCP-compatible client (e.g., Claude Desktop)

Installation

Installing via Smithery

The easiest way to install the Vulpes Spotify Server for Claude Desktop is via Smithery:

npx -y @smithery/cli install @ejfox/vulpes-spotify-mcp --client claude

Manual Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/spotify-mcp.git
    cd spotify-mcp
    
  2. Install dependencies:

    npm install
    
  3. Create a .env file with your Spotify API credentials:

    SPOTIFY_CLIENT_ID=your_client_id
    SPOTIFY_CLIENT_SECRET=your_client_secret
    SPOTIFY_REDIRECT_URI=http://localhost:8888
    
    # Optional: For playback control
    SPOTIFY_REFRESH_TOKEN=your_refresh_token
    

    You can obtain your Client ID and Secret from the Spotify Developer Dashboard.

  4. Generate a refresh token (required for playback control) using one of these methods:

    Option 1: Use the built-in script

    npm run get-token
    

    Option 2: Use the simple script

    node src/simple-auth.js
    
  5. Add the generated refresh token to your .env file:

    SPOTIFY_REFRESH_TOKEN=your_refresh_token
    
  6. Build the project:

    npm run build
    

Setting Up Claude Desktop

  1. Ensure Spotify is open and playing on your device

  2. Add this server to your Claude Desktop configuration by editing your claude_desktop_config.json file:

    {
      "mcpServers": {
        "spotify": {
          "command": "node",
          "args": ["/absolute/path/to/vulpes-spotify-mcp/dist/index.js"],
          "env": {
            "SPOTIFY_CLIENT_ID": "your_client_id",
            "SPOTIFY_CLIENT_SECRET": "your_client_secret",
            "SPOTIFY_REDIRECT_URI": "http://localhost:8888",
            "SPOTIFY_REFRESH_TOKEN": "your_refresh_token"
          }
        }
      }
    }
    

    Replace /absolute/path/to/vulpes-spotify-mcp with the actual path to the project.

  3. Restart Claude Desktop

  4. The Spotify tools should now appear when you click on the hammer icon in Claude Desktop

Available Tools

Searching and Playback

  • spotify-search: Search for tracks by query
  • spotify-play: Play a specific track by ID or URI
  • spotify-currently-playing: Get information about the currently playing track
  • spotify-devices: List available Spotify playback devices
  • spotify-search-and-play: Search for a track and automatically play the top result

Playlist Management

  • spotify-playlists: Get a list of the user's Spotify playlists
  • spotify-playlist-tracks: Get tracks from a specific playlist
  • spotify-play-playlist: Play a specific playlist (with optional shuffle)
  • spotify-find-playlist: Find a playlist by name and play it (recommended for AI use)

Troubleshooting

  • "No active device found": Ensure Spotify is open and playing on at least one device
  • "Missing permissions": Your refresh token may not have the required scopes
  • "Not premium": Playback control requires a Spotify Premium account
  • "Issues with refresh token": Generate a new refresh token using the steps in the installation section

Important Tips

  • Always keep Spotify open on at least one device before using playback controls
  • The refresh token must match in both your .env file and Claude Desktop config
  • Restart Claude Desktop after making configuration changes

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "spotify" '{"command":"node","args":["/absolute/path/to/vulpes-spotify-mcp/dist/index.js"],"env":{"SPOTIFY_CLIENT_ID":"your_client_id","SPOTIFY_CLIENT_SECRET":"your_client_secret","SPOTIFY_REDIRECT_URI":"http://localhost:8888","SPOTIFY_REFRESH_TOKEN":"your_refresh_token"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "spotify": {
            "command": "node",
            "args": [
                "/absolute/path/to/vulpes-spotify-mcp/dist/index.js"
            ],
            "env": {
                "SPOTIFY_CLIENT_ID": "your_client_id",
                "SPOTIFY_CLIENT_SECRET": "your_client_secret",
                "SPOTIFY_REDIRECT_URI": "http://localhost:8888",
                "SPOTIFY_REFRESH_TOKEN": "your_refresh_token"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "spotify": {
            "command": "node",
            "args": [
                "/absolute/path/to/vulpes-spotify-mcp/dist/index.js"
            ],
            "env": {
                "SPOTIFY_CLIENT_ID": "your_client_id",
                "SPOTIFY_CLIENT_SECRET": "your_client_secret",
                "SPOTIFY_REDIRECT_URI": "http://localhost:8888",
                "SPOTIFY_REFRESH_TOKEN": "your_refresh_token"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later