MCP server for the Last.fm API
Project description
Last.fm MCP Server
An MCP server for the Last.fm API. Enables LLM agents to access music data: user profiles, listening history, top charts, search, and artist/album/track metadata.
Features
User Tools
lastfm_get_user_info— User profile: country, scrobble count, registration date.lastfm_get_recent_tracks— Recently played tracks (including now playing).lastfm_get_user_top_artists— Top artists for a time period.lastfm_get_user_top_albums— Top albums for a time period.lastfm_get_user_top_tracks— Top tracks for a time period.lastfm_get_user_loved_tracks— Loved (favorited) tracks.
Search Tools
lastfm_search_artist— Search artists by name.lastfm_search_album— Search albums by name.lastfm_search_track— Search tracks by name.
Artist Tools
lastfm_get_artist_info— Artist details: bio, tags, listener/scrobble stats, similar artists.lastfm_get_similar_artists— Similar artists with match scores.lastfm_get_artist_top_tracks— Artist's top tracks.lastfm_get_artist_top_albums— Artist's top albums.
Album Tools
lastfm_get_album_info— Album details: tracklist, tags, description.
Track Tools
lastfm_get_track_info— Track details: duration, tags, listener/scrobble stats.lastfm_get_similar_tracks— Similar tracks with match scores.
Configuration
You will need a Last.fm API key. Get one for free at last.fm/api/account/create.
Claude Desktop
-
Open the Claude Desktop configuration file located at:
- On macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - On Windows:
%APPDATA%/Claude/claude_desktop_config.json
- On macOS:
-
Add the following:
{
"mcpServers": {
"lastfm": {
"command": "uv",
"args": [
"run",
"--with",
"lastfm-mcp",
"--python",
"3.10",
"lastfm-mcp"
],
"env": {
"LASTFM_API_KEY": "<your-api-key>"
}
}
}
}
-
Locate the command entry for
uvand replace it with the absolute path to theuvexecutable. This ensures that the correct version ofuvis used when starting the server. On a Mac, you can find this path usingwhich uv. -
Restart Claude Desktop to apply the changes.
Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"lastfm": {
"command": "uv",
"args": [
"run",
"--with",
"lastfm-mcp",
"--python",
"3.10",
"lastfm-mcp"
],
"env": {
"LASTFM_API_KEY": "<your-api-key>"
}
}
}
}
Claude Code
claude mcp add lastfm -- uv run --with lastfm-mcp --python 3.10 lastfm-mcp
Make sure LASTFM_API_KEY is set in your environment.
Running Without uv (Using System Python)
If you prefer to use the system Python installation instead of uv, you can install the package from PyPI and run it directly:
-
Install the package using pip:
pip install lastfm-mcp
-
Update your configuration to use the installed script directly:
{
"mcpServers": {
"lastfm": {
"command": "lastfm-mcp",
"env": {
"LASTFM_API_KEY": "<your-api-key>"
}
}
}
}
Note: Make sure to use the full path to the lastfm-mcp script if it is not in your system PATH. You can find the path using which lastfm-mcp.
Environment Variables
LASTFM_API_KEY(required): Your Last.fm API key.
Parameters
Top chart tools (lastfm_get_user_top_artists, lastfm_get_user_top_albums, lastfm_get_user_top_tracks) support a period parameter:
| Value | Period |
|---|---|
overall |
All time (default) |
7day |
Last 7 days |
1month |
Last month |
3month |
Last 3 months |
6month |
Last 6 months |
12month |
Last year |
All list tools support pagination via limit and page.
Development
-
Clone the repository and install dependencies:
git clone https://github.com/dkfancska/mcp-lastfm.git cd mcp-lastfm pip install -e .
-
Copy
.env.exampleto.envand add your API key:cp .env.example .env
-
For testing with the MCP Inspector:
npx @modelcontextprotocol/inspector lastfm-mcp
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lastfm_mcp-0.1.1.tar.gz.
File metadata
- Download URL: lastfm_mcp-0.1.1.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5827152519e7fb4e782ddca22585cb4adef5dc87f5ac587cc0993cdf6c95b069
|
|
| MD5 |
77cafb32855cd5aa5d9fe2e116a39315
|
|
| BLAKE2b-256 |
b4667e610184b966dbd24b9ce73143b2c6c178fb734d429c6402f9673440cf64
|
Provenance
The following attestation bundles were made for lastfm_mcp-0.1.1.tar.gz:
Publisher:
publish.yml on dkfancska/mcp-lastfm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lastfm_mcp-0.1.1.tar.gz -
Subject digest:
5827152519e7fb4e782ddca22585cb4adef5dc87f5ac587cc0993cdf6c95b069 - Sigstore transparency entry: 1108084589
- Sigstore integration time:
-
Permalink:
dkfancska/mcp-lastfm@326b2df5a9536dc3277a906fd11c67df71ba5997 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/dkfancska
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@326b2df5a9536dc3277a906fd11c67df71ba5997 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lastfm_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lastfm_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36aca276d3c6dcbc0cb91063a994c92072e6c971e88abdb9a85e96867fe4b0f0
|
|
| MD5 |
59e417ef5b8ee48c9cd8190df403f639
|
|
| BLAKE2b-256 |
7461062212e928c009611f448eedc5329ae75ca6e8b15db956ec3085c49e9b33
|
Provenance
The following attestation bundles were made for lastfm_mcp-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on dkfancska/mcp-lastfm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lastfm_mcp-0.1.1-py3-none-any.whl -
Subject digest:
36aca276d3c6dcbc0cb91063a994c92072e6c971e88abdb9a85e96867fe4b0f0 - Sigstore transparency entry: 1108084593
- Sigstore integration time:
-
Permalink:
dkfancska/mcp-lastfm@326b2df5a9536dc3277a906fd11c67df71ba5997 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/dkfancska
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@326b2df5a9536dc3277a906fd11c67df71ba5997 -
Trigger Event:
release
-
Statement type: