{
  "markdown": "<p align=\"center\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"docs/logo-dark.svg\">\n    <img src=\"docs/logo.svg\" alt=\"lastfm-mcp — Last.fm MCP server\" width=\"360\">\n  </picture>\n</p>\n\n# lastfm-mcp\n\nAn MCP server for the Last.fm API, built on [`go-lastfm/v2`](https://github.com/ndyakov/go-lastfm) and the [official Go MCP SDK](https://github.com/modelcontextprotocol/go-sdk).\n\nIt exposes the complete supported Last.fm surface as discoverable MCP tools over:\n\n- stdio, for local desktop and CLI clients;\n- Streamable HTTP, for local services and remote deployments.\n\nRead-only tools are enabled by default. Writes, authentication helpers, and unsupported legacy methods require explicit opt-in.\n\n## Status\n\nThis 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.\n\n## Requirements\n\n- Go 1.25 or later\n- A [Last.fm API account](https://www.last.fm/api/account/create)\n- `LASTFM_API_KEY`\n- `LASTFM_API_SECRET` and `LASTFM_SESSION_KEY` only when write tools are enabled\n\n## Run with stdio\n\n```sh\nexport LASTFM_API_KEY=\"your-api-key\"\ngo run ./cmd/lastfm-mcp\n```\n\nExample MCP client configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"lastfm\": {\n      \"command\": \"/absolute/path/to/lastfm-mcp\",\n      \"env\": {\n        \"LASTFM_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\nNever place credentials in a configuration file that will be committed.\n\n## Run with Streamable HTTP\n\n```sh\nexport LASTFM_API_KEY=\"your-api-key\"\nexport LASTFM_MCP_TRANSPORT=\"http\"\nexport LASTFM_MCP_HTTP_ADDR=\"127.0.0.1:8080\"\ngo run ./cmd/lastfm-mcp\n```\n\nThe MCP endpoint is `http://127.0.0.1:8080/mcp`; health checks use `GET /healthz`.\n\nNon-loopback binds are rejected unless `LASTFM_MCP_HTTP_TOKEN` is set. Clients then send:\n\n```text\nAuthorization: Bearer <token>\n```\n\nThe 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.\n\n## Configuration\n\n| Environment variable | Default | Purpose |\n| --- | --- | --- |\n| `LASTFM_API_KEY` | required | Last.fm API key |\n| `LASTFM_API_SECRET` | empty | Required for signed/authenticated methods |\n| `LASTFM_SESSION_KEY` | empty | Required for write tools |\n| `LASTFM_USER_AGENT` | `lastfm-mcp/<version>` | Outbound Last.fm user agent |\n| `LASTFM_REQUEST_TIMEOUT` | `30s` | Last.fm request timeout |\n| `LASTFM_MCP_TRANSPORT` | `stdio` | `stdio` or `http` |\n| `LASTFM_MCP_HTTP_ADDR` | `127.0.0.1:8080` | HTTP listen address |\n| `LASTFM_MCP_HTTP_PATH` | `/mcp` | Streamable HTTP endpoint |\n| `LASTFM_MCP_HTTP_TOKEN` | empty | HTTP bearer token; mandatory on non-loopback binds |\n| `LASTFM_ENABLE_WRITES` | `false` | Register mutating tools |\n| `LASTFM_ENABLE_AUTH_TOOLS` | `false` | Register credential/session tools |\n| `LASTFM_ENABLE_EXPERIMENTAL` | `false` | Register legacy methods absent from Last.fm's public index |\n\nEquivalent command-line flags are available for transport, address, path, and feature gates. Run `lastfm-mcp -h` for details.\n\n## Tool coverage\n\nThe default server registers every stable read endpoint supported by `go-lastfm/v2`:\n\n- album: info, user tags, top tags, search;\n- artist: correction, info, similar, user tags, top albums/tracks/tags, search;\n- chart: top artists, tracks, tags;\n- geo: top artists and tracks;\n- library: artists;\n- tag: info, similar, top albums/artists/tracks/tags, weekly chart ranges;\n- track: correction, info, similar, user tags, top tags, search;\n- user: profile, friends, loved and recent tracks, personal tags, top albums/artists/tracks/tags, weekly charts and ranges.\n\n`LASTFM_ENABLE_WRITES=true` adds album/artist/track tagging, love/unlove, now-playing, and scrobbling. These require an API secret and session key.\n\n`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.\n\n`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.\n\n## Docker\n\n```sh\ndocker build -t lastfm-mcp .\ndocker run --rm -p 127.0.0.1:8080:8080 \\\n  -e LASTFM_API_KEY \\\n  -e LASTFM_MCP_TRANSPORT=http \\\n  -e LASTFM_MCP_HTTP_ADDR=0.0.0.0:8080 \\\n  -e LASTFM_MCP_HTTP_TOKEN \\\n  lastfm-mcp\n```\n\n`docker compose up --build` uses the same HTTP setup and reads values from the environment.\n\n## Development\n\n```sh\ngo mod tidy\ngo test -race ./...\ngo vet ./...\n```\n\nUntil `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.\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md), [SECURITY.md](SECURITY.md), and [ROADMAP.md](ROADMAP.md).\n\n## License\n\n[MIT](LICENSE)\n\n",
  "bytes": 5095,
  "sha": "9bf21b1a23255875715b85f41fd4a035b192540fdeb747322a2710b593cff7f9",
  "repo_slug": "ndyakov/lastfm-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_ndyakov_lastfm_mcp_4093802f/readme"
}