Logo van MCP Claude Spotify

MCP Claude Spotify

Community
imprvhub

An integration that allows Claude Desktop to interact with Spotify using the Model Context Protocol (MCP).

Uitgeverimprvhub
Repositorymcp-claude-spotify
TaalTypeScript
Forks
19
Sterren
49
Beschikbare tools
0
Transporttypestdio, streamable-http
Categorieën
LicentieMPL-2.0
Links
  • Koppel tools aan AI-workflows

    MCP Claude Spotify biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    49 sterren en 19 forks in de gekoppelde repository.

MCP Claude Spotify

Trust Score Verified on MseeP smithery badge

Features

  • Spotify authentication
  • Search for tracks, albums, artists, and playlists
  • Playback control (play, pause, next, previous)
  • Full playlist management (create, update, delete, reorder tracks, manage cover images)
  • Get personalized recommendations
  • Access user's top played tracks over different time periods
  • View recently played tracks

Demo

Requirements

  • Node.js 16 or higher
  • Spotify account
  • Claude Desktop
  • Spotify API credentials (Client ID and Client Secret)

Installation

Installing via Smithery

To install MCP Claude Spotify for Claude Desktop automatically via Smithery:

bash
npx -y @smithery/cli install @imprvhub/mcp-claude-spotify --client claude

Installing Manually

  1. Clone or download this repository:
bash
git clone https://github.com/imprvhub/mcp-claude-spotify
cd claude-spotify-mcp
  1. Install dependencies:
bash
npm install
  1. Build the project (if you want to modify the source code):
bash
npm run build

The repository already includes pre-built files in the build directory, so you can skip step 3 if you don't plan to modify the source code.

Setting up Spotify Credentials

To use this MCP, you need to obtain Spotify API credentials:

  1. Go to Spotify Developer Dashboard
  2. Log in with your Spotify account
  3. Click "Create App"
  4. Fill in your app information:
    • App name: "MCP Claude Spotify" (or whatever you prefer)
    • App description: "Spotify integration for Claude Desktop"
    • Website: You can leave this blank or put any URL
    • Redirect URI: Important - Add http://127.0.0.1:8888/callback
  5. Accept the terms and conditions and click "Create"
  6. In your app dashboard, you'll see the "Client ID"
  7. Click "Show Client Secret" to reveal your "Client Secret"

Save these credentials as you'll need them for configuration.

Running the MCP Server

There are two ways to run the MCP server:

Option 1: Running manually (recommended for first-time setup and troubleshooting)

  1. Open a terminal or command prompt
  2. Navigate to the project directory
  3. Run the server directly:
bash
node build/index.js

Keep this terminal window open while using Claude Desktop. The server will run until you close the terminal.

Option 2: Auto-starting with Claude Desktop (recommended for regular use)

The Claude Desktop can automatically start the MCP server when needed. To set this up:

Configuration

The Claude Desktop configuration file is located at:

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

Edit this file to add the Spotify MCP configuration. If the file doesn't exist, create it:

json
{
  "mcpServers": {
    "spotify": {
      "command": "node",
      "args": ["ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js"],
      "env": {
        "SPOTIFY_CLIENT_ID": "your_client_id_here",
        "SPOTIFY_CLIENT_SECRET": "your_client_secret_here"
      }
    }
  }
}

Important: Replace:

  • ABSOLUTE_PATH_TO_DIRECTORY with the complete absolute path where you installed the MCP
    • macOS/Linux example: /Users/username/mcp-claude-spotify
    • Windows example: C:\\Users\\username\\mcp-claude-spotify
  • your_client_id_here with the Client ID you obtained from Spotify
  • your_client_secret_here with the Client Secret you obtained from Spotify

If you already have other MCPs configured, simply add the "spotify" section inside the "mcpServers" object.

Setting up auto-start scripts (Optional)

For a more reliable experience, you can set up auto-start scripts:

  1. Create a file named start-spotify-mcp.bat in the project directory with the following content:
@echo off
cd %~dp0
node build/index.js
  1. Create a shortcut to this BAT file
  2. Press Win+R, type shell:startup and press Enter
  3. Move the shortcut to this folder to have it start with Windows
  1. Create a file named com.spotify.mcp.plist in ~/Library/LaunchAgents/ with the following content:
xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.spotify.mcp</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/node</string>
        <string>ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/tmp/spotify-mcp.err</string>
    <key>StandardOutPath</key>
    <string>/tmp/spotify-mcp.out</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>SPOTIFY_CLIENT_ID</key>
        <string>your_client_id_here</string>
        <key>SPOTIFY_CLIENT_SECRET</key>
        <string>your_client_secret_here</string>
    </dict>
