Skip to main content
Glama

Spotify API MCP

A Model Context Protocol (MCP) server that enables MCP-compatible applications (like Claude Desktop, IDEs, and other AI tools) to interact with the Spotify API, including authenticated endpoints for playlist management.

Features

  • Search: Search for tracks, artists, albums, and playlists

  • Authentication: OAuth 2.0 flow with PKCE for secure authentication

  • User Profile: Get current user information

  • Playlist Management: Create playlists and add tracks

  • Token Management: Automatic token refresh

Related MCP server: MCP Spotify Server

Setup

1. Install Dependencies

npm install

2. Create a Spotify App

  1. Go to Spotify Developer Dashboard

  2. Create a new app

  3. Add http://127.0.0.1:3000/callback as a redirect URI

  4. Note your Client ID and Client Secret

3. Set Up Authentication (Optional)

You can provide your Spotify credentials in several ways:

Option A: Environment Variables

export SPOTIFY_CLIENT_ID="your_client_id_here"
export SPOTIFY_CLIENT_SECRET="your_client_secret_here"

Option B: Configuration File Create a .env file in the project root:

SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here

Option C: Manual Authentication If no credentials are pre-configured, you can use the spotify_authenticate tool to provide them when needed.

4. Build the Project

npm run build

5. Configure Your MCP Client

Add the following to your MCP client settings (example for Claude Desktop):

{
  "mcpServers": {
    "spotify": {
      "command": "node",
      "args": ["/path/to/spotify-api-mcp/dist/index.js"]
    }
  }
}

For other MCP clients, consult your client's documentation for the appropriate configuration format.

Note for Claude Desktop users: When you first try to use any Spotify functionality, Claude will automatically prompt you to authenticate by asking for your Spotify app's client ID and client secret. You don't need to provide these credentials in the configuration above.

Available Tools

spotify_authenticate

Authenticate with Spotify using OAuth 2.0. Required before using authenticated endpoints.

Parameters:

  • client_id (string, optional): Your Spotify app's client ID (can be set via environment variable)

  • client_secret (string, optional): Your Spotify app's client secret (can be set via environment variable)

Search for content on Spotify.

Parameters:

  • query (string): Search query

  • type (string): Type of content (track, artist, album, playlist)

  • limit (number, optional): Number of results (1-50, default: 10)

spotify_get_user_profile

Get the authenticated user's profile information.

spotify_create_playlist

Create a new playlist for the authenticated user.

Parameters:

  • name (string): Playlist name

  • description (string, optional): Playlist description

  • public (boolean, optional): Whether playlist is public (default: false)

spotify_add_tracks_to_playlist

Add tracks to a playlist.

Parameters:

  • playlist_id (string): Playlist ID

  • track_uris (array): Array of Spotify track URIs

spotify_get_user_playlists

Get the authenticated user's playlists.

Parameters:

  • limit (number, optional): Number of playlists to return (1-50, default: 20)

Usage Example

  1. First, authenticate with Spotify:

Use the spotify_authenticate tool with your client ID and secret

For Claude Desktop users: Simply ask Claude to search for music or create a playlist. Claude will automatically handle the authentication process and ask you for your Spotify credentials when needed.

  1. Search for tracks:

Use spotify_search with query "Bohemian Rhapsody" and type "track"
  1. Create a playlist:

Use spotify_create_playlist with name "My New Playlist"
  1. Add tracks to the playlist:

Use spotify_add_tracks_to_playlist with the playlist ID and track URIs from search results

Note: The exact syntax for using these tools depends on your MCP client. The examples above show the general approach.

Development

Run in development mode:

npm run dev

Build for production:

npm run build

Security Notes

  • Client secrets are handled securely and not logged

  • OAuth 2.0 with PKCE is used for authentication

  • Tokens are automatically refreshed when needed

  • Local server runs temporarily only during authentication

License

MIT

Available Tools

6 tools
spotify_add_tracks_to_playlistC

Add tracks to a playlist

ParametersJSON Schema
NameRequiredDescriptionDefault
playlist_idYesID of the playlist
track_urisYesArray of Spotify track URIs to add

TDQS

C2.9/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 for behavioral disclosure. 'Add tracks to a playlist' implies a write/mutation operation, but it doesn't disclose important behavioral traits like authentication requirements, rate limits, whether duplicate tracks are allowed, ordering behavior, or what happens on success/failure. This leaves significant gaps for an agent to understand how to use it safely.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a straightforward tool and gets directly to the point without unnecessary elaboration.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address authentication requirements, success/failure behavior, rate limits, or what the tool returns. Given the complexity of a write operation in an API context, more contextual information would be needed for an agent to use it effectively.

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

Parameters3/5

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

Schema description coverage is 100%, so both parameters are documented in the schema. The description doesn't add any meaningful parameter semantics beyond what the schema already provides about 'playlist_id' and 'track_uris'. The baseline score of 3 reflects adequate but minimal value addition from the description.

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 action ('Add tracks') and resource ('to a playlist'), making the tool's purpose immediately understandable. It doesn't specifically differentiate from siblings like 'spotify_create_playlist' or 'spotify_search', but the verb+resource combination is unambiguous in context.

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. It doesn't mention prerequisites (like authentication), when not to use it, or how it relates to sibling tools like 'spotify_create_playlist' for creating new playlists versus adding to existing ones.

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

spotify_authenticateC

Authenticate with Spotify using OAuth 2.0

ParametersJSON Schema
NameRequiredDescriptionDefault
client_idYesSpotify client ID
client_secretYesSpotify client secret

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions OAuth 2.0, which implies a standard authentication flow, but fails to detail critical aspects like whether this initiates a user consent flow, returns tokens, handles token storage, or has rate limits. This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an agent to quickly grasp the core function.

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 complexity of an OAuth authentication tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., access tokens, error handling), how it integrates with sibling tools, or the authentication flow details, making it incomplete for effective agent use.

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

Parameters3/5

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

The input schema has 100% description coverage, clearly documenting both parameters (client_id and client_secret). The description adds no additional meaning beyond what the schema provides, such as explaining where to obtain these credentials or their format. With high schema coverage, the baseline score of 3 is appropriate.

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 action ('Authenticate') and the service ('with Spotify'), and specifies the authentication method ('using OAuth 2.0'), which provides a specific verb+resource combination. However, it doesn't explicitly distinguish this authentication tool from potential sibling tools that might also involve authentication or authorization processes, keeping it from a perfect score.

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, such as whether it's for initial setup, token refresh, or specific API calls. It lacks context about prerequisites or exclusions, leaving the agent to infer usage based on the tool name alone.

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

spotify_create_playlistC

Create a new playlist for the authenticated user

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesName of the playlist
descriptionNoDescription of the playlist
publicNoWhether the playlist should be public

TDQS

C2.9/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 for behavioral disclosure. It states this creates a playlist but doesn't mention any behavioral traits: no information on permissions required, rate limits, whether the operation is idempotent, what happens on duplicate names, or what the response contains (e.g., playlist ID). For a mutation tool with zero annotation coverage, this is a significant gap.

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 a single, efficient sentence that directly states the tool's purpose without any fluff or redundant information. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly. Every word earns its place.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a playlist object or ID), error conditions, or behavioral constraints. While the schema covers inputs well, the overall context for safe and effective use is lacking, especially compared to siblings that might handle related operations.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all three parameters (name, description, public) with clear descriptions. The description adds no additional meaning about parameters beyond implying they relate to playlist creation. This meets the baseline of 3 when the schema does the heavy lifting, but no extra value is provided.

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 action ('Create') and resource ('new playlist for the authenticated user'), making the purpose immediately understandable. It distinguishes from siblings like spotify_add_tracks_to_playlist (modification) and spotify_get_user_playlists (retrieval). However, it doesn't specify what type of playlist (e.g., music, podcast) or platform context, which prevents a perfect score.

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. It doesn't mention prerequisites (e.g., authentication via spotify_authenticate), when not to use it (e.g., for modifying existing playlists), or how it relates to siblings like spotify_get_user_playlists for listing playlists first. This leaves the agent to infer usage from context alone.

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

