lastfm-mcp
An MCP server for the Last.fm API, exposing artist, album, track, chart, and user data as read-only tools. Supports optional writes, auth, and experimental methods over stdio or HTTP.
README
<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="docs/logo-dark.svg"> <img src="docs/logo.svg" alt="lastfm-mcp — Last.fm MCP server" width="360"> </picture> </p>
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_KEYLASTFM_API_SECRETandLASTFM_SESSION_KEYonly when write tools are enabled
Run with stdio
export LASTFM_API_KEY="your-api-key"
go run ./cmd/lastfm-mcp
Example MCP client configuration:
{
"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
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:
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 variable | Default | Purpose |
|---|---|---|
LASTFM_API_KEY |
required | Last.fm API key |
LASTFM_API_SECRET |
empty | Required for signed/authenticated methods |
LASTFM_SESSION_KEY |
empty | Required for write tools |
LASTFM_USER_AGENT |
lastfm-mcp/<version> |
Outbound Last.fm user agent |
LASTFM_REQUEST_TIMEOUT |
30s |
Last.fm request timeout |
LASTFM_MCP_TRANSPORT |
stdio |
stdio or http |
LASTFM_MCP_HTTP_ADDR |
127.0.0.1:8080 |
HTTP listen address |
LASTFM_MCP_HTTP_PATH |
/mcp |
Streamable HTTP endpoint |
LASTFM_MCP_HTTP_TOKEN |
empty | HTTP bearer token; mandatory on non-loopback binds |
LASTFM_ENABLE_WRITES |
false |
Register mutating tools |
LASTFM_ENABLE_AUTH_TOOLS |
false |
Register credential/session tools |
LASTFM_ENABLE_EXPERIMENTAL |
false |
Register 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
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
go mod tidy
go 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。