View as Markdown

Spotify Integration

Search Spotify, manage playlists and saved tracks, and control playback

The Spotify integration provides access to search Spotify, manage playlists and saved tracks, and control playback through the Integrate MCP server.

Installation

The Spotify integration is included with the SDK:

import { spotifyIntegration } from "integrate-sdk/server";

Setup

1. Create a Spotify OAuth App

  1. Create an OAuth application for Spotify
  2. Configure your redirect URI
  3. Note your Client ID and Client Secret

2. Configure the Integration on Your Server

Add the Spotify integration to your server configuration. The integration automatically reads SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET from your environment variables:

import { createMCPServer, spotifyIntegration } from "integrate-sdk/server";
 
export const { client: serverClient } = createMCPServer({
  apiKey: process.env.INTEGRATE_API_KEY,
  integrations: [
    spotifyIntegration({
      scopes: ["user-read-email", "playlist-read-private", "playlist-modify-private", "playlist-modify-public", "user-library-read", "user-library-modify", "user-read-playback-state", "user-modify-playback-state"], // Optional
    }),
  ],
});

You can override the environment variables by passing explicit values:

spotifyIntegration({
  clientId: process.env.CUSTOM_SPOTIFY_ID,
  clientSecret: process.env.CUSTOM_SPOTIFY_SECRET,
      scopes: ["user-read-email", "playlist-read-private", "playlist-modify-private", "playlist-modify-public", "user-library-read", "user-library-modify", "user-read-playback-state", "user-modify-playback-state"], // Optional
});

3. Client-Side Usage

The default client automatically includes all integrations. You can use it directly:

import { client } from "integrate-sdk";
 
await client.authorize("spotify");
const result = await client.spotify.getCurrentUser({});
 
console.log(result);

If you're using a custom client, add the integration to the integrations array:

import { createMCPClient, spotifyIntegration } from "integrate-sdk";
 
const customClient = createMCPClient({
  integrations: [spotifyIntegration()],
});

Configuration Options

export interface SpotifyIntegrationConfig {
  clientId?: string;

Default Scopes

These defaults are applied unless you override scopes in the integration config:

  • user-read-email
  • playlist-read-private
  • playlist-modify-private
  • playlist-modify-public
  • user-library-read
  • user-library-modify
  • user-read-playback-state
  • user-modify-playback-state

Tools

spotify_get_current_user

Get current user

No parameters.

Search

export interface SpotifySearchParams { q: string;

spotify_get_track

Get track

export interface SpotifyGetTrackParams { track_id: string;

spotify_get_album

Get album

export interface SpotifyGetAlbumParams { album_id: string;

spotify_list_user_playlists

List user playlists

export interface SpotifyListUserPlaylistsParams { limit?: number;

spotify_get_playlist

Get playlist

export interface SpotifyGetPlaylistParams { playlist_id: string;

spotify_create_playlist

Create playlist

export interface SpotifyCreatePlaylistParams { user_id: string;

spotify_add_playlist_items

Add playlist items

export interface SpotifyAddPlaylistItemsParams { playlist_id: string;

spotify_remove_playlist_items

Remove playlist items

export interface SpotifyRemovePlaylistItemsParams { playlist_id: string;

spotify_get_saved_tracks

Get saved tracks

export interface SpotifyGetSavedTracksParams { market?: string;

spotify_save_tracks

Save tracks

export interface SpotifySaveTracksParams { tracks_json: string }

spotify_remove_saved_tracks

Remove saved tracks

export interface SpotifyRemoveSavedTracksParams { tracks_json: string }

spotify_get_playback_state

Get playback state

export interface SpotifyGetPlaybackStateParams { market?: string }

spotify_start_playback

Start playback

export interface SpotifyStartPlaybackParams { device_id?: string;

spotify_pause_playback

Pause playback

export interface SpotifyPausePlaybackParams { device_id?: string }

Notes

  • Category: Entertainment
  • Authentication mode: OAuth