Provides comprehensive Spotify integration with tools for searching the music catalog, reading player status, controlling playback and devices, managing playlists, and managing saved songs. Supports fuzzy search queries, voice control, and mood-based playlist creation.
Spotify MCP Server (Streamable HTTP / OAuth / Remote)
Streamable HTTP MCP server for Spotify exposes tools to search the catalog, read player status, control playback and devices, manage playlists, and manage your saved songs.
Author: overment.
Warning
This warning applies only to the HTTP transport and OAuth wrapper (Authorization Server / Resource Server) included for convenience. They are intended for personal/local use and are not production‑hardened. The bundled HTTP server exists solely to make it easy to connect your agent or UI.
The MCP tools and schemas themselves are implemented with strong validation, slim outputs, clear error handling, and other best practices.
If you plan to deploy remotely, replace the OAuth/HTTP layer with production infrastructure: proper token validation/introspection, secure storage, TLS termination, strict CORS/origin checks, rate limiting, audit logging, persistence for sessions/tokens, and compliance with Spotify’s terms.
Motivation
At first glance, a "Spotify MCP" may seem unnecessary—pressing play or skipping a song is often faster by hand. It becomes genuinely useful when you don’t know the exact title (e.g., “soundtrack from [movie title]”), when you want to “create and play a playlist that matches my mood”, or when you’re using voice. This MCP lets an LLM handle the fuzzy intent → search → selection → control loop, and it returns clear confirmations of what happened. It works well with voice interfaces and can be connected to agents/workflows for smart‑home automations.
Example:
Note: This UI ^ is Alice, a desktop app. That’s one of my projects.
This UI ^ is Claude Desktop.
Installation
- Clone and install
- Prepare environment
Edit .env
and set at minimum:
- Configure Redirect URIs in Spotify Dashboard
In your Spotify Developer Dashboard → App → Redirect URIs, add:
- Run the server
- Connect your agent/UI
Point your bridge/client to the MCP endpoint, for example http://127.0.0.1:3030/mcp
(see “Client configuration” below for Claude Desktop).
What the model sees (server instructions)
The server advertises a concise description to clients so models can use it effectively without loading the full schema. This description summarizes tools, key rules, and usage patterns.
Design notes (LLM-friendly by intent):
- Tools do not mirror Spotify’s API 1:1. Interfaces are simplified and unified to reduce confusion.
- Wherever possible, operations are batch-first (e.g.,
queries[]
,operations[]
) to minimize tool invocations and make intent explicit. - Every tool returns human-friendly feedback that clearly states what succeeded and what didn’t, with next-step guidance.
- For player control, the server performs best‑effort background verification (e.g., checking device, context, and current track) because Spotify’s API can be ambiguous about immediate state.
MCP identity
- Name:
Spotify Music
- Instructions (shown to the model):
Note
Server description below is what clients present to the model as the MCP Server’s "instructions." It’s designed to give a clear mental model of the server’s capabilities without diving into every schema detail.
Tool design and conventions (LLM-friendly)
- Batch-only where applicable:
queries: string[]
for search;operations[]
for control. - Deterministic slim outputs: fixed shapes with minimal fields (
id
,uri
,name
, etc.). - Every tool returns a human-readable
_msg
summary. Control verifies context/track and device when possible. - Error handling: whole-call errors set
isError: true
; batch results include per-item{ ok, error? }
and an aggregate summary.
Returned messages
- Each tool returns a concise human message in two places:
structuredContent._msg
(orstructuredContent.error
on failure)content: [{ type: "text", text: "<same message>" }, ... ]
These are intended to be shown directly to users, with one of them designed for older MCP clients.
Tools catalog (name, description, inputs, outputs)
search_catalog
- Description: Search songs, artists, albums, and playlists. Inputs:
queries[]
,types[album|artist|playlist|track]
, optionalmarket
,limit(1-50)
,offset(0-1000)
,include_external['audio']
. - Auth/annotations: readOnlyHint=true, openWorldHint=true (app token; no user OAuth).
- Input shape:
- Output shape (SpotifySearchBatchOutput, slim):
player_status
- Description: Read the current player state, devices, queue, and current track. Use this to learn
device_id
before control. - Auth/annotations: readOnlyHint=true, openWorldHint=true (user OAuth required).
- Input shape:
- Output shape (SpotifyStatusOutput):
spotify_control
- Description: Control Spotify playback: play, pause, next/previous, seek, shuffle, repeat, volume, transfer, and queue. Batch interface; optional
parallel=true
. Verifies device/context/track when possible and returns a concise status. - Auth/annotations: readOnlyHint=false, openWorldHint=true (user OAuth required).
- Input shape:
- Output shape (SpotifyControlBatchOutput):
Notes:
- For play, set either
context_uri
(with optionaloffset
) oruris
, not both. - After actions, a concise status is included; use
player_status
for full details.
spotify_playlist
- Description: Manage playlists for the current user.
- Actions:
list_user
,get
,items
,create
,update_details
,add_items
,remove_items
,reorder_items
. - Auth/annotations: readOnlyHint=false for mutating actions; true for reads; openWorldHint=true (user OAuth required).
- Input shape:
- Output shape:
- Notes:
- Success responses set
{ ok: true, action, _msg?, data? }
; failures set{ isError: true, structuredContent: { ok:false, action, error, code? } }
. items
annotates each returned track with zero-basedposition
and includesplaylist_uri
for precisespotify_control.play
with{ context_uri, offset: { position } }
.
- Success responses set
spotify_library
- Description: Manage saved songs (Your Library).
- Actions:
tracks_get
,tracks_add
,tracks_remove
,tracks_contains
. - Auth/annotations: readOnlyHint=true for reads; false for writes; openWorldHint=true (user OAuth required).
- Input shape:
- Output shape:
- Notes:
- Success responses set
{ ok: true, action, _msg?, data? }
; failures set{ isError: true, structuredContent: { ok:false, action, error, code? } }
. - Use track IDs for library actions; use full track URIs for playlist add/remove.
- Success responses set
HTTP Endpoints
POST /mcp
— JSON-RPC 2.0 messages over Streamable HTTP. Initializes sessions and handles requests.GET /mcp
— Server-to-client notifications stream for an existing session; requiresMcp-Session-Id
header.DELETE /mcp
— End a session; requiresMcp-Session-Id
header.GET /health
— Health probe.GET /.well-known/oauth-authorization-server
— AS metadata (points to portPORT+1
). Alias also at/mcp/.well-known/oauth-authorization-server
.GET /.well-known/oauth-protected-resource
— RS metadata whenAUTH_ENABLED=true
. Alias also at/mcp/.well-known/oauth-protected-resource
.
Security middleware validates Origin and MCP protocol version headers, attaches a session ID when needed, challenges with WWW-Authenticate
on 401, and maps RS tokens to Spotify tokens for session hydration.
Client configuration (Claude Desktop)
Claude Desktop connects to remote MCP servers through a local stdio bridge. Example configuration:
If you enable local HTTPS in front of the server, change the URL to https://localhost:3030/mcp
and ensure your client trusts the certificate.
End-to-end example session
This walkthrough shows a complete flow using all tools with actionable _msg
outputs the AI can rely on.
What's playing?
Narration: I'll check what's currently playing on your Spotify account.
Tool: player_status
Request
Response
Assistant: You're currently listening to "Come With Me - Radio Mix" on your MacBook Pro. The track is playing from a playlist. Would you like me to get more details about the current track or help you control playback in any way?
Play "Protected" from this playlist
Narration: I'll help you play "Protected" from your current playlist. Let me first get the playlist details to find that specific track.
Tool: spotify_playlist
Request
Response
Assistant: Perfect! I found "Protected" at position #7 in your playlist. Now I'll play it for you.
Tool: spotify_control
Request
Response
Assistant: Great! I've started playing "Protected" from your "Nora" playlist on your MacBook Pro. The track should be playing now!
Add current track to favorites
Narration: I'll add "Protected" to your saved tracks (favorites) right away!
Tool: spotify_library
Request
Response
Assistant: Perfect! I've added "Protected" to your saved tracks. It's now in your Liked Songs. Great choice!
Switch to "Train of Thoughts"
Narration: I'll play "Train of Thoughts" from your Nora playlist for you!
Tool: spotify_control
Request
Response
Assistant: Done! "Train of Thoughts" is now playing on your MacBook Pro. I can see from the playlist that this is position #13 in your "Nora" playlist.
Turn the volume up to 100%
Narration: I'll turn the volume up to 100% for you!
Tool: spotify_control
Request
Response
Assistant: Perfect! I've cranked the volume up to 100% on your MacBook Pro. "Train of Thoughts" should now be playing at full volume.
Troubleshooting
- Missing user token: complete the OAuth flow. The server will log mapping/attachment events.
- Unknown RS token: restart or mapping loss triggers a new OAuth prompt; the client should re-auth automatically.
- No devices: open Spotify on a device, then use
player_status
to list devices orspotify_control
→transfer
.
Development
Architecture (high level)
License
MIT — see LICENSE
.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables control of Spotify through natural language by searching the catalog, managing playback and devices, controlling playlists, and managing saved songs. Includes OAuth authentication and streamable HTTP transport for remote connectivity.
- Motivation
- Installation
- What the model sees (server instructions)
- MCP identity
- Tool design and conventions (LLM-friendly)
- Tools catalog (name, description, inputs, outputs)
- HTTP Endpoints
- Client configuration (Claude Desktop)
- End-to-end example session
- Troubleshooting
- Development
- Architecture (high level)
- License
Related MCP Servers
- AsecurityAlicenseAqualityEnables interaction with Spotify's music catalog via the Spotify Web API, supporting searches, artist information retrieval, playlist management, and automatic token handling.Last updated -2654712TypeScriptMIT License
- -securityFlicense-qualityConnects Claude with Spotify to control playback, search music, get track information, and manage the queue through conversation.Last updated -1Python
- -securityFlicense-qualityA Model Context Protocol server that enables controlling Spotify playback through natural language commands in MCP clients like Cursor or Claude for Desktop.Last updated -2TypeScript
- -securityFlicense-qualityIntegrates with Spotify Web API through the Model Context Protocol, allowing users to search tracks, control playback, and manage playlists programmatically.Last updated -JavaScript