Last.fm

io.github.ndyakov由 GitHub 账号 ndyakov 发布v0.2.0更新于 Oct 24, 2026

Last.fm MCP server: scrobbles, charts, artist/album/track info and more

已验证STDIO仅桌面数据与分析媒体与设计

概览

AI 生成的概览

Last.fm MCP 服务器,让助手查询音乐数据——scrobble 记录、排行榜以及艺人、专辑和曲目信息,并可选地执行 scrobble。

可以做什么
查询专辑、艺人和曲目:信息、纠错、相似项、搜索和标签,以及排行榜和按国家的地理排行,还有基于标签的排行榜和热门列表,并读取用户资料、好友、喜爱和最近曲目、个人标签、热门列表和周榜。启用写入后,可选地为专辑、艺人和曲目标记标签、喜爱或取消喜爱曲目、设置正在播放和 scrobble。启用认证工具后,可选地使用浏览器令牌、授权 URL、会话交换和移动会话辅助工具。启用实验性方法后,可选地使用旧版标签搜索、都市、邻居、热门粉丝和品味对比。
适用场景
适合让助手根据 Last.fm 回答关于收听历史、艺人和曲目元数据、排行榜或品味对比的问题,或在明确开启后代表你执行 scrobble 和打标签。
运行要求
作为本地进程运行(Go 1.25 或更高版本,或已发布的容器镜像),通过 stdio 或配置后的 Streamable HTTP 连接。需要 Last.fm API 账户和 LASTFM_API_KEY 环境变量;写入工具还需要 LASTFM_API_SECRET 和 LASTFM_SESSION_KEY。非回环地址的 HTTP 绑定需要 LASTFM_MCP_HTTP_TOKEN。
安装前请注意
LASTFM_API_KEY 和 LASTFM_API_SECRET 是密钥,不要放入会提交的配置文件。写入工具默认关闭,启用后可在已认证账户上执行 scrobble、喜爱/取消喜爱和打标签。认证工具可能将会话凭据暴露给 MCP 客户端和模型,README 建议在会话之外完成认证。实验性旧版方法可能随时变更或消失。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Last.fm,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[lastfm-mcp — Last.fm MCP server]

lastfm-mcp

An MCP server for the Last.fm API, built on go-lastfm/v2 and the official Go MCP SDK.

It exposes the complete supported Last.fm surface as discoverable MCP tools over:

  • stdio, for local desktop and CLI clients;
  • Streamable HTTP, for local services and remote deployments.

Read-only tools are enabled by default. Writes, authentication helpers, and unsupported legacy methods require explicit opt-in.

Status

This project is prepared for its initial repository import. The module path is github.com/ndyakov/lastfm-mcp; change it before the first release if the repository will use a different owner or name.

Requirements

  • Go 1.25 or later
  • A Last.fm API account
  • LASTFM_API_KEY
  • LASTFM_API_SECRET and LASTFM_SESSION_KEY only when write tools are enabled

Run with stdio

sh
export LASTFM_API_KEY="your-api-key"go run ./cmd/lastfm-mcp

Example MCP client configuration:

json
{  "mcpServers": {    "lastfm": {      "command": "/absolute/path/to/lastfm-mcp",      "env": {        "LASTFM_API_KEY": "your-api-key"      }    }  }}

Never place credentials in a configuration file that will be committed.

Run with Streamable HTTP

sh
export LASTFM_API_KEY="your-api-key"export LASTFM_MCP_TRANSPORT="http"export LASTFM_MCP_HTTP_ADDR="127.0.0.1:8080"go run ./cmd/lastfm-mcp

The MCP endpoint is http://127.0.0.1:8080/mcp; health checks use GET /healthz.

Non-loopback binds are rejected unless LASTFM_MCP_HTTP_TOKEN is set. Clients then send:

text
Authorization: Bearer <token>

The server applies Go's cross-origin protection around the MCP endpoint and sets conservative HTTP timeouts. Put TLS and production identity-aware authentication in a trusted reverse proxy.

Configuration

Environment variableDefaultPurpose
LASTFM_API_KEYrequiredLast.fm API key
LASTFM_API_SECRETemptyRequired for signed/authenticated methods
LASTFM_SESSION_KEYemptyRequired for write tools
LASTFM_USER_AGENTlastfm-mcp/<version>Outbound Last.fm user agent
LASTFM_REQUEST_TIMEOUT30sLast.fm request timeout
LASTFM_MCP_TRANSPORTstdiostdio or http
LASTFM_MCP_HTTP_ADDR127.0.0.1:8080HTTP listen address
LASTFM_MCP_HTTP_PATH/mcpStreamable HTTP endpoint
LASTFM_MCP_HTTP_TOKENemptyHTTP bearer token; mandatory on non-loopback binds
LASTFM_ENABLE_WRITESfalseRegister mutating tools
LASTFM_ENABLE_AUTH_TOOLSfalseRegister credential/session tools
LASTFM_ENABLE_EXPERIMENTALfalseRegister legacy methods absent from Last.fm's public index

Equivalent command-line flags are available for transport, address, path, and feature gates. Run lastfm-mcp -h for details.

Tool coverage

The default server registers every stable read endpoint supported by go-lastfm/v2:

  • album: info, user tags, top tags, search;
  • artist: correction, info, similar, user tags, top albums/tracks/tags, search;
  • chart: top artists, tracks, tags;
  • geo: top artists and tracks;
  • library: artists;
  • tag: info, similar, top albums/artists/tracks/tags, weekly chart ranges;
  • track: correction, info, similar, user tags, top tags, search;
  • user: profile, friends, loved and recent tracks, personal tags, top albums/artists/tracks/tags, weekly charts and ranges.

LASTFM_ENABLE_WRITES=true adds album/artist/track tagging, love/unlove, now-playing, and scrobbling. These require an API secret and session key.

LASTFM_ENABLE_AUTH_TOOLS=true adds browser-token, authorization-URL, session-exchange, and mobile-session tools. These may expose session credentials to the MCP client and model; leave them disabled unless needed. Prefer completing authentication outside the MCP session and providing LASTFM_SESSION_KEY at process startup.

LASTFM_ENABLE_EXPERIMENTAL=true adds legacy tag search, metros, neighbours, artist/track top fans, and tasteometer comparison. Last.fm may change or disable these without notice.

Docker

sh
docker build -t lastfm-mcp .docker run --rm -p 127.0.0.1:8080:8080 \  -e LASTFM_API_KEY \  -e LASTFM_MCP_TRANSPORT=http \  -e LASTFM_MCP_HTTP_ADDR=0.0.0.0:8080 \  -e LASTFM_MCP_HTTP_TOKEN \  lastfm-mcp

docker compose up --build uses the same HTTP setup and reads values from the environment.

Development

sh
go mod tidygo test -race ./...go vet ./...

Until go-lastfm/v2 is published, use a temporary Go workspace containing this repository and the adjacent go-lastfm checkout. Do not commit a local replace directive.

See CONTRIBUTING.md, SECURITY.md, and ROADMAP.md.

License

MIT

来源:README.md,提交 9692a15

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.2.0最新Oct 16, 2026
  2. v0.1.0Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

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

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