Skip to main content
Glama
belljustin

Spotify Model Context Protocol

by belljustin

Spotify 模型上下文协议 (MCP)

用于根据描述创建播放列表的 Spotify MCP。

先决条件

  • Python 3.6 或更高版本

  • Spotify 开发者凭证(客户端 ID 和客户端密钥)

Related MCP server: Spotify MCP Node Server

设置

  1. 克隆此存储库:

    git clone https://github.com/yourusername/spotify-mcp.git
    cd spotify-mcp
  2. 安装所需的依赖项:

    pip install -r requirements.txt
  3. 设置您的 Spotify 开发者凭证:

    • 前往Spotify 开发者仪表板

    • 创建新应用程序

    • 设置环境变量:

      echo SPOTIFY_CLIENT_ID='your_client_id' >> .env
      echo SPOTIFY_CLIENT_SECRET='your_client_secret' >> .env

用法

启动身份验证服务器

  1. 在 Spotify 开发者仪表板中设置您的重定向 URI:

    • Spotify 开发者面板中进入你的应用

    • 点击“编辑设置”

    • http://localhost:5000/callback添加到重定向 URI

    • 保存更改

  2. 启动认证服务器:

    python main.py

    这将在端口 5000 上启动一个处理 Spotify OAuth 身份验证的本地服务器。

  3. 在浏览器中访问http://localhost:5000进行 Spotify 身份验证。身份验证成功后,您的访问令牌将被保存,以供 MCP 使用。

与 Cursor 集成

  1. 打开 Cursor 并转到“设置”

  2. 导航至“模型上下文协议”部分

  3. 点击“添加 MCP”

  4. 在 mcp.json 中输入以下详细信息,替换 PATH-TO-BASE-DIR:

{
  "mcpServers": {
    "spotify": {
        "command": "uv",
        "args": [
          "--directory",
          "PATH-TO-BASE-DIR/spotify-mcp",
          "run",
          "spotify.py"
        ]
    }
  }
}

现在,您可以使用 Cursor 中的 Spotify MCP 命令直接从编辑器创建和管理播放列表!

Available Tools

3 tools
create_playlistB
Create a new playlist on Spotify and add tracks to it.

Args:
    name: Name of the playlist
    track_uris: List of Spotify track URIs to add to the playlist
    description: Optional description for the playlist
    public: Whether the playlist should be public (default: False)
ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes
track_urisYes
descriptionNo
publicNo

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states it 'creates a new playlist and adds tracks'. It lacks behavioral details such as authentication requirements, rate limits, error handling, or whether the operation is idempotent, which are critical for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by a structured 'Args' list that efficiently details parameters. Every sentence adds value without redundancy, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description covers the basic operation and parameters adequately but lacks critical context like return values, error cases, or side effects. It's minimally viable but has clear gaps in behavioral transparency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description includes an 'Args' section that explains each parameter's purpose (e.g., 'name: Name of the playlist', 'public: Whether the playlist should be public'), adding meaningful context beyond the schema's 0% description coverage. It clarifies defaults and optionality, compensating well for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Create' and resource 'new playlist on Spotify', specifying that tracks are added to it. It distinguishes from siblings like 'update_playlist' by focusing on creation rather than modification, though it doesn't explicitly contrast with 'get_track_uris'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'update_playlist' or 'get_track_uris'. It mentions adding tracks but doesn't specify prerequisites (e.g., needing track URIs first) or contextual constraints, leaving usage decisions ambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_track_urisA
Look up Spotify track URIs for a list of songs.

Args:
    songs: List of dictionaries containing song information.
          Each dictionary should have 'name' and 'artist' keys.
          Example: [{"name": "Yesterday", "artist": "The Beatles"}]

Returns:
    List of Spotify track URIs for the found songs.
    Songs that couldn't be found will be skipped.
ParametersJSON Schema
NameRequiredDescriptionDefault
songsYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it performs a lookup operation (implied read-only), handles multiple songs via a list, skips unfound songs (partial success behavior), and returns a list of URIs. It doesn't mention rate limits, authentication needs, or error handling details, but covers core functionality adequately.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the purpose, followed by clear sections for Args and Returns with bullet-point-like formatting. Every sentence adds value, with no wasted words, making it easy to scan and understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 1 parameter with no schema coverage and no output schema, the description is mostly complete: it explains the input format, output format, and behavior (skipping unfound songs). It could improve by mentioning authentication requirements or rate limits, but for a lookup tool with simple parameters, it provides sufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description fully compensates by detailing the 'songs' parameter: it's a list of dictionaries with required 'name' and 'artist' keys, includes an example, and explains the structure. This adds significant meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('look up') and resource ('Spotify track URIs'), and distinguishes it from sibling tools (create_playlist, update_playlist) by focusing on retrieval rather than playlist manipulation. It explicitly mentions what it does: converting song information into Spotify URIs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying it's for 'a list of songs' and provides an example, but doesn't explicitly state when to use this tool versus alternatives like search or when not to use it. It differentiates from siblings by function, though not with explicit 'use this when...' guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

update_playlistB
Update an existing Spotify playlist's details and/or tracks.

Args:
    playlist_id: The Spotify ID of the playlist to update
    name: New name for the playlist (optional)
    track_uris: New list of track URIs to replace the playlist's tracks (optional)
    description: New description for the playlist (optional)
    public: New public/private status for the playlist (optional)
ParametersJSON Schema
NameRequiredDescriptionDefault
playlist_idYes
nameNo
track_urisNo
descriptionNo
publicNo

TDQS

B3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies mutation ('update') but doesn't disclose critical traits like authentication requirements, rate limits, whether changes are reversible, or what happens to unspecified fields. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with a clear purpose statement. The parameter explanations are structured in a list format, making it easy to scan, though it could be slightly more concise by integrating the parameter details into the opening sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 5 parameters), lack of annotations, and no output schema, the description is incomplete. It misses critical context like authentication needs, error handling, return values, and usage scenarios, leaving significant gaps for an AI agent to operate effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant value beyond the input schema, which has 0% description coverage. It explains the meaning of all 5 parameters (e.g., 'playlist_id' as Spotify ID, 'track_uris' as replacement list) and clarifies optionality, compensating well for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'update' and resource 'Spotify playlist's details and/or tracks', making the purpose explicit. However, it doesn't distinguish this tool from its sibling 'create_playlist' beyond the obvious 'existing' vs 'new' difference, missing explicit differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'create_playlist' or 'get_track_uris'. The description lacks context about prerequisites, such as needing playlist ownership or specific permissions, and doesn't mention any exclusions or best practices.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updates
    • First observedcreate_playlist
    • First observedget_track_uris
    • First observedupdate_playlist

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: create_playlist makes new playlists, get_track_uris looks up song metadata, and update_playlist modifies existing playlists. The descriptions clearly differentiate their functions, eliminating any ambiguity.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (create_playlist, get_track_uris, update_playlist) with clear, descriptive names. There are no deviations in style or convention across the set.

Tool Count3/5

With only 3 tools, the set feels thin for a Spotify integration, lacking operations like searching for playlists, deleting playlists, or managing user profiles. While the tools cover basic playlist creation and updating, the scope is limited compared to typical music service APIs.

Completeness2/5

There are significant gaps in the tool surface for a Spotify domain. Missing are tools for reading or listing existing playlists, deleting playlists, searching for tracks or artists beyond URI lookup, and user-related operations. This incompleteness will likely cause agent failures when trying to perform common Spotify tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables interaction with Spotify through LLMs using OAuth2 authentication. Supports music search, playback control, playlist management, and device management through natural language commands.
    14
    2
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Enables interaction with Spotify through OAuth 2.0 authentication, supporting search for tracks/artists/albums/playlists, user profile access, and playlist management including creation and adding tracks.
    6
    -

Latest Blog Posts

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/belljustin/spotify-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server