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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.