Spotify播放控制服务器

一个通过LLM控制Spotify播放和管理喜欢歌曲的简单MCP服务器。

  • by mfteloglu
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 mfteloglu/spotify-mcp-server

使用说明

Spotify MCP服务器

一个简单的MCP服务器,通过LLM控制Spotify播放和管理您喜欢的歌曲。

特性

  • 播放和暂停Spotify播放
  • 获取当前曲目的信息
  • 将当前曲目添加到您喜欢的歌曲中

设置

  1. 克隆存储库:

    git clone https://github.com/yourusername/spotify-mcp-server.git
    cd spotify-mcp-server
    
  2. 创建并激活虚拟环境:

    python3 -m venv .venv
    source .venv/bin/activate
    
  3. 安装依赖项:

    pip install uv
    pip install -r requirements.txt
    
  4. 创建一个 .env 文件:

    SPOTIPY_CLIENT_ID=your_spotify_client_id
    SPOTIPY_CLIENT_SECRET=your_spotify_client_secret
    SPOTIPY_REDIRECT_URI=http://localhost:8888/callback
    
  5. 运行服务器:

    python main.py
    

与Claude Desktop(MCP服务器)集成

要将此服务器用作Claude的MCP服务器,请将以下条目添加到Claude配置文件中(通常位于 ~/Library/Application Support/Claude/claude_desktop_config.json 在 macOS 上:

{
  "mcpServers": {
    "spotify-mcp-server": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/PROJECT/spotify-mcp-server",
        "run",
        "main.py"
      ]
    }
  }
}
  • 替换 /ABSOLUTE/PATH/TO/PROJECT/spotify-mcp-server 与项目的实际路径
  • 如果命令 uv 无法识别,请给出的绝对路径 uv 可执行文件(可以在 which uv macOS)
  • 确保在配置中或通过 .env 文件。
  • 编辑配置文件后重新启动Claude。

备注

示例会话

以下是使用Claude与Spotify MCP服务器的示例会话:

示例交互:

User: Play the current track using Spotify MCP server
Claude: Playback started successfully

User: What song is playing?
Claude: Currently playing: Shape of You by Ed Sheeran

User: Like this song
Claude: Added 'Shape of You' to your Liked Songs.