Spotify MCP Server

by hrishi0102

Integrations

  • Enables searching for tracks, viewing profile information, creating and managing playlists, adding tracks to playlists, and getting personalized music recommendations using a Spotify account.

Spotify MCP 服务器

一个简单的模型上下文协议 (MCP) 服务器,可让您通过 Claude 与 Spotify 进行交互。此服务器允许 Claude 使用您的 Spotify 帐户搜索歌曲、创建播放列表、获取推荐等。

特征

  • 在 Spotify 上搜索曲目
  • 查看您的 Spotify 个人资料
  • 创建播放列表
  • 将曲目添加到播放列表
  • 获取个性化音乐推荐

可用工具

工具名称描述
set-spotify-credentials设置您的 Spotify 身份验证凭据
check-credentials-status检查您的凭证是否有效以及谁登录
search-tracks按名称、艺术家或关键字搜索曲目
get-current-user获取您的 Spotify 个人资料信息
create-playlist在您的帐户上创建新的播放列表
add-tracks-to-playlist将曲目添加到现有播放列表
get-recommendations根据种子轨迹获取推荐

设置说明

1. 先决条件

  • Node.js v16 或更高版本
  • npm
  • Spotify 帐户
  • 注册的 Spotify 开发者应用程序

2. 创建 Spotify 开发者应用

  1. 前往Spotify 开发者仪表板
  2. 使用您的 Spotify 帐户登录
  3. 点击“创建应用程序”
  4. 填写应用名称和描述
  5. 添加http://localhost:8888/callback作为重定向 URI
  6. 记下您的客户端 ID 和客户端密钥

3.安装项目

# Clone or download the project first cd spotify-mcp-server # Install dependencies npm install

4. 获取您的 Spotify 代币

编辑spotify-auth.js文件以包含您的客户端 ID 和客户端密钥:

// Replace these with your Spotify app credentials const CLIENT_ID = "your_client_id_here"; const CLIENT_SECRET = "your_client_secret_here";

然后运行身份验证脚本:

node spotify-auth.js

这将:

  1. 在浏览器中打开 URL
  2. 提示您登录 Spotify
  3. 请求您的许可访问您的帐户
  4. 将令牌保存到secrets.json

5. 构建 MCP 服务器

npm run build

6.配置Claude桌面

编辑您的 Claude Desktop 配置文件:

  • 在 macOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 在 Windows 上: %APPDATA%\Claude\claude_desktop_config.json

添加以下配置:

{ "mcpServers": { "spotify": { "command": "node", "args": ["/full/path/to/spotify-mcp-server/build/spotify-mcp-server.js"] } } }

/full/path/to/spotify-mcp-server替换为项目目录的实际路径。

7. 重启 Claude Desktop

关闭并重新打开 Claude Desktop 以加载新配置。

用法

当您开始与 Claude 对话时,您首先需要设置您的 Spotify 凭据:

  1. 查看你的secrets.json文件以获取你的凭证
  2. 使用set-spotify-credentials工具进行身份验证
  3. 然后使用任何其他 Spotify 工具

示例提示

设置凭证

I want to connect to my Spotify account. Here are my credentials from secrets.json: Tool: set-spotify-credentials Parameters: { "clientId": "your_client_id", "clientSecret": "your_client_secret", "accessToken": "your_access_token", "refreshToken": "your_refresh_token" }

基本命令

检查您的帐户:

Can you check who I'm logged in as on Spotify? Tool: get-current-user Parameters: {}

搜索曲目:

Search for songs by Weekend Tool: search-tracks Parameters: { "query": "Taylor Swift", "limit": 5 }

创建播放列表:

Create a new playlist called "My Pretty pretty girlfriend" Tool: create-playlist Parameters: { "name": "My Pretty pretty girlfriend", "description": "For my girlfriend. Created with Claude and the Spotify MCP server" }

多步骤任务

创建包含歌曲的播放列表:

I want to create a workout playlist with energetic songs. First, search for some high-energy songs. Then create a playlist called "Workout Mix" and add those songs to it.

根据收藏夹获取推荐:

I like the song "Blinding Lights" by The Weeknd. Can you search for it, then find similar songs, and create a playlist with those recommendations?

故障排除

  • 错误:没有可用的访问令牌:您需要先使用set-spotify-credentials工具设置您的凭据
  • 身份验证失败:您的令牌可能已过期。请再次运行身份验证脚本以获取新的令牌
  • 无效凭证:请仔细检查您使用的客户端 ID 和客户端密钥是否正确

笔记

  • 服务器仅将凭证存储在内存中
  • 每次开始新对话时,您都需要设置凭据
  • 如果 Claude Desktop 重新启动,您将需要再次设置凭据

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

模型上下文协议服务器使 Claude 能够与 Spotify 进行交互,允许用户使用他们的 Spotify 帐户搜索歌曲、创建播放列表、添加曲目和获取推荐。

  1. 特征
    1. 可用工具
      1. 设置说明
        1. 先决条件
        2. 创建 Spotify 开发者应用
        3. 3.安装项目
        4. 获取您的 Spotify 代币
        5. 构建 MCP 服务器
        6. 6.配置Claude桌面
        7. 重启 Claude Desktop
      2. 用法
        1. 示例提示
          1. 设置凭证
          2. 基本命令
          3. 多步骤任务
        2. 故障排除
          1. 笔记

            Related MCP Servers

            • A
              security
              F
              license
              A
              quality
              A server that connects Claude with Spotify, allowing users to control playback, search content, get information about tracks/albums/artists/playlists, and manage the Spotify queue.
              Last updated -
              4
              273
              Python
              • Apple
            • A
              security
              F
              license
              A
              quality
              A lightweight Model Context Protocol server that enables AI assistants like Cursor & Claude to control Spotify playback and manage playlists.
              Last updated -
              12
              49
              TypeScript
            • A
              security
              F
              license
              A
              quality
              Connects Claude with Spotify, allowing users to control playback, search for content, get music information, and manage the Spotify queue.
              Last updated -
              8
              1
              Python
              • Apple
            • -
              security
              -
              license
              -
              quality
              A Model Context Protocol server that enables controlling Spotify playback through natural language commands in MCP clients like Cursor or Claude for Desktop.
              Last updated -
              1
              TypeScript

            View all related MCP servers

            ID: uex94qkw4i