Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

An MCP server for the Last.fm API that enables LLM agents to access music data including user profiles, listening history, top charts, search, and artist/album/track metadata.

README.md

Last.fm MCP Server

![PyPI - Version](https://pypi.org/project/lastfm-mcp)

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

  1. 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
  1. Add the following:
{
  "mcpServers": {
    "lastfm": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "lastfm-mcp",
        "--python",
        "3.10",
        "lastfm-mcp"
      ],
      "env": {
        "LASTFM_API_KEY": "<your-api-key>"
      }
    }
  }
}
  1. Locate the command entry for uv and replace it with the absolute path to the uv executable. This ensures that the correct version of uv is used when starting the server. On a Mac, you can find this path using which uv.
  1. 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:

  1. Install the package using pip:
   pip install lastfm-mcp
  1. 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

  1. Clone the repository and install dependencies:
   git clone https://github.com/dkfancska/mcp-lastfm.git
   cd mcp-lastfm
   pip install -e .
  1. Copy .env.example to .env and add your API key:
   cp .env.example .env
  1. For testing with the MCP Inspector:
   npx @modelcontextprotocol/inspector lastfm-mcp

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Search servers.