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 整合