Spotify MCP
MCP server to control Spotify conversationally from Claude, Cursor, and other AI clients.
README
spotify-mcp
Control Spotify by talking to your AI. An MCP server for Claude Desktop, Claude Code, Cursor, and any other MCP client.
You: play something like early Bill Evans AI: ▶ Now playing: "Peace Piece" — Bill Evans · Everybody Digs Bill Evans
You: perfect, queue the whole album and save this one AI: ➕ Queued Everybody Digs Bill Evans · ❤️ Saved "Peace Piece" to your library
Built against the current (post-February-2026) Spotify Web API — many older Spotify MCP servers predate those changes and are partially broken.
Requirements
- Spotify Premium — Spotify requires it for playback control and (since Feb 2026) for creating the developer app you'll use.
- Node.js ≥ 20
Quick start
npx -y @xavifabregat/spotify-mcp init
The wizard walks you through creating your own (free) Spotify developer app, asks for its Client ID, and opens a browser to connect your account — about 2 minutes total.
Why your own app? Spotify caps third-party apps at a handful of users, so every user
brings their own; the wizard makes that painless. No client secret is involved (PKCE).
Tokens stay in ~/.spotify-mcp/ on your machine and refresh silently.
The one detail that must be exact — your app's Redirect URI:
http://127.0.0.1:8888/callback
Add to your MCP client
Claude Code
claude mcp add -s user spotify -- npx -y @xavifabregat/spotify-mcp
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json)
or Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"spotify": {
"command": "npx",
"args": ["-y", "@xavifabregat/spotify-mcp"]
}
}
}
Restart the client and start talking.
Tools
| Tool | What it does |
|---|---|
play |
Play by free-text query (search → best match → play) or Spotify URI |
playback |
pause / resume / next / previous / seek / volume / shuffle / repeat |
now_playing |
Current track, progress, device, mode |
queue |
Add a track to the queue; show up next |
devices |
List devices; transfer playback |
search |
Browse tracks/albums/artists/playlists (max 10 per type — API cap) |
get_playlists |
List your playlists |
get_playlist_items |
Show a playlist's tracks (own/collaborative only — API restriction) |
modify_playlist |
Create a playlist; add tracks |
library |
Save / remove / check items in your library |
authenticate |
Run the Spotify login from inside a conversation |
Design
- Tools are intents, not endpoints. "Play some Radiohead" is one tool call — the server searches, picks the best match, starts playback, and reports what it chose so you can correct it. No search → choose → play round trips.
- Small surface. 11 tools instead of one per API endpoint keeps tool selection accurate across different AI clients and context lean.
- Responses are compact text with Spotify URIs, so follow-ups ("queue that") chain without re-searching. Raw API payloads never reach the model.
- Errors are instructions. No active device? The response lists your devices and
says how to pick one. Not logged in? It points at the
authenticatetool. The model relays the fix instead of a stack trace.
Troubleshooting
- "No active Spotify device" — Spotify's API can only steer a running app. Open Spotify anywhere; if it just woke up, tap play/pause once. With exactly one device online, the tools target it automatically.
INVALID_CLIENT: Invalid redirect URIduring login — the Redirect URI in your app settings isn't exactlyhttp://127.0.0.1:8888/callback(localhostis rejected by Spotify).- Port 8888 in use during login — set
SPOTIFY_REDIRECT_PORTto a free port and register the matching redirect URI. - "Token refresh failed" — run
npx -y @xavifabregat/spotify-mcp authto log in again (e.g. after changing the Client ID). - Config precedence — the
SPOTIFY_CLIENT_IDenv var overrides~/.spotify-mcp/config.json(written byinit).
Development
git clone https://github.com/XavierFabregat/spotify-mcp.git
cd spotify-mcp
npm install
npm run build
npm run inspect # MCP Inspector against the local build
Layout: src/auth.ts (OAuth PKCE + token store) · src/spotify.ts (typed API
client) · src/tools/ (tool implementations) · src/format.ts (compact output).
License
MIT © Xavi Fabregat
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。