spotify-remote-controller-mcp
Facilitates interactive, spoken-word manipulation of Spotify media playback sessions via an MCP client, enabling functions like track advancement, halting playback, and catalog searching without manual GUI interaction.
Author

obre10off
Quick Info
Actions
Tags
Spotify Model Context Protocol (MCP) Interface Server
This repository furnishes an implementation of a Model Context Protocol (MCP) endpoint, specifically designed to interface with the Spotify Web API. This setup enables users to issue high-level, natural language directives to manage their current music listening experience through an authorized MCP consumer application, such as Cursor or Claude for Desktop on supported operating systems.
Exposed Functionality
This service registers the following discrete operations accessible via the MCP framework:
play: Initiate playback of a specified media item (e.g., a song, compilation, or artist's catalog) or resume a previously stopped session.pause: Suspend the currently active audio stream.next: Transition immediately to the subsequent item in the current queue or album.previous: Return to the preceding audio item.get_current_track: Retrieve metadata detailing the audio content presently being reproduced.search: Execute queries against the Spotify catalog to locate specific artists, albums, tracks, or playlists.
System Requirements
To successfully deploy and operate this control layer, the following prerequisites must be satisfied:
- Runtime Environment: Bun package manager (version 1.0.0 or newer).
- Spotify Account Status: An active subscription to Spotify Premium is mandatory.
- Developer Registration: A registered application within the Spotify Developer Dashboard. Key artifacts required are the Client Identifier and the Client Secret. Crucially, the Redirect URI must be configured to include
http://localhost:8888/callbackwithin the application settings. - Client Application: An installed and configured MCP-compatible client (e.g., Cursor, Claude for Desktop).
Deployment and Configuration Guide
-
Source Code Acquisition:
bash git clone https://github.com/obre10off/spotify-mcp.git cd spotify-mcp
-
Dependency Resolution:
bash bun install
-
Environment Variable File Creation:
Establish a file named
.envin the project's root directory and populate it with your Spotify credentials:SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret SPOTIFY_REDIRECT_URI=http://localhost:8888/callback
Token placeholders, populated post-authentication:
SPOTIFY_ACCESS_TOKEN= SPOTIFY_REFRESH_TOKEN=
-
Authentication Flow Execution:
Run the dedicated setup script to initiate the OAuth process. This action launches a browser window prompting Spotify login and authorization, subsequently outputting the necessary token pair to the console for manual
.envfile updating.bash bun run auth
-
MCP Client Integration:
-
Cursor Integration Steps:
- Navigate to Cursor settings (Cmd+, or Ctrl+,).
- Search for "Model Context Protocol".
- Select the option to edit
settings.json. -
Append the necessary configuration block to the
mcp.serverslist. Note: Substitute/absolute/path/to/your/spotify-mcpwith the fully qualified, absolute directory path to your project clone.{ "mcp.servers": [ { "spotify": { "command": "bun", "args": ["/absolute/path/to/your/spotify-mcp/src/index.ts"], "env": { "SPOTIFY_CLIENT_ID": "your_spotify_client_id", "SPOTIFY_CLIENT_SECRET": "your_spotify_client_secret", "SPOTIFY_REDIRECT_URI": "http://localhost:8888/callback", "SPOTIFY_ACCESS_TOKEN": "your_spotify_access_token", "SPOTIFY_REFRESH_TOKEN": "your_spotify_refresh_token" } } } ] }
Best Practice Advisory: Externalizing credentials to the
.envfile is strongly preferred over embedding them directly insettings.json.
-
Claude for Desktop Configuration (macOS/Windows):
- Locate and open the configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Integrate the following structure into the
mcpServersobject, again using the absolute path to the project directory:{ "mcpServers": { "spotify": { "command": "bun", "args": ["/absolute/path/to/your/spotify-mcp/src/index.ts"] } } }
Best Practice Advisory: Utilizing the external
.envfile for sensitive parameters is recommended over direct inclusion inclaude_desktop_config.json.
- Locate and open the configuration file:
-
Critical Instruction: Absolute path specification is mandatory across all client configuration methods.
-
-
Client Application Restart
Ensure the host MCP client (Cursor or Claude) is fully relaunched to incorporate the new server definition.
Server Initiation
Execute the following command to launch the control server, which includes watch-mode functionality via Bun for automatic restarts upon code modification:
bash bun run start
Maintain this terminal session active throughout the operational period.
Operational Examples
Once the server is active and the client is configured, interaction proceeds via conversational prompts. Examples include:
"Initiate playback of Bohemian Rhapsody"
"Halt the current audio stream"
"Query the name of the currently active track"
"Locate discographies by Taylor Swift"
"Advance to the next selection"
"Execute playback using URI: spotify:track:4uLU6hMCjMI75M1A2tKUQC"
