Sponsored by Deepsite.site

spotify_mcp

Created By
jmoro04087 months ago
MCP Server to control Spotify
Content

spotify_mcp

Project Description

This project is a Spotify integration built using the Model Context Protocol (MCP). It provides a set of tools and resources that allow interaction with the Spotify API, enabling control over playback, access to user data, and more, all through the MCP framework.

Setup

To get this project up and running, follow these steps:

  1. Clone the repository:

    git clone https://github.com/your-username/spotify_mcp.git
    cd spotify_mcp
    

    (Replace your-username with the actual repository owner and name if this is hosted on GitHub)

  2. Set up a virtual environment (recommended):

    python -m venv .venv
    source .venv/bin/activate
    
  3. Install dependencies:

    uv sync
    
  4. Set up Spotify API Credentials:

    • Go to the Spotify Developer Dashboard.
    • Log in and create a new application.
    • Note down your Client ID and Client Secret.
    • Add a Redirect URI. For local development, http://localhost:8888/callback is commonly used.
    • Create a .env file in the project root directory with the following content:
      SPOTIPY_CLIENT_ID='YOUR_CLIENT_ID'
      SPOTIPY_CLIENT_SECRET='YOUR_CLIENT_SECRET'
      SPOTIPY_REDIRECT_URI='YOUR_REDIRECT_URI'
      
      Replace the placeholder values with your actual credentials and redirect URI.
  5. Run the server:

    python src/server.py
    

    This will start the MCP server, making the Spotify tools and resources available.

Usage

Once the server is running and configured, you can interact with the Spotify API through the defined MCP tools. The specific methods for interacting with MCP tools will depend on the client application or framework you are using that supports MCP.

If using Claude as your MCP client, you need to edit your claude_desktop_config.json to include:

{
  "mcpServers": {
    "Spotify_MCP": {
      "command": "<FULL_UV_PATH>",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "spotipy",
        "mcp",
        "run",
        <FULL_PATH_TO_MAIN.py>
      ],
      "env": {
        "SPOTIFY_CLIENT_ID": "<CLIENT_ID>",
        "SPOTIFY_CLIENT_SECRET": "<CLIENT_SECRET>",
        "SPOTIFY_REDIRECT_URI": "<REDIRECT_URI>"
      }
    }
  }
}

Currently supported actions

  1. Play a song
  2. Get users playlists
  3. Play from user playlist
  4. Play from SP playlists like charts
  5. Pause Playback
  6. Skip to next
  7. Skip to previous
  8. Turn shuffle on
  9. Turn shuffle off
  10. Play a user's liked songs
  11. Get recently played song
  12. Add to queue
  13. Get most played songs this week/month/year

To Implement

  1. Add a song to a playlist
  2. Add tracks to playlist
  3. Create a playlist
  4. Get recently popular songs. i.e. songs that I discovered recently that I have been playing a lot of.
  5. Generate LLM powered playlists. i.e. "Create a dance workout playlist based on my recent favorite artists"

Project Structure

  • src/auth.py: Handles Spotify API authentication.
  • src/main.py: Likely the main entry point or core logic of the application.
  • src/resources.py: Defines MCP resources for accessing Spotify data.
  • src/server.py: The MCP server implementation.
  • src/tools.py: Defines MCP tools for interacting with the Spotify API (the supported actions listed above).
  • src/utils.py: Utility functions used across the project.
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
DeepChatYour AI Partner on Desktop
Serper MCP ServerA Serper MCP Server
WindsurfThe new purpose-built IDE to harness magic
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Playwright McpPlaywright MCP server
Amap Maps高德地图官方 MCP Server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.