mcp-server-spotify

mcp-server-spotify

MCP server for the Spotify Web API — gives Claude and other AI assistants tools to search music, control playback, manage playlists, library, and podcasts.

Category
访问服务器

README

Spotify MCP Server

PyPI

A Model Context Protocol (MCP) server that provides tools for interacting with the Spotify Web API. Enables AI assistants like Claude to search music, control playback, manage playlists, and more.

Features

  • Search - Find tracks, albums, artists, playlists, shows, episodes, and audiobooks
  • Playback Control - Play, pause, skip, seek, volume, shuffle, repeat, queue management
  • Playlists - Create, update, add/remove/reorder tracks
  • Library - View and manage saved tracks, albums, shows, episodes, and audiobooks
  • Browse - Get album details, artist info, track metadata
  • Podcasts & Audiobooks - Browse shows, episodes, audiobooks, and chapters
  • User Profile - View profile, top artists/tracks, followed artists
  • 44 tools covering non-deprecated Spotify Web API endpoints

Prerequisites

  • uv — install with curl -LsSf https://astral.sh/uv/install.sh | sh
  • A Spotify Developer account
  • A Spotify app with Client ID and Client Secret

Getting Your Spotify Credentials

  1. Go to the Spotify Developer Dashboard
  2. Click Create App
  3. Fill in the app details:
    • App name: Choose any name (e.g., "My MCP Server")
    • App description: Optional
    • Redirect URI: http://127.0.0.1:8888/callback
    • Which API/SDKs are you planning to use?: Select Web API
  4. Click Save
  5. On your app's page, find your Client ID
  6. Click Show client secret to reveal your Client Secret

Important: The redirect URI must exactly match http://127.0.0.1:8888/callback (or whatever you set in SPOTIFY_REDIRECT_URI). Do not use localhost — use 127.0.0.1.

Installation

Pick your client below. All examples use uvx to fetch the server on demand — no clone, no manual install.

Claude Code

claude mcp add spotify \
  -e SPOTIFY_CLIENT_ID=your_client_id \
  -e SPOTIFY_CLIENT_SECRET=your_client_secret \
  -- uvx mcp-server-spotify

Other MCP clients

Most MCP clients configure servers via a JSON file. Add this entry to your client's MCP config:

{
  "mcpServers": {
    "spotify": {
      "command": "uvx",
      "args": ["mcp-server-spotify"],
      "env": {
        "SPOTIFY_CLIENT_ID": "your_client_id",
        "SPOTIFY_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Running from a local checkout

For development, or if you want to run a modified copy:

git clone https://github.com/llyfn/spotify-mcp.git
cd spotify-mcp && uv sync

Then point your client at the local checkout instead of uvx:

"command": "uv",
"args": ["--directory", "/absolute/path/to/spotify-mcp", "run", "mcp-server-spotify"]

Configuration

Variable Required Default Description
SPOTIFY_CLIENT_ID Yes Your Spotify app's Client ID
SPOTIFY_CLIENT_SECRET Yes Your Spotify app's Client Secret
SPOTIFY_REDIRECT_URI No http://127.0.0.1:8888/callback OAuth redirect URI

Authentication

The server uses Spotify's Authorization Code flow:

  1. On first use, the server opens your browser to Spotify's login page
  2. Spotify will ask you to approve access — the server requests all scopes needed for the full tool set (playback, library, playlists, and user data)
  3. After you authorize, Spotify redirects to the local callback server
  4. The server exchanges the authorization code for access/refresh tokens
  5. Tokens are stored securely in ~/.spotify-mcp/credentials.json
  6. Tokens are automatically refreshed when they expire

If running in a headless environment (SSH, Docker), the auth URL will be printed to stderr — copy and paste it into a browser manually.

Re-authenticating

To re-authenticate (e.g., after revoking access), delete the stored credentials:

rm ~/.spotify-mcp/credentials.json

Available Tools

Search

Tool Description
search Search for tracks, albums, artists, playlists, shows, episodes, or audiobooks

Albums

Tool Description
get_album Get album details by ID
get_album_tracks Get tracks in an album

Artists

Tool Description
get_artist Get artist details by ID
get_artist_albums Get albums by an artist

Tracks

Tool Description
get_track Get track details by ID

Playlists

Tool Description
get_playlist Get playlist details
update_playlist Update playlist name, description, or visibility
get_playlist_items Get items in a playlist
add_playlist_items Add tracks/episodes to a playlist
remove_playlist_items Remove items from a playlist
reorder_playlist_items Reorder items in a playlist
get_my_playlists Get the current user's playlists
create_playlist Create a new playlist

Library

Tool Description
get_saved_tracks Get saved tracks
get_saved_albums Get saved albums
get_saved_shows Get saved shows
get_saved_episodes Get saved episodes
get_saved_audiobooks Get saved audiobooks
save_to_library Save items to library
remove_from_library Remove items from library
check_saved_in_library Check if items are in library

Player

Tool Description
get_playback_state Get current playback state
get_currently_playing Get the currently playing track
play Start or resume playback
pause Pause playback
next_track Skip to next track
previous_track Skip to previous track
seek Seek to position in track
set_repeat Set repeat mode (track/context/off)
set_volume Set playback volume
toggle_shuffle Toggle shuffle mode
transfer_playback Transfer playback to another device
get_devices Get available devices
add_to_queue Add item to playback queue
get_queue Get the playback queue
get_recently_played Get recently played tracks

Shows & Podcasts

Tool Description
get_show Get show details
get_show_episodes Get episodes of a show

Audiobooks

Tool Description
get_audiobook Get audiobook details
get_audiobook_chapters Get chapters of an audiobook
get_chapter Get chapter details

Users

Tool Description
get_my_profile Get current user's profile
get_my_top_items Get top artists or tracks

Following artists/users uses the same save_to_library / remove_from_library / check_saved_in_library tools — pass an artist or user URI.

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT - see LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选