spotify_get_user_playlistsC

Get the current user's playlists

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of playlists to return (1-50)

TDQS

C2.9/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 for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information about authentication requirements, rate limits, pagination (beyond the limit parameter), error conditions, or what the return format looks like. For a read operation with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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 extremely concise at just 5 words, front-loading the core purpose without any wasted words. Every element ('Get', 'current user's', 'playlists') contributes directly to understanding. It's appropriately sized for a simple retrieval tool with one optional parameter.

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 simplicity (1 optional parameter, no output schema, no annotations), the description is incomplete. It doesn't address authentication requirements (critical for Spotify API), return format, pagination behavior beyond the limit parameter, or error handling. For a tool that likely requires authentication and returns structured data, the description should provide more context about these aspects.

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

Parameters3/5

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

The description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage with clear documentation for the 'limit' parameter (range, default). Since the description doesn't mention parameters at all, it doesn't compensate but doesn't detract either. With high schema coverage, the baseline score of 3 is appropriate.

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 action ('Get') and resource ('current user's playlists'), making the purpose immediately understandable. It distinguishes from siblings like spotify_get_user_profile (which gets user profile) and spotify_search (which searches content), though it doesn't explicitly mention these distinctions. The description is specific but could be more precise about scope.

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. It doesn't mention prerequisites (like authentication), when it's appropriate versus other playlist-related tools (spotify_create_playlist, spotify_add_tracks_to_playlist), or any constraints beyond what's in the schema. The agent must infer usage from context alone.

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

spotify_get_user_profileB

Get the current user's profile information

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/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 what the tool does without behavioral details. It doesn't disclose whether this requires authentication, rate limits, error conditions, or the format of returned profile data (e.g., JSON structure).

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 a single, clear sentence with zero wasted words. It's front-loaded with the core purpose and efficiently communicates the essential action without redundancy or fluff.

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?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what profile information is returned (e.g., username, email, subscription type) or behavioral aspects like authentication requirements, leaving significant gaps for an AI agent to use it 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 tool has 0 parameters with 100% schema description coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline score of 4 for not adding unnecessary information.

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 action ('Get') and resource ('current user's profile information'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like spotify_get_user_playlists, which also retrieves user data but for playlists instead of profile information.

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. It doesn't mention prerequisites (e.g., authentication status), compare to siblings like spotify_get_user_playlists for different user data, or specify use cases for profile versus playlist retrieval.

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

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: authentication, user profile retrieval, playlist creation, playlist listing, track addition to playlists, and general search. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency5/5

All tools follow a consistent 'spotify_verb_noun' pattern with snake_case, such as spotify_authenticate and spotify_add_tracks_to_playlist. This predictability enhances usability and reduces confusion.

Tool Count5/5

With 6 tools, the server is well-scoped for basic Spotify API interactions, covering authentication, user data, playlist management, and search. Each tool serves a clear purpose without being excessive or insufficient.

Completeness4/5

The toolset covers core Spotify workflows like authentication, user profile access, playlist creation/listing, and search, but lacks update or delete operations for playlists or tracks, which are minor gaps that agents can work around.

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
    B
    quality
    D
    maintenance
    Enables interaction with Spotify's music catalog via the Spotify Web API, supporting searches, artist information retrieval, playlist management, and automatic token handling.
    26
    33
    23
    MIT
  • 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
    Not graded
    quality
    D
    maintenance
    Enables control of Spotify playback through OAuth authentication, including play/pause, track navigation, volume control, device management, and searching/playing songs by artist or track name.
    1
  • A
    license
    A
    quality
    B
    maintenance
    Enables searching and managing Spotify playlists, tracks, and user information through the Spotify Web API.
    10
    MIT

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

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