Spotify Mcp

io.github.XavierFabregat由 GitHub 帳號 XavierFabregat 發布v0.1.2更新於 Oct 24, 2026

Conversational Spotify control from AI clients: play, queue, devices, playlists, and library.

已驗證STDIO僅桌面效率與工作流媒體與設計

概覽

AI 產生的概覽

本機 MCP 伺服器,讓 AI 助理控制 Spotify:播放音樂、管理佇列、裝置、播放清單與音樂庫。

可以做什麼
  • 依自然語言描述或 Spotify URI 播放音樂,並控制播放(暫停、繼續、下一首、上一首、跳轉、音量、隨機、循環)
  • 查看目前播放內容,包括進度、裝置與播放模式
  • 把曲目加入佇列並查看接下來要播放的內容
  • 列出裝置並在裝置之間轉移播放
  • 搜尋曲目、專輯、藝人與播放清單,列出自己的播放清單及其曲目
  • 建立播放清單、加入曲目,以及儲存、移除或檢查音樂庫項目
適用情境
適合在 Claude Desktop、Claude Code、Cursor 或其他 MCP 用戶端中以對話方式操作 Spotify,例如用描述點歌、把整張專輯加入佇列或收藏曲目,而不必切換應用程式。
執行需求
透過 npx 在本機執行,需要 Node.js 20 或更新版本。需要 Spotify Premium 帳號,並透過 init 精靈建立自己的 Spotify 開發者應用程式(Client ID);登入使用 OAuth PKCE,不涉及用戶端密鑰。應用程式的 Redirect URI 必須完全為 8888 連接埠需閒置。權杖儲存在 ~/.spotify-mcp/ 目錄。
安裝前請注意
只有在某個裝置上已開啟 Spotify 應用程式時才能控制播放。此伺服器會變更帳號內容:開始播放、修改播放清單、儲存或移除音樂庫項目。登入會開啟瀏覽器並把 OAuth 權杖存在本機;SPOTIFY_CLIENT_ID 環境變數會覆寫已儲存的設定。Spotify 對第三方應用程式的使用者數有上限,因此每位使用者需自行註冊應用程式。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Spotify Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[圖片] spotify-mcp

[npm] [CI] [license] [node]

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

sh
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

sh
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):

json
{  "mcpServers": {    "spotify": {      "command": "npx",      "args": ["-y", "@xavifabregat/spotify-mcp"]    }  }}

Restart the client and start talking.

Claude Desktop extension (one-click)

Prefer not to edit config files? Install the .mcpb bundle instead: download spotify-mcp.mcpb from the latest release, open it (or drag it into Claude Desktop → Settings → Extensions), and paste your Spotify app's Client ID when prompted. Then ask Claude to connect Spotify — the authenticate tool opens the browser login. You still need the developer app and Redirect URI from the quick start, but not the init wizard.

Tools

ToolWhat it does
playPlay by free-text query (search → best match → play) or Spotify URI
playbackpause / resume / next / previous / seek / volume / shuffle / repeat
now_playingCurrent track, progress, device, mode
queueAdd a track to the queue; show up next
devicesList devices; transfer playback
searchBrowse tracks/albums/artists/playlists (max 10 per type — API cap)
get_playlistsList your playlists
get_playlist_itemsShow a playlist's tracks (own/collaborative only — API restriction)
modify_playlistCreate a playlist; add tracks
librarySave / remove / check items in your library
authenticateRun 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 authenticate tool. 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 URI during login — the Redirect URI in your app settings isn't exactly http://127.0.0.1:8888/callback (localhost is rejected by Spotify).
  • Port 8888 in use during login — set SPOTIFY_REDIRECT_PORT to a free port and register the matching redirect URI.
  • "Token refresh failed" — run npx -y @xavifabregat/spotify-mcp auth to log in again (e.g. after changing the Client ID).
  • Config precedence — the SPOTIFY_CLIENT_ID env var overrides ~/.spotify-mcp/config.json (written by init).

Development

sh
git clone https://github.com/XavierFabregat/spotify-mcp.gitcd spotify-mcpnpm installnpm run buildnpm run inspect   # MCP Inspector against the local buildnpm run bundle    # build/spotify-mcp.mcpb (Claude Desktop extension)

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

來源:README.md,提交 05b1c5d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分