Spotify MCP Server
Spotify MCP 服务器
该项目实现了一个模型上下文协议 (MCP)服务器,允许您通过 MCP 客户端(例如Cursor或Claude for Desktop (仅限 macOS 和 Windows))使用自然语言控制 Spotify 播放。
特征
该服务器公开以下工具:
play:播放曲目、专辑或播放列表,或者继续播放。pause:暂停播放。next:跳至下一曲目。previous:跳至上一曲目。get_current_track:获取有关当前播放曲目的信息。search:搜索曲目、专辑、艺术家或播放列表。
Related MCP server: Vulpes Spotify MCP Server
先决条件
Bun (1.0.0 或更高版本)
Spotify Premium 帐户。
Spotify 开发者应用程序:
在Spotify 开发者仪表板上创建一个。
获取您的客户端 ID 和客户端密钥。
将
http://localhost:8888/callback添加到应用程序设置中的重定向 URI。
MCP 客户端(例如 Cursor 或 Claude for Desktop)。
安装和设置
克隆存储库:
git clone https://github.com/obre10off/spotify-mcp.git cd spotify-mcp安装依赖项:
bun install创建
.env文件:在项目根目录下创建一个名为
.env的文件。添加以下内容,将占位符替换为你实际的 Spotify 凭据:SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret SPOTIFY_REDIRECT_URI=http://localhost:8888/callback # These will be filled in after running the auth script: SPOTIFY_ACCESS_TOKEN= SPOTIFY_REFRESH_TOKEN=运行授权脚本:
该脚本将打开您的浏览器,提示您登录 Spotify 并授予权限,然后检索您的初始访问和刷新令牌。
bun run auth该脚本会将
SPOTIFY_ACCESS_TOKEN和SPOTIFY_REFRESH_TOKEN打印到控制台。请将这些值复制到您的.env文件中。配置您的 MCP 客户端:
光标:
打开光标的设置(Cmd+, 或 Ctrl+,)。
搜索“模型上下文协议”。
点击“在settings.json中编辑”。
将以下内容添加到
mcp.servers数组(将/absolute/path/to/your/spotify-mcp替换为spotify-mcp目录的绝对路径):{ "mcp.servers": [ { "spotify": { "command": "bun", "args": ["/absolute/path/to/your/spotify-mcp/src/index.ts"], "env": { "SPOTIFY_CLIENT_ID": "your_spotify_client_id", "SPOTIFY_CLIENT_SECRET": "your_spotify_client_secret", "SPOTIFY_REDIRECT_URI": "http://localhost:8888/callback", "SPOTIFY_ACCESS_TOKEN": "your_spotify_access_token", "SPOTIFY_REFRESH_TOKEN": "your_spotify_refresh_token" } } } ] }建议使用
.env文件并仅将与 Spotify 相关的环境变量放在那里,而不是将值添加到 settings.json 文件中。
桌面版 Claude(macOS/Windows):
打开 Claude for Desktop 配置文件:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
将以下内容添加到
mcpServers对象(将/absolute/path/to/your/spotify-mcp替换为spotify-mcp目录的绝对路径):GXP6
**重要提示:**在客户端配置中始终使用绝对路径。
重启 MCP 客户端
确保重新启动 MCP 客户端(Cursor/Claude)以应用设置。
运行服务器
bun run start
This command starts the server with automatic reloading on file changes (thanks to Bun's --watch flag). Keep this terminal window open while you're using the server.
## Usage
Once the server is running and your MCP client is configured, you can start using natural language commands to control Spotify. Examples:
"Play Bohemian Rhapsody"
"Pause the music"
"What song is playing?"
"Search for Taylor Swift albums"
"Next track"
"Play spotify:track:4uLU6hMCjMI75M1A2tKUQC"This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityDmaintenanceA lightweight Model Context Protocol server that enables AI assistants like Cursor & Claude to control Spotify playback and manage playlists.22435
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants like Claude to interact with Spotify, allowing them to search for tracks, control playback, and manage playlists.1
- FlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI assistants like Claude Desktop to interact with Spotify's music streaming service, supporting playback control, playlist management, music search, and user profile access.412
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables searching and managing Spotify music, playlists, artists, albums, and audiobooks through natural language.65MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Generate AI music via the Lacuna Music API from MCP clients like Claude Desktop & Code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/obre10off/spotify-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server