Spotify Model Context Protocol

by belljustin
MIT License

Integrations

  • Enables creation of Spotify playlists based on text descriptions, with OAuth authentication handling for accessing Spotify's API.

Spotify 模型上下文协议 (MCP)

用于根据描述创建播放列表的 Spotify MCP。

先决条件

  • Python 3.6 或更高版本
  • Spotify 开发者凭证(客户端 ID 和客户端密钥)

设置

  1. 克隆此存储库:
    git clone https://github.com/yourusername/spotify-mcp.git cd spotify-mcp
  2. 安装所需的依赖项:
    pip install -r requirements.txt
  3. 设置您的 Spotify 开发者凭证:
    • 前往Spotify 开发者仪表板
    • 创建新应用程序
    • 设置环境变量:
      echo SPOTIFY_CLIENT_ID='your_client_id' >> .env echo SPOTIFY_CLIENT_SECRET='your_client_secret' >> .env

用法

启动身份验证服务器

  1. 在 Spotify 开发者仪表板中设置您的重定向 URI:
    • Spotify 开发者面板中进入你的应用
    • 点击“编辑设置”
    • http://localhost:5000/callback添加到重定向 URI
    • 保存更改
  2. 启动认证服务器:
    python main.py
    这将在端口 5000 上启动一个处理 Spotify OAuth 身份验证的本地服务器。
  3. 在浏览器中访问http://localhost:5000进行 Spotify 身份验证。身份验证成功后,您的访问令牌将被保存,以供 MCP 使用。

与 Cursor 集成

  1. 打开 Cursor 并转到“设置”
  2. 导航至“模型上下文协议”部分
  3. 点击“添加 MCP”
  4. 在 mcp.json 中输入以下详细信息,替换 PATH-TO-BASE-DIR:
{ "mcpServers": { "spotify": { "command": "uv", "args": [ "--directory", "PATH-TO-BASE-DIR/spotify-mcp", "run", "spotify.py" ] } } }

现在,您可以使用 Cursor 中的 Spotify MCP 命令直接从编辑器创建和管理播放列表!

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

通过 OAuth 身份验证将 Cursor 编辑器连接到 Spotify 的 API,从而能够根据文本描述创建 Spotify 播放列表。

  1. Prerequisites
    1. Setup
      1. Usage
        1. Starting the Authentication Server
        2. Integrating with Cursor

      Related MCP Servers

      • A
        security
        A
        license
        A
        quality
        Enables interaction with Spotify's music catalog via the Spotify Web API, supporting searches, artist information retrieval, playlist management, and automatic token handling.
        Last updated -
        26
        547
        2
        TypeScript
        MIT License
      • A
        security
        F
        license
        A
        quality
        A FastMCP tool that enables control of Spotify through natural language commands in Cursor Composer, allowing users to manage playback, search for content, and interact with playlists.
        Last updated -
        21
        1
        Python
      • -
        security
        F
        license
        -
        quality
        Integrates with Spotify Web API through the Model Context Protocol, allowing users to search tracks, control playback, and manage playlists programmatically.
        Last updated -
        JavaScript
      • A
        security
        F
        license
        A
        quality
        Enables Claude to interact with Spotify by searching songs, creating playlists, getting recommendations, and managing your music through your Spotify account.
        Last updated -
        7
        1
        JavaScript

      View all related MCP servers

      ID: 4bz9ehbqc6