</dict>
</plist>
  1. Replace the path and credentials with your actual values
  2. Load the agent with: launchctl load ~/Library/LaunchAgents/com.spotify.mcp.plist
  1. Create a file named spotify-mcp.service in ~/.config/systemd/user/ (create the directory if it doesn't exist):
[Unit]
Description=Spotify MCP Server for Claude Desktop
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/node ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js
Restart=on-failure
Environment="SPOTIFY_CLIENT_ID=your_client_id_here"
Environment="SPOTIFY_CLIENT_SECRET=your_client_secret_here"

[Install]
WantedBy=default.target
  1. Replace the path and credentials with your actual values
  2. Enable and start the service:
bash
systemctl --user enable spotify-mcp.service
systemctl --user start spotify-mcp.service
  1. Check status with:
bash
systemctl --user status spotify-mcp.service

Usage

  1. Restart Claude Desktop after modifying the configuration
  2. In Claude, use the auth-spotify command to start the authentication process
  3. A browser window will open for you to authorize the application
  4. Log in with your Spotify account and authorize the application
  5. Important: After successful authentication, restart Claude Desktop to properly initialize the MCP's tool registry and WebSocket session token cache
  6. After restarting, all Spotify MCP tools will be properly registered and available for use

The MCP server runs as a child process managed by Claude Desktop. When Claude is running, it automatically starts and manages the Node.js server process based on the configuration in claude_desktop_config.json.

Available Tools

Authentication

auth-spotify

Initiates the Spotify authentication process.

Search

search-spotify

Searches for tracks, albums, artists, or playlists.

Parameters:

  • query: Search text
  • type: Type of search (track, album, artist, playlist)
  • limit: Number of results (1-10, default: 5)

Playback Control

get-current-playback

Gets information about the current playback state.

play-track

Plays a specific track on an active device.

Parameters:

  • trackId: Spotify track ID
  • deviceId: (Optional) Spotify device ID to play on

pause-playback

Pauses the current playback.

next-track

Skips to the next track.

previous-track

Returns to the previous track.

Playlist Management

get-user-playlists

Gets a list of the user's playlists.

Parameters:

  • limit: (Optional) Number of playlists to return (1-50, default: 20)
  • offset: (Optional) Index of the first playlist to return (default: 0)

create-playlist

Creates a new playlist for the current user.

Parameters:

  • name: Playlist name
  • description: (Optional) Description
  • public: (Optional) Whether it's public or private

update-playlist

Updates a playlist's name, description, public/private status, or collaborative setting.

Parameters:

  • playlistId: Spotify ID of the playlist
  • name: (Optional) New name for the playlist
  • description: (Optional) New description for the playlist
  • public: (Optional) Whether the playlist should be public
  • collaborative: (Optional) Whether the playlist should be collaborative (must set public to false first)

delete-playlist

Unfollows (removes) a playlist from your library. The playlist still exists on Spotify but is no longer in your library.

Parameters:

  • playlistId: Spotify ID of the playlist

get-playlist-tracks

Gets the tracks in a playlist with pagination support.

Parameters:

  • playlistId: Spotify ID of the playlist
  • limit: (Optional) Number of tracks to return (1-50, default: 20)
  • offset: (Optional) Index of the first track to return (default: 0)

add-tracks-to-playlist

Adds tracks to a playlist.

Parameters:

  • playlistId: Playlist ID
  • trackIds: Array of track IDs

remove-tracks-from-playlist

Removes tracks from a playlist.

Parameters:

  • playlistId: Spotify ID of the playlist
  • trackIds: Array of Spotify track IDs to remove

reorder-playlist-tracks

Reorders tracks in a playlist by moving a range of tracks to a new position.

Parameters:

  • playlistId: Spotify ID of the playlist
  • rangeStart: Position of the first track to move
  • insertBefore: Position where the tracks should be inserted
  • rangeLength: (Optional) Number of tracks to move (default: 1)

get-playlist-cover

Gets the cover image of a playlist.

Parameters:

  • playlistId: Spotify ID of the playlist

upload-playlist-cover

Uploads a custom cover image for a playlist (base64 encoded JPEG, max 256KB).

Parameters:

  • playlistId: Spotify ID of the playlist
  • imageBase64: Base64 encoded JPEG image

Discovery & History

get-recommendations

Gets track recommendations based on seed tracks, artists, or genres.

Parameters:

  • seedTracks: (Optional) Array of Spotify track IDs
  • seedArtists: (Optional) Array of Spotify artist IDs
  • seedGenres: (Optional) Array of genre names
  • limit: (Optional) Number of recommendations (1-100, default: 20)

get-top-tracks

Gets the user's most played tracks over a specified time range.

Parameters:

  • limit: (Optional) Number of tracks to return (1-50, default: 20)
  • offset: (Optional) Index of the first track to return (default: 0)
  • time_range: (Optional) Time frame for calculating affinity:
    • short_term: Approximately last 4 weeks
    • medium_term: Approximately last 6 months (default)
    • long_term: Several years of data

get-recently-played

Gets the user's recently played tracks.

Parameters:

  • limit: (Optional) Maximum number of tracks to return (1-50, default: 20)
  • before: (Optional) Unix timestamp in milliseconds. Returns tracks played before this time
  • after: (Optional) Unix timestamp in milliseconds. Returns tracks played after this time

Troubleshooting

"Server disconnected" error

If you see the error "MCP Spotify: Server disconnected" in Claude Desktop:

  1. Verify the server is running:

    • Open a terminal and manually run node build/index.js from the project directory
    • If the server starts successfully, use Claude while keeping this terminal open
  2. Check your configuration:

    • Ensure the absolute path in claude_desktop_config.json is correct for your system
    • Double-check that you've used double backslashes (\\) for Windows paths
    • Verify you're using the complete path from the root of your filesystem
  3. Try the auto-start option:

    • Set up the auto-start script for your operating system as described in the "Setting up auto-start scripts" section
    • This ensures the server is always running when you need it

Browser doesn't open automatically

If the browser doesn't open automatically during authentication, manually visit: http://127.0.0.1:8888/login

Authentication error

Make sure you've correctly configured the redirect URI in your Spotify Developer dashboard: http://127.0.0.1:8888/callback

Server startup error

Verify that:

  • Environment variables are correctly configured in your claude_desktop_config.json or launch script
  • Node.js is installed and compatible (v16+)
  • Required ports (8888) are available and not blocked by firewall
  • You have permission to run the script in the specified location

Tools not appearing in Claude

If the Spotify tools don't appear in Claude after authentication:

  • Make sure you've restarted Claude Desktop after successful authentication
  • Check the Claude Desktop logs for any MCP communication errors
  • Ensure the MCP server process is running (run it manually to confirm)
  • Verify that the MCP server is correctly registered in the Claude Desktop MCP registry

Checking if the server is running

To check if the server is running:

  • Windows: Open Task Manager, go to the "Details" tab, and look for "node.exe"
  • macOS/Linux: Open Terminal and run ps aux | grep node

If you don't see the server running, start it manually or use the auto-start method.

Testing

This project includes automated tests to ensure code quality and functionality. The test suite uses Jest with TypeScript support and covers:

  • Zod schema validation - verifies all input schemas correctly validate data
  • Spotify API interactions - tests API request handling and error handling
  • MCP server functionality - ensures proper registration and execution of tools

Running Tests

First, make sure all development dependencies are installed:

bash
npm install

To run all tests:

bash
npm test

To run a specific test file:

bash
npm test -- --testMatch="**/tests/schemas.test.ts"

If you encounter issues with ESM modules, make sure you're using Node.js v16 or higher and that the NODE_OPTIONS environment variable includes the --experimental-vm-modules flag as configured in the package.json.

Test Structure

  • tests/schemas.test.ts: Tests for input validation schemas
  • tests/spotify-api.test.ts: Tests for Spotify API interactions
  • tests/server.test.ts: Tests for MCP server functionality

Adding New Tests

When adding new functionality, please include corresponding tests:

  1. For new schemas, add validation tests in schemas.test.ts
  2. For Spotify API functions, add tests in spotify-api.test.ts
  3. For MCP tools, add tests in server.test.ts

All tests should be written using Jest and the ESM module format with TypeScript.

Security Notes

  • Never share your Client ID and Client Secret
  • Access token is now stored in the user's home directory at ~/.spotify-mcp/tokens.json to enable persistence between sessions and multiple instances
  • No user data is stored on disk

Revoking Application Access

For security reasons, you may want to revoke the application's access to your Spotify account when:

  • You no longer use this integration
  • You suspect unauthorized access
  • You're troubleshooting authentication issues

To revoke access:

  1. Go to your Spotify Account page
  2. Navigate to "Apps" in the menu
  3. Find "MCP Claude Spotify" (or the name you chose for your app)
  4. Click "REMOVE ACCESS"

This immediately invalidates all access and refresh tokens. The next time you use the auth-spotify command, you'll need to authorize the application again.

Contributing

Contributions are welcome! Here are some guidelines to follow:

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests to ensure they pass (npm test)
  5. Commit your changes (git commit -m 'Add some amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Code Style Guidelines

This project follows these coding standards:

  • Use TypeScript with strict type checking
  • Follow ESM module format
  • Use 2 spaces for indentation
  • Use camelCase for variables and functions
  • Use PascalCase for classes and interfaces
  • Document functions with JSDoc comments
  • Keep line length under 100 characters

Project Structure

The project follows this structure:

mcp-claude-spotify/
├── src/               # Source code
├── build/             # Compiled JavaScript
├── tests/             # Test files
├── public/            # Public assets
└── ...

Pull Request Process

  1. Ensure your code follows the style guidelines
  2. Update documentation if needed
  3. Add tests for new functionality
  4. Make sure all tests pass
  5. Your PR will be reviewed by maintainers

Related Links

License

This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.

Installatie

TypingMind
{
  "mcpServers": {
    "mcp-claude-spotify": {
      "command": "npx",
      "args": [
        "@imprvhub/mcp-claude-spotify"
      ]
    }
  }
}

Gebruik MCP Claude Spotify MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra MCP Claude Spotify is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Je kunt MCP lokaal op je apparaat uitvoeren of verbinding maken met de URL van een externe MCP-server.

Optie 1: Gebruik de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg MCP Claude Spotify toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van MCP Claude Spotify.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "mcp-claude-spotify": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-claude-spotify"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van MCP Claude Spotify in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van MCP Claude Spotify in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je MCP Claude Spotify gebruiken om me hiermee te helpen?
MCP Claude Spotify
Zeker. Ik heb het gelezen.
Dit vond ik met MCP Claude Spotify.

Optie 2: Voeg een MCP-server-URL toe

Gebruik dit als MCP Claude Spotify al extern wordt gehost of als je team één gedeelde connector wil die meerdere gebruikers kunnen gebruiken.

1

Open MCP-connectoren

Ga in TypingMind naar Plug-ins, open MCP-connectoren en kies URL toevoegen.

  1. Open TypingMind in je browser.
  2. Ga naar Plug-ins.
  3. Open MCP-connectoren.
  4. Klik op URL toevoegen.
TypingMind-formulier om een eigen MCP-server-URL toe te voegen
2

Plak de server-URL

Voer de MCP-server-URL van de aanbieder in het veld Server-URL in. Voeg een verbindingsnaam, beschrijving, icoon, aangepaste HTTP-headers of OAuth-clientinstellingen toe als de server die vereist.

  1. Plak de MCP-server-URL van de aanbieder in het veld Server-URL.
  2. Voer een verbindingsnaam in voor MCP Claude Spotify.
  3. Voeg een beschrijving en een icoon toe om de verbinding makkelijker te herkennen.
  4. Voeg aangepaste HTTP-headers of OAuth-clientgegevens toe als de server authenticatie vereist.
3

Maak de verbinding

Klik op Verbinding maken, ga terug naar de lijst met plug-ins en controleer of de nieuwe MCP-verbinding actief is.

  1. Klik op Verbinding maken.
  2. Ga terug naar de lijst met MCP-connectoren.
  3. Controleer of de verbinding met MCP Claude Spotify als actief wordt weergegeven.
  4. Vernieuw de lijst met plug-ins als de verbinding niet meteen verschijnt.
4

Wissel van model zonder opnieuw verbinding te maken

Start een chat met je favoriete model, schakel de tools van MCP Claude Spotify in via Plug-ins en wissel van model wanneer dat nodig is. De MCP-verbinding blijft beschikbaar in de TypingMind-werkruimte.

  1. Start een nieuwe chat in TypingMind.
  2. Selecteer het AI-model dat je wilt gebruiken.
  3. Schakel de tools van MCP Claude Spotify in via Plug-ins.
  4. Vraag het model om de tool te gebruiken wanneer dat nodig is.
  5. Schakel over naar een ander AI-model en gebruik dezelfde MCP-verbinding opnieuw.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je MCP Claude Spotify gebruiken om me hiermee te helpen?
MCP Claude Spotify
Zeker. Ik heb het gelezen.
Dit vond ik met MCP Claude Spotify.

Veelgestelde vragen

Waarvoor wordt de MCP-server MCP Claude Spotify gebruikt?

MCP Claude Spotify is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik MCP Claude Spotify MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je MCP Claude Spotify gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom MCP Claude Spotify MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als MCP Claude Spotify verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik MCP Claude Spotify MCP met TypingMind?

Je kunt MCP Claude Spotify met TypingMind verbinden via de lokale MCP-connector of door de URL van een externe MCP-server toe te voegen. Gebruik de lokale connector als de server toegang nodig heeft tot bestanden, apps of privébronnen op je apparaat. Gebruik een server-URL als de MCP-server extern wordt gehost.

Welke tools biedt MCP Claude Spotify MCP in TypingMind?

MCP Claude Spotify biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om MCP Claude Spotify MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als MCP Claude Spotify authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