Skip to main content
Glama
Spotify MCP Server

Spotify MCP Server

by g2dgaming

spotify-mcp MCP 服务器

MCP 项目将 Claude 与 Spotify 连接起来。基于spotipy-dev 的 API构建。

特征

  • 开始、暂停和跳过播放

  • 搜索曲目/专辑/艺术家/播放列表

  • 获取有关曲目/专辑/艺术家/播放列表的信息

  • 管理 Spotify 队列

  • 管理、创建和更新播放列表

Related MCP server: Spotify MCP Server

演示

确保打开音频

配置

获取 Spotify API 密钥

在developer.spotify.com上创建一个帐户。导航到仪表板。创建一个应用程序,其redirect_uri为http://127.0.0.1:8080/callback 。您可以选择任何所需的端口,但必须使用http和显式的环回地址(IPv4或IPv6)。

更多信息/故障排除请参见此处。您可能需要重启 MCP 环境(例如 Claude Desktop)一到两次才能正常工作。

在本地运行此项目

该项目尚未设置临时环境(例如uvx使用)。请克隆此 repo 以在本地运行该项目。

git clone https://github.com/varunneal/spotify-mcp.git

将此工具添加为 mcp 服务器。

MacOS 上的 Claude 桌面: ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows 上的 Claude 桌面: %APPDATA%/Claude/claude_desktop_config.json

"spotify": {
    "command": "uv",
    "args": [
      "--directory",
      "/path/to/spotify_mcp",
      "run",
      "spotify-mcp"
    ],
    "env": {
      "SPOTIFY_CLIENT_ID": YOUR_CLIENT_ID,
      "SPOTIFY_CLIENT_SECRET": YOUR_CLIENT_SECRET,
      "SPOTIFY_REDIRECT_URI": "http://127.0.0.1:8080/callback"
    }
  }

故障排除

如果您无法使用此 MCP,请提交问题。以下是一些提示:

  1. 确保uv已更新。我推荐版本>=0.54 。

  2. 确保 claude 具有该项目的执行权限: chmod -R 755 。

  3. 确保您拥有 Spotify premium(运行开发人员 API 所需)。

此 MCP 会将日志发送到 std err(如 MCP 规范中所述)。在 Mac 上,Claude 桌面应用程序会将这些日志发送到~/Library/Logs/Claude 。在其他平台上,您可以在此处找到日志。

您可以使用以下命令通过npm启动 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /path/to/spotify_mcp run spotify-mcp

启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。

待办事项

遗憾的是,Spotify API 中许多很酷的功能现已弃用。大多数新功能都相对较小,或者是为了项目的健康发展:

  • 測試。

  • 添加用于管理播放列表的 API 支持。

  • 添加分页搜索结果/播放列表/专辑的 API 支持。

公关赞赏!感谢 @jamiew、@davidpadbury、@manncodes、@hyuma7、@aanurraj 和其他人的贡献。

部署

(待办事项)

构建和发布

准备分发包:

  1. 同步依赖项并更新锁文件:

uv sync
  1. 构建软件包分发版:

uv build

这将在dist/目录中创建源和轮子分布。

  1. 发布到 PyPI:

uv publish

注意:您需要通过环境变量或命令标志设置 PyPI 凭据:

  • 令牌: --token或UV_PUBLISH_TOKEN

  • 或用户名/密码: --username / UV_PUBLISH_USERNAME和--password / UV_PUBLISH_PASSWORD

Available Tools

5 tools
SpotifyGetInfoA

Get detailed information about a Spotify item (track, album, artist, or playlist).

Inputs: item_uri (required).

SpotifyPlaybackB

Manages the current playback with the following actions: - get: Get information about user's current track. - start: Starts playing new item or resumes current playback if called with no uri. - pause: Pauses current playback. - skip: Skips current track.

Inputs: action (required), num_skips, spotify_uri.

SpotifyPlaylistC

Manage Spotify playlists. - get: Get a list of user's playlists. - get_tracks: Get tracks in a specific playlist. - add_tracks: Add tracks to a specific playlist. - remove_tracks: Remove tracks from a specific playlist. - change_details: Change details of a specific playlist.

Inputs: action (required), description, name, playlist_id, +1 more.

SpotifyQueueB

Manage the playback queue - get the queue or add tracks.

Inputs: action (required), track_id.

SpotifySearchB

Search for tracks, albums, artists, or playlists on Spotify.

Inputs: query (required), limit, qtype.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: SpotifyGetInfo retrieves metadata, SpotifyPlayback handles real-time playback control, SpotifyPlaylist manages playlist content and details, SpotifyQueue manages the playback queue, and SpotifySearch performs searches. There is no overlap in functionality that would cause confusion.

    Naming Consistency5/5

    All tool names follow a consistent 'Spotify' prefix with a descriptive noun or verb-noun pattern (e.g., SpotifyGetInfo, SpotifyPlayback, SpotifyPlaylist, SpotifyQueue, SpotifySearch). This uniformity makes the tool set predictable and easy to navigate.

    Tool Count5/5

    With 5 tools, the server is well-scoped for managing Spotify interactions, covering key areas like playback, playlists, search, queue, and general info. Each tool earns its place without feeling bloated or insufficient for the domain.

    Completeness4/5

    The tool set provides comprehensive coverage for core Spotify operations, including CRUD for playlists, playback control, search, and queue management. A minor gap is the lack of user profile or library management tools (e.g., managing saved tracks or albums), but agents can still handle most common workflows effectively.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers