Lastfm MCP logo

Lastfm MCP

Community
rianvdm

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

Publisherrianvdm
Repositorylastfm-mcp
LanguageTypeScript
Forks
10
Stars
51
Available tools
0
Transport typestdio
LicenseMIT
Links
  • Connect tools to AI workflows

    Lastfm MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    51 stars and 10 forks from the linked repository.

Last.fm MCP Server

A Model Context Protocol (MCP) server for Last.fm. Gives AI assistants access to your listening history, music discovery, and detailed track/artist/album information.

Runs on Cloudflare Workers with OAuth 2.0 authentication. Public tools (track info, artist info, similar artists) work without signing in -- connect your Last.fm account to access personal listening data.

Quick start

Claude.ai / Claude Desktop

  1. Open Settings -> Connectors -> Add Custom Connector
  2. Enter https://lastfm-mcp.com/mcp
  3. Sign in to Last.fm when prompted

Claude Code

bash
claude mcp add --transport http lastfm "https://lastfm-mcp.com/mcp"

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

json
{
	"mcpServers": {
		"lastfm": {
			"serverUrl": "https://lastfm-mcp.com/mcp"
		}
	}
}

Other MCP clients

For clients that don't support remote servers directly (Continue.dev, Zed, etc.), use mcp-remote:

json
{
	"mcpServers": {
		"lastfm": {
			"command": "npx",
			"args": ["-y", "mcp-remote", "https://lastfm-mcp.com/mcp"]
		}
	}
}

MCP Inspector

bash
npx @modelcontextprotocol/inspector https://lastfm-mcp.com/mcp

Authentication

The server uses OAuth 2.0. When you connect from a supported client, your browser opens to Last.fm to authorize access. Tokens persist across sessions.

Public tools work without signing in. You only need to connect your account for personal listening data.

Available tools

Public tools

ToolDescription
get_track_infoDetailed information about a track
get_artist_infoArtist information and bio
get_album_infoAlbum details and track listing
get_artist_top_tracksAn artist's globally most-played tracks
get_artist_top_albumsAn artist's globally most-played albums
get_similar_artistsArtists similar to a given artist
get_similar_tracksTracks similar to a given track
pingTest connectivity
server_infoServer status and capabilities
lastfm_auth_statusCheck authentication status

Personal tools (requires sign-in)

ToolDescription
get_recent_tracksRecent listening history (paginated)
get_top_artistsTop artists by time period
get_top_albumsTop albums by time period
get_top_tracksTop tracks by time period
get_loved_tracksLoved/favorited tracks
get_user_infoLast.fm profile information
get_listening_statsListening statistics
get_music_recommendationsPersonalized recommendations

Temporal queries (requires sign-in)

ToolDescription
get_weekly_chart_listAvailable historical time periods
get_weekly_artist_chartArtist charts for a specific time period
get_weekly_track_chartTrack charts for a specific time period

Good for questions like "when did I start listening to Led Zeppelin?" or "what was I into last March?"

Resources

The server exposes MCP resource URIs:

lastfm://user/{username}/recent          # Recent tracks
lastfm://user/{username}/top-artists     # Top artists
lastfm://user/{username}/top-albums      # Top albums
lastfm://user/{username}/loved           # Loved tracks
lastfm://user/{username}/profile         # User profile
lastfm://track/{artist}/{track}          # Track info
lastfm://artist/{artist}                 # Artist info
lastfm://album/{artist}/{album}          # Album info
lastfm://artist/{artist}/similar         # Similar artists
lastfm://track/{artist}/{track}/similar  # Similar tracks

Prompts

PromptDescriptionArguments
listening_insightsAnalyze listening habits and patternsusername, period?
music_discoveryDiscover music based on listening historyusername, genre?
track_analysisDetailed analysis of a trackartist, track
album_analysisDetailed analysis of an albumartist, album
artist_analysisDetailed analysis of an artistartist
listening_habitsSummarize listening habitsusername, timeframe?

Development

Prerequisites

  • Node.js 20 or newer (CI runs 20)
  • Cloudflare Workers account
  • Last.fm API key (create one here)

Local setup

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

Create .dev.vars (or copy .dev.vars.example):

LASTFM_API_KEY=your_api_key
LASTFM_SHARED_SECRET=your_shared_secret
bash
npm run dev

Test with the inspector:

bash
npx @modelcontextprotocol/inspector http://localhost:8787/mcp

Deployment

Set production secrets (or run npm run setup:prod, which creates the KV namespaces and prompts for these):

bash
echo "your_api_key" | wrangler secret put LASTFM_API_KEY --env production
echo "your_shared_secret" | wrangler secret put LASTFM_SHARED_SECRET --env production

Deploy:

bash
npm run deploy:prod

Testing

bash
npm test          # vitest, in workerd via @cloudflare/vitest-pool-workers
npm run lint
npm run build     # wrangler deploy --dry-run: catches type and binding errors

Architecture

  • Runtime: Cloudflare Workers
  • Protocol: MCP (streamable HTTP)
  • Auth: OAuth 2.0 (RFC 9728) via @cloudflare/workers-oauth-provider; the provider owns sessions and tokens
  • Storage: Cloudflare KV for OAuth state, sessions, caching, and rate-limit counters
  • Rate limiting: per-IP on /mcp, so one client can't exhaust the shared Last.fm API key's budget
  • API: Last.fm Web API v2.0

Endpoints

EndpointPurpose
/mcpMCP JSON-RPC endpoint (rate-limited per IP)
/authorizeOAuth 2.0 authorization
/oauth/tokenOAuth 2.0 token exchange
/oauth/registerOAuth 2.0 dynamic client registration
/.well-known/oauth-authorization-serverOAuth server metadata
/.well-known/oauth-protected-resourceOAuth resource metadata
/.well-known/mcp.jsonMCP server card (name, version, transport)
/healthHealth check
/Landing page

Contributing

  1. Fork the repo
  2. Create a feature branch
  3. Commit your changes
  4. Open a pull request

License

MIT

Use Lastfm MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Lastfm MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Lastfm MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Lastfm MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "lastfm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Lastfm MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Lastfm MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Lastfm MCP to help me with this task?
Lastfm MCP
Sure. I read it.
Here is what I found using Lastfm MCP.

Frequently asked questions

What is the Lastfm MCP MCP server used for?

Lastfm MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Lastfm MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Lastfm MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Lastfm MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Lastfm MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Lastfm MCP MCP to TypingMind?

Lastfm MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Lastfm MCP MCP provide in TypingMind?

Lastfm MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Lastfm MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Lastfm MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