Skip to main content
Glama
carllapierre

SpotifyMCP

by carllapierre
README.md
# SpotifyMCP MCP Server

This is a TypeScript-based MCP server for Spotify based on the [Model Context Protocol](https://modelcontextprotocol.io/introduction).

## Features

### Tools
- `create_playlist` - Create a new Spotify playlist.
  - Takes name, description, tracks, and public status as parameters.
  - Returns the URI of the created playlist.

### Prompts
- `search_songs` - Search for songs on Spotify.
  - Takes a search query and an optional limit for results.

## Development

Install dependencies:
```bash
npm install
```

Build the server:
```bash
npm run build
```

For development with auto-rebuild:
```bash
npm run watch
```

## Installation

To use with Claude Desktop, add the server config:

On MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
On Windows: `%APPDATA%/Claude/claude_desktop_config.json`

```json
{
  "mcpServers": {
    "SpotifyMCP": {
      "command": "node",
      "args": [
        "/Users/your_username/Documents/SideProjects/MCPs/spotify-mcp/build/index.js"
      ],
      "env": {
        "SPOTIFY_CLIENT_ID": "your_client_id_here",
        "SPOTIFY_CLIENT_SECRET": "your_client_secret_here",
        "SPOTIFY_REFRESH_TOKEN": "your_refresh_token_here"
      }
    },
  }
}
```

### Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is available as a package script:

```bash
npm run inspector
```

The Inspector will provide a URL to access debugging tools in your browser.

## Setup Instructions

1. **Create a Spotify Developer Account**  
   Visit [Spotify Developer](https://developer.spotify.com/) and create an account.

2. **Create a New Application**  
   After logging in, create a new application to obtain your **Client ID** and **Client Secret**.

3. **Set Up Redirect URI**  
   In your Spotify application settings, configure the redirect URI to:  
   ```
   http://localhost:8888/callback
   ```

4. **Create a `.env` File**  
   In the root of your project, create a `.env` file and add the following environment variables:
   ```plaintext
   SPOTIFY_CLIENT_ID=your_client_id_here
   SPOTIFY_CLIENT_SECRET=your_client_secret_here
   SPOTIFY_REDIRECT_URI=http://localhost:8888/callback
   ```

5. **Get Your Spotify Token**  
   Run the following command to obtain your Spotify token:
   ```bash
   npx ts-node src/scripts/get-spotify-token.ts
   ```

6. **Login to Your Application**  
   Visit http://localhost:8888/login in your browser
   Copy the refresh token and set it in your environment variables:
   SPOTIFY_REFRESH_TOKEN=your_refresh_token_here

TDQS

B3.2/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one creates playlists, the other searches for songs. There is no overlap or ambiguity.

Naming Consistency5/5

Both tool names follow a consistent verb_noun pattern (create_playlist, search_songs) with clear and predictable structure.

Tool Count3/5

With only 2 tools, the surface is too thin for a comprehensive music service like Spotify. This falls in the borderline range for tool count.

Completeness2/5

The set lacks many essential operations such as playing music, managing playlists (get, update, delete), and user library actions, leaving significant gaps.

Maintenance

ActivityInactive
ResponsivenessNo issues