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
- Create an OAuth application for Spotify
- Configure your redirect URI
- 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
Prop
Type
Default Scopes
These defaults are applied unless you override scopes in the integration config:
user-read-emailplaylist-read-privateplaylist-modify-privateplaylist-modify-publicuser-library-readuser-library-modifyuser-read-playback-stateuser-modify-playback-state
Tools
spotify_get_current_user
Get current user
No parameters.
spotify_search
Search
Prop
Type
spotify_get_track
Get track
Prop
Type
spotify_get_album
Get album
Prop
Type
spotify_list_user_playlists
List user playlists
Prop
Type
spotify_get_playlist
Get playlist
Prop
Type
spotify_create_playlist
Create playlist
Prop
Type
spotify_add_playlist_items
Add playlist items
Prop
Type
spotify_remove_playlist_items
Remove playlist items
Prop
Type
spotify_get_saved_tracks
Get saved tracks
Prop
Type
spotify_save_tracks
Save tracks
Prop
Type
spotify_remove_saved_tracks
Remove saved tracks
Prop
Type
spotify_get_playback_state
Get playback state
Prop
Type
spotify_start_playback
Start playback
Prop
Type
spotify_pause_playback
Pause playback
Prop
Type
Notes
- Category: Entertainment
- Authentication mode: OAuth