Spotify MCP 服务器

Spotify MCP 服务器

一个轻量级的 Model Context Protocol (MCP) 服务器,允许 AI 助手控制 Spotify 播放和管理播放列表。

快速入门

  1. 安装依赖 确保已安装 Node.js v16+ 和 Git。 克隆仓库并安装依赖:
    git clone https://github.com/marcelmarais/spotify-mcp-server.git
    cd spotify-mcp-server
    npm install
    npm run build
    
  2. 配置 Spotify 开发者应用
    • Spotify 开发者仪表板 创建应用。
    • 获取 Client ID 和 Client Secret。
    • 添加回调 URI(例如 http://localhost:8888/callback)。
  3. 生成配置文件 复制示例配置文件并填写信息:
    cp spotify-config.example.json spotify-config.json
    
    编辑 spotify-config.json 文件:
    {
      "clientId": "your-client-id",
      "clientSecret": "your-client-secret",
      "redirectUri": "http://localhost:8888/callback"
    }
    
  4. 运行认证脚本 执行以下命令以完成认证:
    npm run auth
    
    根据提示在浏览器中登录 Spotify 并授权应用。
  5. 启动服务 使用以下命令启动服务器:
    node build/index.js
    
  6. 集成到 AI 工具
    • 对于 Claude Desktop,在配置文件中添加:
      {
        "mcpServers": {
          "spotify": {
            "command": "node",
            "args": ["path/to/build/index.js"]
          }
        }
      }
      
    • 对于 Cursor,前往设置中的 MCP 标签页,添加如下命令:
      node path/to/spotify-mcp-server/build/index.js