Melody-MCP-Server
A Model Context Protocol (MCP) server that exposes Spotify playback controls, playlist generation, music discovery, and web search tools for integration with Large Language Models.
GitHub Stars
1
User Rating
Not Rated
Favorites
0
Views
19
Forks
0
Issues
0
Melody MCP Music Server
A Model Context Protocol (MCP) server that exposes Spotify playback controls, playlist generation, music discovery, and web search tools for integration with Large Language Models.
Features
🔐 Built-in Authentication
- Automatic Spotify OAuth flow with browser-based login
- Secure token management and refresh
- No manual token handling required
Spotify Playback Controls
- Play specific tracks
- Pause/resume playback
- Skip tracks (next/previous)
- Control volume
- Manage playback queue
- Get currently playing track
- Device management
Playlist Management
- Create playlists from prompts using AI
- Generate playlists based on listening history
- Create playlists from provided tracks or artists
- Search for tracks and artists (no auth required)
Music Discovery
- Intelligent music search using Last.fm API
- Get top tracks by genre/tag
- Find similar artists and tracks
- Get artist top tracks
Web Search
- Google Custom Search integration for music-related queries
Quick Start
- Install dependencies:
npm install
- Configure environment variables:
cp env.example .env
# Edit .env with your API keys
- Start the server:
npm start
- Authenticate with Spotify (when prompted by Claude):
- Use the
spotify_authenticatetool - Browser will open automatically for Spotify login
- Complete the OAuth flow
- Return to Claude Desktop to use playback features
- Use the
Authentication Flow
The MCP server includes a built-in authentication system:
Check Authentication Status:
Use: spotify_check_authLogin to Spotify:
Use: spotify_authenticate- Opens browser automatically
- Complete Spotify OAuth
- Tokens managed automatically
Logout:
Use: spotify_logout
Tool Categories
🔐 Authentication Tools (3 tools)
spotify_authenticate- Login to Spotifyspotify_check_auth- Check authentication statusspotify_logout- Logout from Spotify
🎵 Playback Controls (11 tools - require authentication)
spotify_play_track- Play specific tracksspotify_pause/resume- Control playbackspotify_skip_next/previous- Track navigationspotify_set_volume- Volume controlspotify_add_to_queue- Queue managementspotify_get_currently_playing- Current track infospotify_get_devices- Device managementspotify_transfer_playback- Switch devicesspotify_seek- Position control
🔍 Search Tools (2 tools - no authentication required)
spotify_search_track- Find tracksspotify_search_artist- Find artists
📝 Playlist Generation (3 tools)
playlist_create_from_prompt- AI-generated from textplaylist_create_from_tracks- Based on provided tracksplaylist_create_from_artists- Based on provided artists
🎼 Music Discovery (4 tools)
music_discovery_search- Intelligent Last.fm searchmusic_discovery_by_genre- Genre-based discoverymusic_discovery_similar_artist- Find similar artistsmusic_discovery_artist_top_tracks- Artist's popular songs
🌐 Web Search (1 tool)
web_search- Google Custom Search integration
Total: 24 tools
Configuration
Create a .env file in the root directory with the following variables:
# Spotify API Credentials
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
# Last.fm API (for music discovery)
LASTFM_API_KEY=your_lastfm_api_key
# Google Search API (for web search)
GOOGLE_SEARCH_API_KEY=your_google_search_api_key
GOOGLE_SEARCH_CX_ID=your_google_search_cx_id
# OpenAI API Key (for playlist generation)
OPENAI_API_KEY=your_openai_api_key
Getting API Keys
Spotify API
- Go to Spotify Developer Dashboard
- Create a new app
- Copy the Client ID and Client Secret
Last.fm API
- Go to Last.fm API
- Create an API account
- Copy the API key
Google Custom Search API
- Go to Google Cloud Console
- Enable the Custom Search API
- Create credentials and copy the API key
- Set up a Custom Search Engine at Google CSE
OpenAI API
- Go to OpenAI Platform
- Create an API key
Usage with MCP Clients
This server can be integrated with any MCP-compatible client. The server exposes tools for:
spotify_play_track- Play a specific trackspotify_pause- Pause playbackspotify_resume- Resume playbackspotify_skip_next- Skip to next trackspotify_skip_previous- Skip to previous trackspotify_set_volume- Set playback volumespotify_add_to_queue- Add track to queuespotify_get_currently_playing- Get current track infospotify_search_track- Search for tracksspotify_search_artist- Search for artistsplaylist_create_from_prompt- Generate playlist from text promptplaylist_create_from_tracks- Create playlist from provided tracksplaylist_create_from_artists- Create playlist from provided artistsmusic_discovery_search- Intelligent music searchmusic_discovery_by_genre- Get tracks by genremusic_discovery_similar_artist- Find similar artistsmusic_discovery_artist_top_tracks- Get artist's top tracksweb_search- Perform web search
Authentication
For Spotify functionality, you'll need to provide a valid Spotify access token. The server expects this to be passed as a parameter to Spotify-related tools.
License
MIT
4
Followers
12
Repositories
0
Gists
0
Total Contributions
Ever been told to RTFM only to find there is no FM to R? MCP-RTFM helps you CREATE the F*ing Manual that people keep telling everyone to read! Transform your non-existent or unreadable docs into an intelligent, searchable knowledge base that actually answers those 'basic questions' before they're asked.