背景图片

spotify-mcp-server

Media Management

Description

Spotify MCP Server is a lightweight server that enables AI assistants like Cursor & Claude to control Spotify playback and manage playlists.

Author

MCP-Mirror

Created Date

2024-12-01

Tutorial

Learn how to use this MCP server

step1: Prerequisites

  • Ensure you have Node.js v16+ installed.
  • Have a Spotify Premium account.
  • Register a Spotify Developer application.

step2: Installation bash git clone https://github.com/marcelmarais/spotify-mcp-server.git cd spotify-mcp-server npm install npm run build

step3: Create a Spotify Developer Application

  1. Go to the Spotify Developer Dashboard
  2. Log in with your Spotify account
  3. Click the "Create an App" button
  4. Fill in the app name and description
  5. Accept the Terms of Service and click "Create"
  6. In your new app's dashboard, note your Client ID
  7. Click "Show Client Secret" to reveal your Client Secret
  8. Click "Edit Settings" and add a Redirect URI (e.g., http://localhost:8888/callback)
  9. Save your changes

step4: Spotify API Configuration

  1. Create a spotify-config.json file in the project root (copy and modify the provided example): bash cp spotify-config.example.json spotify-config.json

  2. Edit the file with your credentials:

{ "clientId": "your-client-id", "clientSecret": "your-client-secret", "redirectUri": "http://localhost:8888/callback" }

step5: Authentication Process

  1. Run the authentication script: bash npm run auth

  2. Open the generated authorization URL in your web browser

  3. Log in to Spotify and authorize your application

  4. Spotify will redirect you to your specified redirect URI with a code parameter in the URL

  5. The script will automatically exchange this code for access and refresh tokens

  6. These tokens will be saved to your spotify-config.json file

step6: Integrate with Claude Desktop and Cursor

  • For Claude Desktop, add the server to your Claude configuration:

{ "mcpServers": { "spotify": { "command": "node", "args": ["spotify-mcp-server/build/index.js"] } } }

  • For Cursor, go to the MCP tab in Cursor Settings (command + shift + J) and add a server with the command: bash node path/to/spotify-mcp-server/build/index.js