Spotify Playlist MCP
Spotify Playlist MCP
一个本地 STDIO MCP 服务器,用于从 Codex 桌面定时任务安全地管理 Spotify 播放列表。它可以检查拥有的播放列表、搜索 Spotify 曲目、更新播放列表元数据,并通过有界的计划/应用工作流添加或删除曲目。
安全模型
仅从此项目忽略的
.env文件中读取 Spotify 凭据和安全设置,并支持可选的进程级覆盖。将 OAuth 令牌存储在
~/.config/spotify-playlist-mcp/token.json,文件权限为0600。除非播放列表 ID 出现在
SPOTIFY_ALLOWED_PLAYLIST_IDS中,否则拒绝所有写入操作。验证已认证用户拥有该播放列表。
使用
SPOTIFY_MAX_CHANGES_PER_PLAN限制每个计划,默认影响10首曲目。将计划绑定到当前的 Spotify
snapshot_id,10 分钟后过期,且仅允许应用一次。在首次写入之前消耗计划,因此部分应用的操作不会意外重试。
Spotify 刷新令牌目前会在授权后六个月过期。spotify_auth_status 会报告剩余时间,以便定时任务在需要重新授权之前发出警告。请参阅 Spotify 的刷新令牌指南。
Related MCP server: MCP Spotify Server
工具
工具 | 类型 | 用途 |
| 读取 | 报告授权和刷新令牌年龄,不返回凭据 |
| 读取 | 列出拥有的播放列表、可见性、计数、快照和链接 |
| 读取 | 搜索候选曲目,每次请求最多 10 条结果 |
| 读取 | 返回当前播放列表元数据和可播放的曲目项 |
| 读取 | 验证并预览添加、删除、名称、描述或可见性更改 |
| 写入 | 应用一个精确、未过期、一次性使用的计划 |
曲目添加会追加到末尾。URI 删除会移除所有匹配项,影响计数反映该行为。服务器有意不暴露批量替换、任意请求、播放列表删除或未计划的写入。
安装和验证
source ~/.nvm/nvm.sh
nvm use 24.14.0
npm install
npm test
npm run typecheck
npm run build
npm audit一次性 Spotify 授权
.env 中的重定向 URI 必须与 Spotify 仪表板设置完全匹配。当前回环回调为 http://127.0.0.1:3000/auth/callback。
npm run auth打开打印的 Spotify URL 并批准作用域。命令接收回环回调并私下保存令牌。在不泄露凭据的情况下检查状态:
node dist/auth-cli.js --statusSpotify 目前要求每六个月重新授权一次,因为刷新访问令牌不会延长刷新令牌的生命周期。
Codex 桌面配置
桌面应用、CLI 和 IDE 扩展共享 ~/.codex/config.toml。桌面定时任务可以直接启动此 STDIO 服务器:
[mcp_servers.spotify-playlists]
command = "/absolute/path/to/node"
args = ["/absolute/path/to/spotify-playlist-mcp/dist/index.js"]
cwd = "/absolute/path/to/spotify-playlist-mcp"
enabled = true
required = true
default_tools_approval_mode = "auto"
tool_timeout_sec = 60
[mcp_servers.spotify-playlists.env]
SPOTIFY_ALLOWED_PLAYLIST_IDS = "replace-with-owned-playlist-id"
SPOTIFY_MAX_CHANGES_PER_PLAN = "10"
[mcp_servers.spotify-playlists.tools.spotify_apply_playlist_plan]
approval_mode = "approve"更改 MCP 配置后,请重启 ChatGPT 桌面应用。当定时任务需要本地服务器时,请保持计算机开启并运行应用。请参阅官方 Codex MCP 配置 和 定时任务 文档。
在预期的公开播放列表存在并审查其确切 ID 之前,请将 SPOTIFY_ALLOWED_PLAYLIST_IDS 留空。多个 ID 可以用逗号分隔。
建议的定时任务提示词
Use the Spotify playlist MCP to curate only the configured allowlisted playlist.
First check spotify_auth_status and stop with a warning when authorization is missing or due within 14 days.
Inspect the current playlist before searching for candidates.
Follow the playlist's stated audience and description.
Do not remove protected anchor tracks unless the task prompt explicitly names them.
Make no more than the configured change cap.
Create a playlist change plan, report its additions, removals, metadata updates, and warnings, then apply that exact plan only when it matches these rules.
Report the final snapshot ID and Spotify link.在安排定时任务之前,请手动测试此提示词。定时运行是无人值守的,因此不得将变更工具配置为提示批准。
开发
npm test
npm run typecheck
npm run build测试使用内存中的 Spotify 模拟和内存中的 MCP 传输。没有测试调用 Spotify 或读取真实的令牌文件。
许可证
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
- AlicenseAqualityCmaintenanceAn MCP server for bulk Spotify operations enabling batch playlist creation, library exports, and large-scale library management with confidence scoring and human-in-the-loop for uncertain matches.332MIT
- FlicenseAqualityDmaintenanceA lightweight MCP server that enables AI assistants like Cursor and Claude to control Spotify playback, playlists, and manage tokens via OAuth.152
- AlicenseAqualityBmaintenanceMCP server to control Spotify conversationally from Claude, Cursor, and other AI clients.1160MIT
- FlicenseNot gradedqualityCmaintenanceA lightweight MCP server that enables AI assistants to control Spotify playback and manage playlists.
Related MCP Connectors
MCP server for interacting with the Supabase platform
MCP server for managing Prisma Postgres.
MCP server for Producer/Riffusion AI music generation
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/suhajdab/spotify-playlist-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server