Last.fm MCP

com.lastfm-mcp由 lastfm-mcp.com 发布官方发布者v2.8.0更新于 Nov 14, 2026

Unofficial, read-only access to your Last.fm listening history, charts, and music lookups.

已验证Streamable HTTP可网页运行知识与记忆媒体与设计

概览

AI 生成的概览

以只读方式访问 Last.fm,让助手查询歌曲、艺人和专辑,并分析你的收听历史与排行榜。

可以做什么
  • 查询歌曲、艺人、专辑信息,包括简介、曲目列表、热门歌曲与专辑,以及相似艺人或歌曲
  • 读取你的收听数据:最近播放、按时间段的热门艺人/专辑/歌曲、喜欢的歌曲、个人资料、统计与推荐
  • 按周榜时间段回顾收听历史,查看各时间段的艺人和歌曲榜单
  • 以 MCP 资源形式提供用户、歌曲、艺人和专辑数据
  • 提供收听洞察、音乐发现以及歌曲、专辑、艺人分析等内置提示词
  • 检查连通性、服务器状态和登录状态
适用场景
适合让助手回答关于你音乐口味的问题,例如最近听了什么、某段时间最常听的艺人,或某个收听习惯从何时开始,并探索与你常听内容相关的艺人和专辑。
运行要求
通过 streamable HTTP 连接 lastfm-mcp.com 的远程 MCP 端点,无需本地安装。首次连接需用 Last.fm 账号完成 OAuth 2.0 登录,登录 30 天后过期。不支持远程服务器的客户端需通过 npx 使用 mcp-remote 桥接。
安装前请注意
访问为只读,无法记录播放(scrobble)或修改你的 Last.fm 数据。登录后服务器可读取你的收听历史和个人资料,并通过 Last.fm API 获取;授权页面会显示请求访问的应用及授权去向。自行部署需要 Last.fm API 凭据和同意签名密钥。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Last.fm MCP,将其添加到工作区。
  2. 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
  3. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/com.lastfm-mcp%2Flastfm/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。 客户端会在首次连接时完成 OAuth 登录。

{
  "mcpServers": {
    "last-fm": {
      "type": "http",
      "url": "https://lastfm-mcp.com/mcp"
    }
  }
}

README

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. Your MCP client signs you in with OAuth the first time it connects, and after that every tool is available, from track and artist lookups to your own listening history.

Quick start

lastfm-mcp.com has setup steps for each app, including ChatGPT, Codex, Cursor, Devin Desktop (formerly Windsurf) and OpenCode. If an AI agent is setting it up for you, point it at lastfm-mcp.com/llms.txt.

Claude.ai / Claude Desktop

  1. Go to Customize -> Connectors
  2. Click Add, then Add custom connector. Name it Last.fm, enter https://lastfm-mcp.com/mcp and click Continue
  3. Leave the sign-in settings as they are, click Add, then Connect, and sign in to Last.fm

Claude Code

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

Then start Claude Code, run /mcp, choose lastfm, then Authenticate, and sign in to Last.fm in your browser.

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. The first time your client connects, your browser opens a short page on lastfm-mcp.com that names the app asking for access and the address that access will go to. Approve it, then sign in to Last.fm. That browser remembers the approval for a year, so reconnecting the same app skips the page.

Access is read-only: the server can read your listening history and profile, but it can't scrobble or change anything. Sign-ins expire after 30 days, and your client then asks you to sign in again.

Available tools

Lookups and diagnostics

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

Your listening data

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

Your listening history over time

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 trackslastfm://user/{username}/top-artists     # Top artistslastfm://user/{username}/top-albums      # Top albumslastfm://user/{username}/loved           # Loved trackslastfm://user/{username}/profile         # User profilelastfm://track/{artist}/{track}          # Track infolastfm://artist/{artist}                 # Artist infolastfm://album/{artist}/{album}          # Album infolastfm://artist/{artist}/similar         # Similar artistslastfm://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 22 (see .nvmrc; CI runs 22)
  • Cloudflare Workers account
  • Last.fm API key (create one here)

Local setup

bash
git clone https://github.com/rianvdm/lastfm-mcp.gitcd lastfm-mcpnpm install

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

LASTFM_API_KEY=your_api_keyLASTFM_SHARED_SECRET=your_shared_secretCONSENT_SECRET=any_random_string_of_32_or_more_characters
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, prompts for the two Last.fm values and generates CONSENT_SECRET):

bash
echo "your_api_key" | wrangler secret put LASTFM_API_KEY --env productionecho "your_shared_secret" | wrangler secret put LASTFM_SHARED_SECRET --env productionopenssl rand -base64 32 | wrangler secret put CONSENT_SECRET --env production

CONSENT_SECRET signs the cookie that remembers which apps a browser approved. Rotating it shows the consent page again to everyone; if it's missing or shorter than 32 characters, approvals aren't remembered, but sign-ins still work.

Upgrading a deployment from v2.6.0 or earlier: v2.7.0 added the consent page and the CONSENT_SECRET secret. Set it with the openssl line above before you deploy, or right after. Until it's set, the consent page shows on every sign-in.

Deploy:

bash
npm run deploy:prod

Testing

bash
npm test          # vitest, in workerd via @cloudflare/vitest-pool-workersnpm run lintnpm 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)
/llms.txtSetup instructions for AI agents
/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

来源:README.md,提交 07cbc8c

工具

0
该服务器需要登录,因此 SourceWeft 无法在没有账号的情况下读取其工具,也未收录。已连接账号所能看到的内容可能因账号及其权限而异。

版本历史

1
  1. v2.8.0最新Nov 14, 2026

评分

已满足适用检查项的 85%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Lastfm-Mcp 集成