An integration that allows Claude Desktop to interact with Spotify using the Model Context Protocol (MCP). - Spotify authentication - Search for tracks, albums, artists, and playlists - Playback control (play, pause, next, previous) - Create and manage playlists - Get personalized recommendations - Access user's top played tracks over different time periods - Node.js 16 or higher - Spotify account
Add this skill
npx mdskills install imprvhub/mcp-claude-spotifyComprehensive Spotify integration with excellent setup docs and clear tool descriptions
123# MCP Claude Spotify4[](https://archestra.ai/mcp-catalog/imprvhub__mcp-claude-spotify)5[](https://mseep.ai/app/99039f16-4abd-4af8-8873-ae2844e7dd65)6[](https://smithery.ai/server/@imprvhub/mcp-claude-spotify)78<table style="border-collapse: collapse; width: 100%;">9<tr>10<td style="padding: 15px; vertical-align: middle; border: none; text-align: center;">11 <a href="https://mseep.ai/app/imprvhub-mcp-claude-spotify">12 <img src="https://mseep.net/pr/imprvhub-mcp-claude-spotify-badge.png" alt="MseeP.ai Security Assessment Badge" />13 </a>14</td>15<td style="width: 50%; padding: 15px; vertical-align: middle; border: none;">An integration that allows Claude Desktop to interact with Spotify using the Model Context Protocol (MCP).</td>16<td style="width: 50%; padding: 0; vertical-align: middle; border: none;"><a href="https://glama.ai/mcp/servers/@imprvhub/mcp-claude-spotify"><img src="https://glama.ai/mcp/servers/@imprvhub/mcp-claude-spotify/badge" alt="Claude Spotify MCP server" style="max-width: 100%;" /></a></td>17</tr>18</table>1920## Features2122- Spotify authentication23- Search for tracks, albums, artists, and playlists24- Playback control (play, pause, next, previous)25- Create and manage playlists26- Get personalized recommendations27- Access user's top played tracks over different time periods2829## Demo3031<p>32 <a href="https://www.youtube.com/watch?v=WNw5H9epZfc">33 <img src="public/assets/preview.png" width="600" alt="Claude Spotify Integration Demo">34 </a>35</p>3637## Requirements3839- Node.js 16 or higher40- Spotify account41- Claude Desktop42- Spotify API credentials (Client ID and Client Secret)4344## Installation4546### Installing via Smithery4748To install MCP Claude Spotify for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@imprvhub/mcp-claude-spotify):4950```bash51npx -y @smithery/cli install @imprvhub/mcp-claude-spotify --client claude52```5354### Installing Manually551. Clone or download this repository:56```bash57git clone https://github.com/imprvhub/mcp-claude-spotify58cd claude-spotify-mcp59```60612. Install dependencies:62```bash63npm install64```65663. Build the project (if you want to modify the source code):67```bash68npm run build69```7071The 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.7273## Setting up Spotify Credentials7475To use this MCP, you need to obtain Spotify API credentials:76771. Go to [Spotify Developer Dashboard](https://developer.spotify.com/dashboard)782. Log in with your Spotify account793. Click "Create App"804. Fill in your app information:81 - App name: "MCP Claude Spotify" (or whatever you prefer)82 - App description: "Spotify integration for Claude Desktop"83 - Website: You can leave this blank or put any URL84 - Redirect URI: **Important** - Add `http://127.0.0.1:8888/callback`855. Accept the terms and conditions and click "Create"866. In your app dashboard, you'll see the "Client ID"877. Click "Show Client Secret" to reveal your "Client Secret"8889Save these credentials as you'll need them for configuration.9091## Running the MCP Server9293There are two ways to run the MCP server:9495### Option 1: Running manually (recommended for first-time setup and troubleshooting)96971. Open a terminal or command prompt982. Navigate to the project directory993. Run the server directly:100101```bash102node build/index.js103```104105Keep this terminal window open while using Claude Desktop. The server will run until you close the terminal.106107### Option 2: Auto-starting with Claude Desktop (recommended for regular use)108109The Claude Desktop can automatically start the MCP server when needed. To set this up:110111#### Configuration112113The Claude Desktop configuration file is located at:114115- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`116- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`117118Edit this file to add the Spotify MCP configuration. If the file doesn't exist, create it:119120```json121{122 "mcpServers": {123 "spotify": {124 "command": "node",125 "args": ["ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js"],126 "env": {127 "SPOTIFY_CLIENT_ID": "your_client_id_here",128 "SPOTIFY_CLIENT_SECRET": "your_client_secret_here"129 }130 }131 }132}133```134135**Important**: Replace:136- `ABSOLUTE_PATH_TO_DIRECTORY` with the **complete absolute path** where you installed the MCP137 - macOS/Linux example: `/Users/username/mcp-claude-spotify`138 - Windows example: `C:\\Users\\username\\mcp-claude-spotify`139- `your_client_id_here` with the Client ID you obtained from Spotify140- `your_client_secret_here` with the Client Secret you obtained from Spotify141142If you already have other MCPs configured, simply add the "spotify" section inside the "mcpServers" object.143144#### Setting up auto-start scripts (Optional)145146For a more reliable experience, you can set up auto-start scripts:147148<details>149<summary><b>Windows auto-start instructions</b></summary>1501511. Create a file named `start-spotify-mcp.bat` in the project directory with the following content:152```153@echo off154cd %~dp0155node build/index.js156```1571582. Create a shortcut to this BAT file1593. Press `Win+R`, type `shell:startup` and press Enter1604. Move the shortcut to this folder to have it start with Windows161</details>162163<details>164<summary><b>macOS auto-start instructions</b></summary>1651661. Create a file named `com.spotify.mcp.plist` in `~/Library/LaunchAgents/` with the following content:167```xml168<?xml version="1.0" encoding="UTF-8"?>169<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">170<plist version="1.0">171<dict>172 <key>Label</key>173 <string>com.spotify.mcp</string>174 <key>ProgramArguments</key>175 <array>176 <string>/usr/local/bin/node</string>177 <string>ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js</string>178 </array>179 <key>RunAtLoad</key>180 <true/>181 <key>KeepAlive</key>182 <true/>183 <key>StandardErrorPath</key>184 <string>/tmp/spotify-mcp.err</string>185 <key>StandardOutPath</key>186 <string>/tmp/spotify-mcp.out</string>187 <key>EnvironmentVariables</key>188 <dict>189 <key>SPOTIFY_CLIENT_ID</key>190 <string>your_client_id_here</string>191 <key>SPOTIFY_CLIENT_SECRET</key>192 <string>your_client_secret_here</string>193 </dict>194</dict>195</plist>196```1971982. Replace the path and credentials with your actual values1993. Load the agent with: `launchctl load ~/Library/LaunchAgents/com.spotify.mcp.plist`200</details>201202<details>203<summary><b>Linux auto-start instructions</b></summary>2042051. Create a file named `spotify-mcp.service` in `~/.config/systemd/user/` (create the directory if it doesn't exist):206```207[Unit]208Description=Spotify MCP Server for Claude Desktop209After=network.target210211[Service]212Type=simple213ExecStart=/usr/bin/node ABSOLUTE_PATH_TO_DIRECTORY/mcp-claude-spotify/build/index.js214Restart=on-failure215Environment="SPOTIFY_CLIENT_ID=your_client_id_here"216Environment="SPOTIFY_CLIENT_SECRET=your_client_secret_here"217218[Install]219WantedBy=default.target220```2212222. Replace the path and credentials with your actual values2233. Enable and start the service:224```bash225systemctl --user enable spotify-mcp.service226systemctl --user start spotify-mcp.service227```2282294. Check status with:230```bash231systemctl --user status spotify-mcp.service232```233</details>234235## Usage2362371. Restart Claude Desktop after modifying the configuration2382. In Claude, use the `auth-spotify` command to start the authentication process2393. A browser window will open for you to authorize the application2404. Log in with your Spotify account and authorize the application2415. **Important**: After successful authentication, restart Claude Desktop to properly initialize the MCP's tool registry and WebSocket session token cache2426. After restarting, all Spotify MCP tools will be properly registered and available for use243244The 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`.245246## Available Tools247248### auth-spotify249Initiates the Spotify authentication process.250251### search-spotify252Searches for tracks, albums, artists, or playlists.253254**Parameters:**255- `query`: Search text256- `type`: Type of search (track, album, artist, playlist)257- `limit`: Number of results (1-50)258259### play-track260Plays a specific track.261262**Parameters:**263- `trackId`: Spotify track ID264- `deviceId`: (Optional) Spotify device ID to play on265266### get-current-playback267Gets information about the current playback.268269### pause-playback270Pauses the playback.271272### next-track273Skips to the next track.274275### previous-track276Returns to the previous track.277278### get-user-playlists279Gets the user's playlists.280281### create-playlist282Creates a new playlist.283284**Parameters:**285- `name`: Playlist name286- `description`: (Optional) Description287- `public`: (Optional) Whether it's public or private288289### add-tracks-to-playlist290Adds tracks to a playlist.291292**Parameters:**293- `playlistId`: Playlist ID294- `trackIds`: Array of track IDs295296### get-recommendations297Gets recommendations based on seeds.298299**Parameters:**300- `seedTracks`: (Optional) Array of track IDs301- `seedArtists`: (Optional) Array of artist IDs302- `seedGenres`: (Optional) Array of genres303- `limit`: (Optional) Number of recommendations (1-100)304305### get-top-tracks306Gets the user's most played tracks over a specified time range.307308**Parameters:**309- `limit`: (Optional) Number of tracks to return (1-50, default: 20)310- `offset`: (Optional) Index of the first track to return (default: 0)311- `time_range`: (Optional) Time frame for calculating affinity:312 - `short_term`: Approximately last 4 weeks313 - `medium_term`: Approximately last 6 months (default)314 - `long_term`: Several years of data315316## Troubleshooting317318### "Server disconnected" error319If you see the error "MCP Spotify: Server disconnected" in Claude Desktop:3203211. **Verify the server is running**:322 - Open a terminal and manually run `node build/index.js` from the project directory323 - If the server starts successfully, use Claude while keeping this terminal open3243252. **Check your configuration**:326 - Ensure the absolute path in `claude_desktop_config.json` is correct for your system327 - Double-check that you've used double backslashes (`\\`) for Windows paths328 - Verify you're using the complete path from the root of your filesystem3293303. **Try the auto-start option**:331 - Set up the auto-start script for your operating system as described in the "Setting up auto-start scripts" section332 - This ensures the server is always running when you need it333334### Browser doesn't open automatically335If the browser doesn't open automatically during authentication, manually visit:336`http://127.0.0.1:8888/login`337338### Authentication error339Make sure you've correctly configured the redirect URI in your Spotify Developer dashboard:340`http://127.0.0.1:8888/callback`341342### Server startup error343Verify that:344- Environment variables are correctly configured in your `claude_desktop_config.json` or launch script345- Node.js is installed and compatible (v16+)346- Required ports (8888) are available and not blocked by firewall347- You have permission to run the script in the specified location348349### Tools not appearing in Claude350If the Spotify tools don't appear in Claude after authentication:351- Make sure you've restarted Claude Desktop after successful authentication352- Check the Claude Desktop logs for any MCP communication errors353- Ensure the MCP server process is running (run it manually to confirm)354- Verify that the MCP server is correctly registered in the Claude Desktop MCP registry355356### Checking if the server is running357To check if the server is running:358359- **Windows**: Open Task Manager, go to the "Details" tab, and look for "node.exe"360- **macOS/Linux**: Open Terminal and run `ps aux | grep node`361362If you don't see the server running, start it manually or use the auto-start method.363364## Testing365366This project includes automated tests to ensure code quality and functionality. The test suite uses Jest with TypeScript support and covers:367368- Zod schema validation - verifies all input schemas correctly validate data369- Spotify API interactions - tests API request handling and error handling370- MCP server functionality - ensures proper registration and execution of tools371372### Running Tests373374First, make sure all development dependencies are installed:375376```bash377npm install378```379380To run all tests:381382```bash383npm test384```385386To run a specific test file:387388```bash389npm test -- --testMatch="**/tests/schemas.test.ts"390```391392If 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.393394### Test Structure395396- `tests/schemas.test.ts`: Tests for input validation schemas397- `tests/spotify-api.test.ts`: Tests for Spotify API interactions398- `tests/server.test.ts`: Tests for MCP server functionality399400### Adding New Tests401402When adding new functionality, please include corresponding tests:4034041. For new schemas, add validation tests in `schemas.test.ts`4052. For Spotify API functions, add tests in `spotify-api.test.ts`4063. For MCP tools, add tests in `server.test.ts`407408All tests should be written using Jest and the ESM module format with TypeScript.409410## Security Notes411412- Never share your Client ID and Client Secret413- Access token is now stored in the user's home directory at `~/.spotify-mcp/tokens.json` to enable persistence between sessions and multiple instances414- No user data is stored on disk415416### Revoking Application Access417418For security reasons, you may want to revoke the application's access to your Spotify account when:419- You no longer use this integration420- You suspect unauthorized access421- You're troubleshooting authentication issues422423To revoke access:4244251. Go to your [Spotify Account page](https://www.spotify.com/account)4262. Navigate to "Apps" in the menu4273. Find "MCP Claude Spotify" (or the name you chose for your app)4284. Click "REMOVE ACCESS"429430This immediately invalidates all access and refresh tokens. The next time you use the `auth-spotify` command, you'll need to authorize the application again.431432## Contributing433434Contributions are welcome! Here are some guidelines to follow:435436### Development Workflow4374381. Fork the repository4392. Create a feature branch (`git checkout -b feature/amazing-feature`)4403. Make your changes4414. Run tests to ensure they pass (`npm test`)4425. Commit your changes (`git commit -m 'Add some amazing feature'`)4436. Push to the branch (`git push origin feature/amazing-feature`)4447. Open a Pull Request445446### Code Style Guidelines447448This project follows these coding standards:449450- Use TypeScript with strict type checking451- Follow ESM module format452- Use 2 spaces for indentation453- Use camelCase for variables and functions454- Use PascalCase for classes and interfaces455- Document functions with JSDoc comments456- Keep line length under 100 characters457458### Project Structure459460The project follows this structure:461462```463mcp-claude-spotify/464├── src/ # Source code465├── build/ # Compiled JavaScript466├── tests/ # Test files467├── public/ # Public assets468└── ...469```470471### Pull Request Process4724731. Ensure your code follows the style guidelines4742. Update documentation if needed4753. Add tests for new functionality4764. Make sure all tests pass4775. Your PR will be reviewed by maintainers478479## Related Links480481- [Model Context Protocol](https://modelcontextprotocol.io/)482- [Spotify Web API Documentation](https://developer.spotify.com/documentation/web-api)483- [Claude Desktop](https://claude.ai/download)484- [MCP Series](https://github.com/mcp-series)485486## License487488This project is licensed under the Mozilla Public License 2.0 - see the [LICENSE](https://github.com/imprvhub/mcp-claude-spotify/blob/main/LICENSE) file for details.489
Full transparency — inspect the skill content before installing.