Skip to main content
Glama
lastfm-mcp

lastfm-mcp

by wjmonde

lastfm-mcp

A small, open-source, read-only MCP server for Last.fm listening history. It is designed to support music discovery and rediscovery in MCP clients and can be packaged as a ChatGPT/Codex plugin.

What v0.3 does

  • recent scrobbles;

  • top artists, albums and tracks over Last.fm's standard periods;

  • check whether a listener has heard a named artist and roughly how much;

  • identify rediscovery candidates: historically important artists with little recent listening;

  • support multiple public Last.fm profiles without asking end users for API credentials;

  • run over stdio or Streamable HTTP;

  • include a portable plugin manifest, MCP configuration template, and music-discovery skill.

The server is read-only. It does not use Last.fm write APIs and does not require a Last.fm shared secret.

Related MCP server: mcp-lastfm

Requirements

  • Node.js 20 or newer

  • one Last.fm API key for the server/operator

Personal/local setup

Copy .env.example to .env and set:

LASTFM_API_KEY=your_real_api_key
LASTFM_USERNAME=WJMonde
LASTFM_USER_AGENT=lastfm-mcp/0.3.0

LASTFM_USERNAME is optional in v0.3. Keeping it set gives personal/local use the same convenient behaviour as v0.2. If it is omitted, every tool call must include a username.

Install dependencies:

npm.cmd install

Typecheck:

npm.cmd run typecheck

Run locally over stdio

npm.cmd run dev

Run locally over HTTP

npm.cmd run dev:http

Default endpoint:

http://127.0.0.1:3000/mcp

For a cloud/container host, the platform will often require:

HOST=0.0.0.0

Terminate TLS at the hosting platform and expose a stable HTTPS /mcp URL for plugin use.

Tools

Each tool now accepts an optional username. If LASTFM_USERNAME is configured locally, it is used as the fallback.

recent_scrobbles

Returns recent scrobbles, optionally bounded by UNIX timestamps.

top_items

Returns top artist, album or track items for overall, 7day, 1month, 3month, 6month or 12month.

artist_history

Uses Last.fm's artist information endpoint with the requested username to report whether that listener has scrobbled an artist and the approximate play count.

rediscovery_candidates

Compares all-time top artists against a recent period and surfaces historically significant artists with little or no recent listening. The heuristic is deliberately explainable.

Plugin packaging

The repository includes:

plugin.json
mcp.json
skills/lastfm-music-discovery/SKILL.md

Before using the package against a deployed server, replace the placeholder URL in mcp.json:

"url": "https://YOUR-PUBLIC-DOMAIN.example/mcp"

with the real stable HTTPS MCP endpoint.

See docs/PUBLIC-PLUGIN-ROADMAP.md for the path from this prototype to public submission.

Build and test

npm.cmd run typecheck
npm.cmd run build
npm.cmd test

Security and privacy

  • Never commit .env.

  • Keep the Last.fm API key server-side.

  • End users should provide only a public Last.fm username.

  • Do not request users' Last.fm password, shared secret, session key, or API key.

  • See docs/PRIVACY.md before deploying publicly.

Available Tools

4 tools
artist_historyA
Read-onlyIdempotent

Check whether a Last.fm user has listened to an artist and return the approximate total scrobble count. Pass a username unless the server has a local default.

Inputs: artist (required), username.

recent_scrobblesA
Read-onlyIdempotent

Get a Last.fm user’s most recent scrobbles. Read-only. Pass a username unless the server has a local default.

Inputs: to, from, limit, username.

rediscovery_candidatesA
Read-onlyIdempotent

Find historically significant artists with little or no listening in a recent Last.fm period. Uses an explainable heuristic, not a Last.fm recommendation endpoint.

Inputs: limit, username, recentPeriod, historicalPool, +1 more.

top_itemsB
Read-onlyIdempotent

Get top artists, albums, or tracks for a Last.fm user over a selectable period. Pass a username unless the server has a local default.

Inputs: kind (required), limit, period, username.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool targets a clearly distinct purpose: top_items returns rankings, recent_scrobbles returns a listening stream, artist_history checks a specific artist, and rediscovery_candidates surfaces overlooked artists. There is little risk of an agent selecting the wrong tool for a given task.

    Naming Consistency5/5

    All four tool names follow the same lowercase snake_case noun-phrase pattern. Though not verb_noun, the convention is perfectly consistent and predictable across the set.

    Tool Count5/5

    Four tools form a compact, purposeful set for a niche Last.fm listening-history server. Each tool earns its place and the scope feels appropriately focused rather than bloated or thin.

    Completeness4/5

    The set covers the core Last.fm user-listening workflow: top items, recent activity, specific artist checks, and rediscovery candidates. Minor gaps like user profile info or detailed artist metadata are absent, but agents can still complete meaningful tasks without major dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      Enables 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.
      34
      5
      -
    • A
      license
      B
      quality
      C
      maintenance
      Provides 41 read-only tools to search and browse Last.fm data, including artists, albums, tracks, user scrobble history, and charts.
      41
      9 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides Last.fm listening analytics and recommendations by combining Last.fm and MusicBrainz metadata, maintaining a local listening index, and recording explicit preferences. Enables queries for listening summaries, taste profiles, artist context, and evidence-backed recommendations via MCP tools.
      67 npm
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables music discovery and recommendations through the free Last.fm API by exposing tools for artist and track search, similarity-based suggestions, genre or mood-based discovery, and personalized recommendations built from a Last.fm user's listening history.
      -