Spotify MCP server for AI agents

Live

OAUTH 2.0

MUSIC

Media

Spotify gives your agent control of the user's Spotify account: search the catalog, read their library and listening history, create and edit playlists, and control playback on their devices.

  • Per-user credentials: each call uses the actual user's token, never a shared bot.
  • Encrypted per-tenant vault: AES-256, resolved at request time, never in LLM context.
  • Scoped before every call: pre-call scope check, 90-day SIEM-exportable audit chain.
Spotify
agent · Acme Q3
Run
Play my Discover Weekly on the kitchen speaker.
S
spotify_playback_start
198ms
Music agent
Started Discover Weekly on your Kitchen speaker.
Sources: Spotify playback, 1 device
spotify
1 device
18:29
Message Claude...

Tools your music agent reaches for on Spotify, scoped per user.

CALL ANY TOOL
47 tools for music in Spotify: search the catalog, read saved items and listening history, create and edit playlists, manage the library, and control playback and the queue.
spotify_add_to_playlist
Add to playlist
Add one or more tracks or episodes to a playlist, appended at the end or inserted at a zero-based position. Returns the playlist's new snapshot_id. Pass item URIs (spotify:track:... or spotify:episode:...), comma-separated, up to 100 per call; read the current items with spotify_playlist_items_get and remove items with spotify_playlist_items_remove. The current user must own or collaborate on the playlist; needs playlist-modify-public or playlist-modify-private.
Parameters
Name
Type
Required
Description
playlist_id
string
Required
Spotify ID of the playlist to add items to
uris
string
Required
Comma-separated Spotify track or episode URIs, up to 100 per call, e.g. spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:episode:512ojhOuo1ktJprKbVcKyQ. Items are added in the order given.
position
integer
Optional
Zero-based position to insert items. Appends to end if omitted. Also accepts `schema_version` and `tool_version` to pin a version.
spotify_album_get
Get album
spotify_album_tracks_get
Get album tracks
spotify_artist_get
Get artist
spotify_audiobook_chapters_get
Get audiobook chapters
spotify_chapter_get
Get chapter
spotify_episode_get
Get episode
spotify_following_get
Get following
spotify_get_user_playlists
Get user playlists
spotify_library_check
Check library
spotify_library_remove
Remove library
spotify_library_save
Library save
spotify_playback_pause
Pause playback
spotify_playback_previous
Playback previous
spotify_playback_start
Start playback
spotify_playback_state_get
Get playback state
spotify_playback_transfer
Playback transfer
spotify_playlist_cover_get
Get playlist cover
spotify_playlist_create
Create playlist
spotify_playlist_items_get
Get playlist items
spotify_playlist_update
Update playlist
spotify_recently_played_get
Get recently played
spotify_repeat_mode_set
Set repeat mode
spotify_saved_albums_get
Get saved albums
spotify_saved_episodes_get
Get saved episodes
spotify_saved_tracks_get
Get saved tracks
spotify_search
Search
spotify_show_episodes_get
Get show episodes
spotify_shuffle_set
Set shuffle
spotify_top_items_get
Get top items

For more tools, view docs.

Build your Agent
Same auth pattern across LangChain, OpenAI, Anthropic, and Google ADK.
Python · LlamaIndex
import { ScalekitClient } from "@scalekit-sdk/node";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

// Spotify tools scoped to this user
const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["spotify"], toolNames: [
    "spotify_search",
    "spotify_playlist_create",
    "spotify_add_to_playlist"] },
  pageSize: 100,
});

const agent = createReactAgent({ llm, tools });
await agent.invoke({ messages: [{ role: "user", content: "Search for these tracks, create a playlist called Focus, and add them to it" }] });
import OpenAI from "openai";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const openai = new OpenAI();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["spotify"] }, pageSize: 100,
});

const res = await openai.chat.completions.create({
  model: "gpt-5",
  messages: [{ role: "user", content: "Search for these tracks, create a playlist called Focus, and add them to it" }],
  tools,
});

// Execute the tool call with the user's vaulted Spotify OAuth token
await sk.tools.executeTool(res.choices[0].message.tool_calls[0], "user_123");
import Anthropic from "@anthropic-ai/sdk";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const anthropic = new Anthropic();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["spotify"] }, pageSize: 100,
});

const msg = await anthropic.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Search for these tracks, create a playlist called Focus, and add them to it" }],
  tools,
});

// Tool call runs with the user's vaulted Spotify OAuth token
await sk.tools.executeTool(msg.content, "user_123");
import { Agent } from "@google/adk/agents";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["spotify"] }, pageSize: 100,
});

const agent = new Agent({
  name: "music_agent",
  model: "gemini-2.5-pro",
  instruction: "Spotify tools scoped to this user",
  tools,
});

await agent.run("Search for these tracks, create a playlist called Focus, and add them to it");
Try these prompts
Copy any prompt into your agent. Each maps directly to a Spotify tool. Click to copy, paste into your agent, done.
Discover
Copy the prompt
Copied
Search Spotify for albums by Khruangbin.
Copy the prompt
Copied
Show my top 10 artists.
Copy the prompt
Copied
What have I listened to recently?
Playlists and library
Copy the prompt
Copied
Create a private playlist called Focus.
Copy the prompt
Copied
Add these 5 tracks to my Focus playlist.
Copy the prompt
Copied
Save this album to my library.
Playback
Copy the prompt
Copied
Pause playback.
Copy the prompt
Copied
Transfer playback to my kitchen speaker.
Copy the prompt
Copied
Add this track to my queue.
SEE HOW AUTH WORKS
Each user signs in to Spotify once, and Scalekit stores and refreshes their tokens. Credentials stay vaulted, every call is scope checked, and every action is logged.
1
Authorize
Your user connects
Spotify
once. We tie it to their identity and the access they approved, with no shared bot account and no org-wide access
Who:
user ‘A’
when:
Once per user
access:
Limited to user
2
Store
Their
Spotify
credential lives in a vault scoped to them. User A's data is never reachable by an agent acting for user B, even on the same connection
vault:
encrypted
scope:
per-user
tenants:
isolated
3
Resolve
When your agent calls a
Spotify
tool, we fetch the right credential server-side. It never touches your agent, never appears in the LLM context, never shows up in your logs
speed:
~40ms
check:
before every call
seen by:
nobody
4
Audit
Every
Spotify
tool call is logged: who triggered it, which tool ran, what came back. 90 days of history, tied to the user who authorized it
history:
90 days
export:
SIEM-ready
logged:
every call
Test other agents
See the same per-user auth pattern across other media connectors.
Engineering Teams
Slack triage
Polls Slack for new messages, classifies bugs and support requests with a LangGraph router, files GitHub issues or Zendesk tickets, and confirms in the thread.
Test other agents
See the same per-user auth pattern across other media connectors.
ENGINEERING
Slack triage agent
Classify new Slack messages as bugs or support requests, file the GitHub issue or Zendesk ticket, and reply in the thread.
Why Scalekit
Secure your agent's access. Connectors ship in minutes
01.
Shared tokens break per-user analytics
A shared Spotify token looks fine in a demo. In production every playlist change and playback command looks like one service account, and you cannot tell which user triggered it. Scalekit resolves the credential of the actual user who triggered the agent, never a shared bot.
// shared token
audit → bot_service_account

// scalekit
audit → user_abc ✓
02.
Authentication is not authorization
03.
Multi-tenancy is architectural
04.
Spotify today. Ten connectors tomorrow.
“Our agents act across Salesforce, Gong, Google Drive, and more, on behalf of every customer. Scalekit behind the scenes meant we can keep adding tools without ever rebuilding how credentials or tool calling work.”
Venu Madhav Kattagoni
Head of Engineering / Von
FAQs
Frequently Asked Questions
Does the agent access Spotify as the user or through a shared service account?
As the user. Each user signs in to Spotify once, and Scalekit stores and refreshes their tokens. Playlist changes and playback commands are attributed to that user in your audit trail, not a shared service account.
Where is the Spotify OAuth token stored?
In Scalekit's managed AES-256 token vault, namespaced per tenant. Refresh is automatic. Revocation is a single dashboard action. Credentials never appear in prompts, logs, or LLM context.
Can I limit what the agent does in Spotify?
Yes. Filter by tool name in listScopedTools to expose only what you want, for example the search, library, and playlist read tools without spotify_library_remove or spotify_playlist_items_remove, which remove items, or the playback tools such as spotify_playback_start. Scalekit also enforces scope checks before every API call.
What happens when a user revokes Spotify access?
The connection is invalidated on the next tool call. Subsequent requests for that user fail closed with a clear error. Other users in the tenant remain unaffected. The event is logged for audit.
Which devices can the agent control?
spotify_devices_get lists the user's available playback devices with their IDs, names, types, and active status, and spotify_playback_transfer moves playback to another device, optionally starting it.
Start in your coding agent
Up and running in one command
Install the Scalekit skill in your editor of choice. Connector, auth, tools, prompt, all wired up
Claude Code REPL
/plugin marketplace add scalekit-inc/claude-code-authstack
/plugin install agentkit@scalekit-auth-stack
Cursor Code REPL
# ~/.cursor/mcp.json
{
""mcpServers"": {
""spotify"": {
""url"": ""https://mcp.scalekit.com/spotify"",
""headers"": { ""Authorization"": ""Bearer $SCALEKIT_TOKEN"" }
}
}
}
Codex Code REPL
# ~/.codex/config.toml
[mcp_servers.spotify]
url = ""https://mcp.scalekit.com/spotify""
auth_env = ""SCALEKIT_TOKEN""
Copilot Code REPL
# .vscode/mcp.json
{
""servers"": {
""spotify"": {
""url"": ""https://mcp.scalekit.com/spotify"",
""type"": ""http""
}
}
}