Get the FREE Ultimate OpenClaw Setup Guide →

lastfm

An MCP server that provides seamless access to a user's Last.fm listening data and music information via AI assistants like Claude.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio rianvdm-lastfm-mcp node dist/server.js \
  --env JWT_SECRET="A secure secret for JWT signing" \
  --env LASTFM_API_KEY="Your Last.fm API key" \
  --env LASTFM_SHARED_SECRET="Your Last.fm shared secret"

How to use

This MCP server exposes Last.fm data and tools through the MCP interface, enabling AI assistants to query both public Last.fm information and a user’s private listening data (behind OAuth). Public tools let you fetch track, artist, and album details, similar artists/tracks, and server status without authentication. Personal tools require a linked Last.fm account and OAuth authentication to access listening history, top artists/albums, loved tracks, and personalized recommendations. Temporal query tools provide historical listening insights such as weekly charts to answer questions like when you started listening to a given artist or what you listened to during a specific period.

How to install

Prerequisites:

  • Node.js 18+ installed on your development machine
  • A Cloudflare Workers account for deployment (or a suitable Cloudflare-compatible environment)
  • Last.fm API credentials (API key and shared secret)
  1. Clone the repository and install dependencies:

    git clone https://github.com/rianvdm/lastfm-mcp.git cd lastfm-mcp npm install

  2. Configure environment variables (create a .dev.vars or equivalent):

    LASTFM_API_KEY=your_api_key_here LASTFM_SHARED_SECRET=your_shared_secret_here JWT_SECRET=your_secure_jwt_secret

  3. Build and/or start the development server (adjust commands if your setup uses npm run scripts):

    npm run build npm start

  4. Deploy to Cloudflare Workers or your chosen environment following the project’s deployment instructions. Ensure the server is reachable at a public URL like https://your-domain/mcp.

  5. Verify the MCP server by hitting the server_info tool or using an MCP Inspector:

    npx @modelcontextprotocol/inspector https://your-domain/mcp

Additional notes

Notes and tips:

  • Public tools do not require authentication, but personal and temporal tools require OAuth 2.0 authentication to access a user’s Last.fm data.
  • Ensure your Last.fm API credentials and JWT secret are kept secure and are not committed to version control.
  • If you encounter rate-limiting issues, review the server’s caching TTL configuration and adjust as needed for your deployment environment.
  • The MCP resources include a set of lastfm:// URIs for easy access to track/artist/album data within MCP-enabled clients.
  • For local testing, you can use the MCP Inspector and example client configurations shown in the README to validate tool calls and authentication flows.

Related MCP Servers

Sponsor this space

Reach thousands of developers