Spotify MCP
Enables searching and managing Spotify playlists, tracks, and user information through the Spotify Web API.
README
Spotify MCP
A local Model Context Protocol server for the Spotify Web API. Runs on your machine and lets an MCP client — Claude Code, the Coworker desktop app, or anything else that speaks MCP — search Spotify, view song and playlist details, list your playlists, and create new ones on your behalf.
Features
| Tool | What it does |
|---|---|
authenticate |
Sign in to Spotify via OAuth (opens a browser). Run once. |
auth_status |
Check whether the server is authenticated and how it's configured. |
get_current_user |
Your Spotify profile (id, display name, country, …). |
search |
Search the catalog for tracks, albums, artists, or playlists. |
get_track |
Detailed info for a single song. |
list_my_playlists |
List the playlists you own or follow (paginated). |
get_playlist |
A playlist's details and its tracks. |
create_playlist |
Create a new playlist (optionally seeded with tracks). |
add_tracks_to_playlist |
Add songs to an existing playlist. |
get_currently_playing |
The track currently playing on your account, if any. |
How it works
Authentication uses the Authorization Code with PKCE flow — Spotify's
recommended flow for locally-run apps, because it needs only a Client ID and no
client secret. On first use the server opens your browser, you approve access,
and the resulting tokens are cached at ~/.spotify-mcp/token.json and refreshed
automatically. You typically authenticate just once per machine.
Prerequisites
- Python 3.10+
- A free Spotify account
- A Spotify app (for the Client ID):
- Go to the Spotify Developer Dashboard and Create app.
- Under Redirect URIs, add exactly:
http://127.0.0.1:8888/callbackSpotify requires loopback redirect URIs to use
127.0.0.1(notlocalhost). If you change the port, updateSPOTIFY_REDIRECT_URIto match. - Copy the Client ID. (The Client Secret is not required.)
Installation
git clone <this-repo> spotify-mcp
cd spotify-mcp
# with uv (recommended)
uv sync
# or with pip
python -m venv .venv && source .venv/bin/activate
pip install -e .
Configuration
Set your Client ID (and optionally the redirect URI) as environment variables.
For local testing you can copy .env.example to .env, but MCP clients pass
these via their config env block (shown below).
| Variable | Required | Default | Notes |
|---|---|---|---|
SPOTIFY_CLIENT_ID |
✅ | — | From your Spotify app dashboard. |
SPOTIFY_CLIENT_SECRET |
— | — | Optional. If set, uses the classic Authorization Code flow instead of PKCE. |
SPOTIFY_REDIRECT_URI |
— | http://127.0.0.1:8888/callback |
Must exactly match a redirect URI on your app. |
SPOTIFY_MCP_CACHE |
— | ~/.spotify-mcp/token.json |
Where OAuth tokens are cached. |
Authenticate first (recommended)
Sign in once from the terminal before wiring it into a client — this makes the first-run browser flow easier to see:
spotify-mcp auth # opens a browser to sign in
spotify-mcp status # confirm you're authenticated
You can also trigger this later from within any MCP client by calling the
authenticate tool.
Using with Claude Code
Register the server (adjust the command/path for your install):
claude mcp add spotify \
--env SPOTIFY_CLIENT_ID=your_client_id_here \
-- spotify-mcp
Or add it to your MCP config JSON directly:
{
"mcpServers": {
"spotify": {
"command": "spotify-mcp",
"env": {
"SPOTIFY_CLIENT_ID": "your_client_id_here"
}
}
}
}
If spotify-mcp isn't on your PATH, use the full interpreter path instead,
e.g. "command": "/path/to/spotify-mcp/.venv/bin/spotify-mcp", or
"command": "uv" with "args": ["run", "spotify-mcp"] and a cwd.
Using with Coworker (or other MCP clients)
Any MCP client that launches a stdio server works. Point it at the spotify-mcp
command (or python -m spotify_mcp) with SPOTIFY_CLIENT_ID in the environment:
{
"mcpServers": {
"spotify": {
"command": "spotify-mcp",
"env": { "SPOTIFY_CLIENT_ID": "your_client_id_here" }
}
}
}
Then just ask, e.g.:
- "Search Spotify for upbeat indie tracks from 2019."
- "Show me the songs in my Focus playlist."
- "Create a private playlist called Roadtrip and add these five songs."
Scopes requested
The server requests the scopes needed for its tools:
user-read-private, user-read-email, playlist-read-private,
playlist-read-collaborative, playlist-modify-private,
playlist-modify-public.
Security notes
- OAuth tokens are stored locally at
SPOTIFY_MCP_CACHEwith0600permissions and are git-ignored. Never commit them. - PKCE means no client secret is stored on disk or passed around.
- The server only calls Spotify's official API endpoints over HTTPS.
Development
# Run the server over stdio (what MCP clients invoke)
spotify-mcp
# Or as a module
python -m spotify_mcp
Project layout:
src/spotify_mcp/
auth.py # OAuth (PKCE) flow, token cache & refresh
client.py # Spotify Web API wrapper + response trimming
server.py # FastMCP server and tool definitions
__main__.py # CLI: run server / auth / status
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。