spotify-mcp
A local-first Spotify MCP server providing typed tools for music search, playback, playlists, audio analysis, and snapshot-safe DJ planning, with OAuth PKCE and no client secret stored.
README
<div align="center">
🎵 Spotify for Codex
Ask Codex to play music, find old favourites, build playlists, or plan a DJ set.
Get started · Codex plugin guide · See what you can ask · Setup guide
</div>
[!NOTE] This open-source project has no connection to Spotify AB. Use it in line with the Spotify Developer Policy.
💬 What can I ask?
Play something I’ll like.
Build me a road-trip playlist that rediscovers music from across my Liked Songs history.
You can also search for music and podcasts, control playback, review your Liked Songs, or turn a playlist into a DJ running order.
✨ What it can do
- 🎶 Play naturally: resolve a precise track, album, artist, or playlist from a query, control seek, shuffle, repeat, volume, queue, and Spotify Connect devices.
- 🎧 Find music from your library: search your full Liked Songs history, including tracks you saved years ago.
- 🧩 Build with safeguards: bundled workflows preserve Spotify track identities. They stop after an uncertain write and preview DJ reorders before they change a playlist.
You can shape a playlist around a mood or journey, then open the result in Spotify.
🚀 Get started
You need Python 3.11+, uv, and a Spotify Web API app. The server uses your app’s Client ID. It does not need the Client Secret.
📦 1. Download the project
git clone https://github.com/martin-gomola/spotify-mcp.git
cd spotify-mcp
cp .env.example .env
🔑 2. Configure Spotify
Create an app in the Spotify Developer Dashboard, add
http://127.0.0.1:8888/callback as its Redirect URI, then put its Client ID in .env:
SPOTIFY_CLIENT_ID=your_client_id
The setup guide covers the dashboard steps and Spotify Development Mode limits.
🔌 3. Install for Codex
make codex-install
Approve the Spotify page that opens, then start a new Codex task. Codex starts the local server when you use it, so you can close the setup terminal. The Codex plugin guide explains how the plugin starts the server, what it includes, and what to ask first.
🛡️ Safety by default
- 🔐 Spotify tokens stay outside the repository in a private local file.
- 🎚️ Audio analysis and the DJ fallback may send exact Spotify track IDs to ReccoBeats when Spotify lacks the required audio data.
- ⛔ The server stops after a write with an uncertain outcome. It does not retry that write.
- 🗑️ Low-level removal tools apply changes at once and offer no undo. The library audit workflow shows exact recording IDs before removal.
- ✅ After a playlist write, the workflow fetches the playlist and compares the result. Low-level tools return Spotify’s response without treating an ambiguous result as success.
- 🧾 DJ apply and restore start with a dry run. Each command checks the live playlist before a write.
<details> <summary><strong>🛠️ Developing or connecting another MCP client?</strong></summary>
Complete authentication once:
make setup
Configure your MCP client to launch uv run spotify-mcp serve with this repository as its working
directory. Each client uses its own configuration. This repository provides a guided installer for
Codex. For local development and verification, follow the
development guide.
</details>
📚 Learn more
- 🚀 Setup and troubleshooting
- 🧩 Codex plugin guide
- 🧰 Available Spotify tools
- 🧭 Architecture and data flow
- 🧪 Development and verification
- 🔒 Security policy
The source uses the MIT License. Spotify AB owns the Spotify trademark and does not sponsor or endorse this project.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。