spotify-mcp
A remote MCP server for Spotify with brokered OAuth and server-side intelligence, enabling search, playlist management, playback control, library analysis, and listening trends via natural language.
README
spotify-mcp
A remote, hosted MCP server for Spotify with brokered OAuth and a server-side intelligence layer. Add it to Claude as a custom connector by pasting one URL, log in to Spotify once, and every tool works: no local install, no JSON editing, no per-user Spotify developer app.
What makes it different
Most open-source Spotify MCP servers are thin wrappers around playback, search, and playlist CRUD. This one adds three things:
- An intelligence layer. Tools return pre-aggregated summaries (playlist composition, library statistics, listening trends, library gap analysis) instead of dumping raw JSON into the model's context window. The numbers are computed on the server; interpretation is explicitly left to the model, and every output labels which is which.
- Statefulness over time. The server snapshots listening history as you use it, so it can answer questions Spotify's API cannot answer in a single call, such as which artists are rising or fading in your rotation over months.
- Honesty about the current API. Spotify removed the audio-features, audio-analysis, and recommendations endpoints for third-party apps in November 2024, and removed more (artist top-tracks, browse, batch fetches, several response fields) in February 2026. This server does not pretend otherwise: nothing depends on dead endpoints, removed fields are optional everywhere, and if Spotify drops an endpoint at runtime the affected tool degrades with a clear message instead of erroring repeatedly.
Connecting from Claude
- In Claude, go to Settings, then Connectors, then "Add custom connector".
- Paste the server URL (for example
https://your-app.onrender.com/mcp). - Claude discovers the OAuth endpoints, registers itself, and opens a Spotify login page. Approve it.
- That's it. Ask Claude to call
get_initial_contextto confirm the connection.
You authenticate once. The server encrypts your Spotify tokens at rest (AES-256-GCM) and refreshes them transparently; you only see the consent screen again if Spotify revokes the grant.
Development Mode note: until the Spotify app behind this server is granted Extended Quota Mode, Spotify caps it at 5 authorized users, and the app owner must add each user's Spotify account email in the developer dashboard under User Management. Apply for Extended Quota Mode from the app dashboard to lift this.
Tools
Orientation
| Tool | What it does |
|---|---|
get_initial_context |
Call first. Connection status, display name, premium status, active device, available capabilities. |
Search and catalog
| Tool | What it does |
|---|---|
search_music |
Search tracks, artists, albums, playlists. Paginates internally past Spotify's 10-per-request cap, up to 50 per type. |
get_track_details |
Metadata for one track (cached). |
get_artist_details |
Metadata for one artist; says so plainly when Spotify omits genres. |
get_album_details |
Album metadata and tracklist. |
Playlists
| Tool | What it does |
|---|---|
list_playlists |
Your playlists with track counts and owners. |
get_playlist |
One playlist, raw (compact track list) or summary (server-computed aggregates). |
create_playlist |
New playlist (private by default), optionally with initial tracks. |
add_tracks_to_playlist / remove_tracks_from_playlist / reorder_playlist |
Playlist mutations; each invalidates the relevant cache. |
Playback (requires Premium and an active device)
| Tool | What it does |
|---|---|
get_playback_state |
Current track, device, shuffle/repeat, progress. |
control_playback |
Play, pause, next, previous, seek, volume. |
queue_tracks |
Queue tracks in order. |
list_devices |
Available Spotify Connect devices. |
transfer_playback |
Move playback to another device. |
With no active device you get an instruction to open Spotify somewhere, not a raw error. On a free account you get a plain statement that playback control needs Premium; every read-only tool still works.
Library and history
| Tool | What it does |
|---|---|
get_saved_tracks |
Saved (liked) tracks, newest first. |
get_recently_played |
Recent plays with timestamps. Each call also feeds the trend snapshots. |
save_items / remove_items |
Save or remove tracks, albums, or artist follows by URI. |
Insights (the differentiators)
| Tool | What it does |
|---|---|
summarize_playlist |
Artist distribution and concentration, release-era spread, runtime, add-date range. Measured, not vibes. |
summarize_library |
Aggregates over saved tracks: top artists, era distribution, diversity, save cadence by year. |
summarize_listening_trends |
Rising, fading, and new artists plus concentration change, from accumulated snapshots and Spotify's short-term vs long-term rankings. Honest when history is still thin. |
find_library_gaps |
The model proposes candidate artists/albums; the server measures which are genuinely absent from your library so it never recommends something you already have. |
Limitations
- No audio features, no recommendations. Spotify removed these endpoints for third-party apps (November 2024). Mood or energy characterizations in conversation are the model's inference from artists and eras, and the tools say so; they are not measured data.
- Playback control needs Spotify Premium and an active device. Spotify also no longer tells apps the subscription level, so premium status reads as "not yet determined" until the first playback attempt reveals it.
- Playlist contents are only returned for playlists you own or collaborate on (February 2026 API change).
- Search returns at most 10 results per request on Spotify's side; the server paginates internally up to 50 per type.
- Trend quality grows with use. Listening snapshots accumulate as the connector is used;
summarize_listening_trendssays explicitly when stored history is too thin and falls back to Spotify's own top-item rankings. - Large libraries are scanned up to the 500 most recent saves per analysis call to bound API fan-out; outputs disclose when this truncates.
Self-hosting
You need: a Spotify developer app, a free Neon Postgres database, and a free Render web service (Fly.io or Railway work too).
- Spotify dashboard: create an app. Add
https://<your-host>/callbackas a redirect URI. Note the client ID and secret. The app owner needs active Premium for Development Mode. - Neon: create a project and copy the connection string.
- Render: create a web service from this repo.
- Build command:
npm ci && npm run build && npm run db:migrate(migrations run againstDATABASE_URLon each deploy; they are idempotent). - Start command:
npm start - Health check path:
/healthz
- Build command:
- Environment variables: set every variable from
.env.examplein the Render dashboard. Nothing sensitive lives in the repo; the server validates the environment at boot and exits with a specific message if anything is missing or malformed. GenerateMASTER_ENCRYPTION_KEYwithnode -e "console.log(require('crypto').randomBytes(32).toString('base64'))"and use a long random string forJWT_SIGNING_KEY. - Verify
https://<your-host>/healthzreturns 200 andhttps://<your-host>/.well-known/oauth-authorization-serverreturns metadata, then connect from Claude as above.
Development
npm install
npm run dev # tsx watch with a local .env
npm test # full suite: unit + integration against in-memory Postgres
npm run typecheck
Integration tests run against PGlite (real migrations, in-memory Postgres) and a fake Spotify, so no network or credentials are needed.
The full system design, phase-by-phase build plan, and decisions log live in spotifymcp.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
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 模型以安全和受控的方式获取实时的网络信息。