Music Recommendation MCP Connector
Provides tools for interacting with the Last.fm API, enabling artist and track search, artist info and genre tags, similar artist and track recommendations, top tracks/artists by genre or mood tag, and personalized recommendations based on a Last.fm user's listening history.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Music Recommendation MCP Connectorrecommend artists similar to Tame Impala"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Music Recommendation MCP Connector
An MCP (Model Context Protocol) server that turns Claude Code into a music recommendation agent. It's backed by the free Last.fm API and exposes 8 tools for artist/track search, similarity-based recommendations, genre/mood discovery, and personalized recommendations for a Last.fm user.
Tools exposed
Tool | What it does |
| Disambiguate a fuzzy/misspelled artist name |
| Bio, genre tags, listener stats |
| "More artists like X" |
| An artist's most popular tracks |
| "More songs like this track" |
| Discover tracks by genre/mood (e.g. |
| Discover artists by genre/mood |
| Personalized recs from a Last.fm username's listening history |
Related MCP server: Spotify MCP
1. Get a free Last.fm API key
Fill in the form (app name can be anything, e.g. "My Music Agent")
Copy the API key it gives you
2. Install dependencies
A virtual environment is already set up in .venv. To reinstall from scratch:
python -m venv .venv
.venv\Scripts\pip install -r requirements.txt3. Set your API key
Copy .env.example to .env and fill in your key, or set the environment
variable directly. The server reads LASTFM_API_KEY from the process
environment (it does not load .env files itself), so pass it via
claude mcp add --env as shown below, or export it in your shell first:
$env:LASTFM_API_KEY = "your_key_here"4. Register the connector with Claude Code
From this project directory:
claude mcp add music-recommendation --env LASTFM_API_KEY=your_key_here -- python "C:\Users\bhoomika\Documents\music-recommendation-mcp\server.py"Verify it's registered:
claude mcp listRestart/reopen Claude Code, then just ask it for music recommendations in plain language, e.g.:
"Recommend artists similar to Tame Impala"
"What are some good chill/lo-fi tracks?"
"Build me a recommendation list based on Last.fm user rj" (a real Last.fm username with listening history)
"What genre is Radiohead tagged as, and who's similar?"
Claude Code will call the connector's tools automatically as needed — this repo is the connector; Claude Code itself is the agent using it.
5. (Optional) Deploy to Render as a remote connector for claude.ai
claude mcp add (step 4) only works for Claude Code, since it spawns the
script locally over stdio. claude.ai's web/desktop Settings > Connectors
instead needs a server reachable over a URL. server.py supports both: it
runs over stdio by default, and switches to streamable-HTTP automatically
when a PORT environment variable is present (which Render sets for every
web service).
Push this project to a GitHub repo (Render deploys from git):
git init git add . git commit -m "Initial commit"Create a repo on GitHub and push to it (
git remote add origin <url>,git push -u origin main).On render.com, click New + → Blueprint, connect the GitHub repo. Render will detect
render.yamland configure the web service automatically (Python,pip install -r requirements.txt,python server.py).When prompted (or afterwards under the service's Environment tab), set
LASTFM_API_KEYto your Last.fm key. It's markedsync: falseinrender.yamlso it's never committed to the repo.Wait for the deploy to finish. Render gives you a URL like
https://music-recommendation-mcp.onrender.com.In claude.ai (or the desktop app), go to Settings → Connectors → Add custom connector, and enter:
https://music-recommendation-mcp.onrender.com/mcp(note the
/mcppath suffix). Save, and the 8 tools should appear.
Notes:
The free Render plan spins the service down after inactivity, so the first request after idling will be slow (cold start) while it wakes up.
The server has no authentication of its own — anyone with the URL can call your Last.fm proxy. That's low-risk for a free, read-only API key, but don't put anything sensitive behind this same server later without adding auth.
6. (Optional) Test the server standalone
.venv\Scripts\python server.pyThis starts the MCP server on stdio and waits for a client (like Claude Code) to connect — it won't print anything on its own, which is expected.
To sanity-check the Last.fm integration directly without an MCP client:
.venv\Scripts\python -c "import asyncio, server; print(asyncio.run(server.get_similar_artists(artist_name='Daft Punk')))"Notes
Built against
mcpSDK v2.x (MCPServer, formerlyFastMCPin v1.x).No paid services or OAuth required — Last.fm's API key is free and instant.
To swap in a different data source (e.g. Spotify or MusicBrainz) later, only
server.py's_lastfm_requesthelper and the tool bodies need to change; the MCP registration step stays the same.
This server cannot be deployed
Maintenance
Related MCP Connectors
Last.fm artist/album/track metadata (free API key required)
Search MusicBrainz artists, releases, works, labels; resolve ISRC/ISWC/barcode; fetch cover art.
Spotify: Spotify Data API for Millions of songs & podcasts, artists, albums, playlists and more.
Full Spotify Web API coverage - albums, artists, playlists, player controls, and more.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables interaction with Last.fm music data including searching for artists, albums, and tracks, accessing user listening history, and managing music preferences. Supports both read-only operations and authenticated write operations like scrobbling and loving tracks.345-
- AlicenseAqualityBmaintenanceEnables searching and managing Spotify playlists, tracks, and user information through the Spotify Web API.10MIT
- AlicenseBqualityBmaintenanceProvides 41 read-only tools to search and browse Last.fm data, including artists, albums, tracks, user scrobble history, and charts.416 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables music search, metadata retrieval, local audio analysis (tempo, key, energy), recommendations, song recognition, and classical work resolution via Spotify, Last.fm, AudD, MusicBrainz, and Songkick APIs.-