MCP (Model Context Protocol) is Anthropic’s open protocol that lets LLMs do things instead of just talking about them. Claude Desktop supports it natively. One standard protocol, any model, any tool. That’s it.

I use Spotify constantly and I use LLMs constantly. Why can’t Claude just control my Spotify? Claude can now.

why LLMs don’t recognize Spotify natively

LLMs Doesn't Recognise Spotify

how it works

How it Works

what I wanted to do

  • Play, pause, and skip tracks via Claude
  • Queue songs by name or mood
  • Get quick info about the music
  • Make playlist according to ‘vibes’
  • Ability to manipulate music and my current playlists on Spotify

model

I used the Spotipy Web API with the MCP integration for Claude. Sample server.py:

# server.py
import mcp.server.fastmcp
from spotipy import Spotify
from spotipy.oauth2 import SpotifyOAuth

auth = SpotifyOAuth(
    client_id="id",
    client_secret="secret",
    redirect_uri="uri",
    scope="user-modify-playback-state user-read-playback-state user-read-currently-playing",
    cache_path=".cache",
    open_browser=True
)

# caches the access token to avoid repeatedly requesting permission from Spotify
token_info = auth.get_access_token(as_dict=False)
sp = Spotify(auth_manager=auth)

# Create an MCP server
server = mcp.server.fastmcp.FastMCP("Demo")

# Spotify tools
@server.tool()
async def play_song(song_name: str) -> str:
    results = sp.search(q=song_name, limit=1, type='track')
    if results['tracks']['items']:
        track = results['tracks']['items'][0]
        sp.start_playback(uris=[track['uri']])
        return f"Playing {track['name']} by {track['artists'][0]['name']}"
    return "Song not found"

@server.tool()
async def pause() -> str:
    sp.pause_playback()
    return "Paused"

if __name__ == "__main__":
    server.run(transport='stdio')

Integrate this into Claude Desktop via claude_desktop_config.json:

{
  "mcpServers": {
      "spotify": {
          "command": "~/.local/bin/uv",
          "args": [
              "--directory",
              "~/fun/mcp-server/mcp-server-demo",
              "run",
              "server.py"
          ]
      }
  }
}

Then run the server:

uv run server.py

Claude can now use your Spotify tools.

MCP Tools in Claude

in action

Claude Talking to Spotify

Spotify2

Spotify3

Video Link

what it can do

Play/pause/skip, queue songs, create playlists by mood or vibe, get info on what’s playing, shuffle/repeat, pull up lyrics (via Genius API), browse liked/recently played. Full Spotify control through natural language.


Spotify unfortunately is lame. No use of localhost or support for custom HTTPS + removes all fun features like analysing audio. They did this last week, guess I’m late to the AI learning hype. But MCP servers are growing quickly - see other examples at the official repo

Had to use ngrok for tunneling, which seems excessive for a localhost server. Other than that the python stuff is pretty basic and mcp does the magic.

This came together fast. Spotipy handles OAuth and API calls, keeping the MCP layer minimal.

You don’t need the Spotipy wrapper - you could also hit the Spotify REST API directly from your MCP tool:

# Raw API sample (if not using Spotipy)
import requests

def play_song(access_token, track_uri):
    url = "https://api.spotify.com/v1/me/player/play"
    headers = {"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"}
    data = {"uris": [track_uri]}
    return requests.put(url, headers=headers, json=data).status_code

Next up: a trading bot that talks to Zerodha, or a flight booking tool so I don’t have to open MMT. Both should be straightforward now.

Github


<
Previous Post
600+ leetcode questions: lessons
>
Next Post
hello world of neural networks