Use LFM with Claude Code or Claude Desktop to ask natural language questions about your music!
Once set up, you can ask Claude questions like:
- "What were my top artists in 2024?"
- "Show me my most-played albums from last month"
- "Give me music recommendations based on my listening history"
- "Check if I've listened to Pink Floyd's Dark Side of the Moon"
- "Play Radiohead's OK Computer on Spotify"
Claude will use the LFM MCP server to answer using your actual Last.fm data.
Before starting, make sure you have:
✅ LFM CLI installed → Installation Guide ✅ LFM configured with API key and username → Quick Start ✅ Node.js 16 or later installed ✅ Claude Code or Claude Desktop installed
node --versionIf you see a version number like v18.x.x or v20.x.x, you're good!
Don't have Node.js? Download from: https://nodejs.org (choose the "LTS" version)
Choose one:
- Option A: Automated Setup - Easiest (when available)
- Option B: Manual Setup - Step-by-step guide
Note: This feature will be available in the next LFM release (v1.6.0)
Once available, simply run:
lfm setup-mcpThe wizard will:
- Check if Node.js is installed
- Ask if you use Claude Code or Claude Desktop
- Install the MCP server files
- Configure Claude automatically
- Test the connection
Until then, use Option B: Manual Setup below.
-
Go to the latest release: https://github.com/Steven-Marshall/lfm/releases/latest
-
Download
lfm-mcp-server-v0.2.0.zip(or latest version) -
Extract the zip file to a permanent location:
- Windows:
C:\Users\YourName\lfm-mcp - macOS/Linux:
~/lfm-mcp
Important: Don't put it in your Downloads folder - it needs to stay in this location!
- Windows:
Open terminal in the extracted folder and run:
cd ~/lfm-mcp # or your extraction location
npm installThis installs the required Node.js packages.
The MCP server needs to be able to run the lfm command. Test this:
lfm --versionIf this works, great! If not, see Troubleshooting: LFM not in PATH
The configuration steps differ depending on whether you use Claude Code or Claude Desktop.
-
Find your Claude Code config file:
Windows:
%APPDATA%\claude-code\mcp.jsonFull path:
C:\Users\YourName\AppData\Roaming\claude-code\mcp.jsonmacOS/Linux:
~/.config/claude-code/mcp.json -
Edit the config file (create it if it doesn't exist):
Windows:
{ "mcpServers": { "lfm": { "command": "node", "args": ["C:\\Users\\YourName\\lfm-mcp\\server.js"], "cwd": "C:\\Users\\YourName\\lfm-mcp" } } }macOS/Linux:
{ "mcpServers": { "lfm": { "command": "node", "args": ["/Users/YourName/lfm-mcp/server.js"], "cwd": "/Users/YourName/lfm-mcp" } } }Important: Replace
YourNamewith your actual username! -
Save the file
-
Restart Claude Code
-
Find your Claude Desktop config file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json -
Edit the config file:
Windows:
{ "mcpServers": { "lfm": { "command": "node", "args": ["C:\\Users\\YourName\\lfm-mcp\\server.js"], "cwd": "C:\\Users\\YourName\\lfm-mcp" } } }macOS/Linux:
{ "mcpServers": { "lfm": { "command": "node", "args": ["/Users/YourName/lfm-mcp/server.js"], "cwd": "/Users/YourName/lfm-mcp" } } }Important: Replace
YourNamewith your actual username!If you already have other MCP servers, add the
lfmentry inside the existingmcpServersobject:{ "mcpServers": { "existing-server": { ... }, "lfm": { "command": "node", "args": ["/Users/YourName/lfm-mcp/server.js"], "cwd": "/Users/YourName/lfm-mcp" } } } -
Save the file
-
Restart Claude Desktop
-
Open Claude (Code or Desktop)
-
Start a new conversation
-
Type this message:
Initialize my Last.fm session -
Claude should respond with something like:
✅ Last.fm MCP service initialized successfully! I've loaded the guidelines and I'm ready to help you with: - Music discovery - Listening stats - Playlist creation ... -
Try asking a question:
What were my top 5 artists last month?Claude should respond with your actual Last.fm data!
If the config file doesn't exist:
-
Create the directory structure:
# Windows (PowerShell) mkdir -Force "$env:APPDATA\claude-code" # or mkdir -Force "$env:APPDATA\Claude" # macOS/Linux mkdir -p ~/.config/claude-code # or mkdir -p ~/Library/Application\ Support/Claude
-
Create the file with your text editor
If the MCP server can't find lfm, you have two options:
Option 1: Use full path to lfm (easiest)
In your MCP config, add the full path to the lfm executable:
Windows:
{
"mcpServers": {
"lfm": {
"command": "node",
"args": ["C:\\Users\\YourName\\lfm-mcp\\server.js"],
"cwd": "C:\\Users\\YourName\\lfm-mcp",
"env": {
"PATH": "C:\\Users\\YourName\\lfm;${PATH}"
}
}
}
}macOS/Linux:
{
"mcpServers": {
"lfm": {
"command": "node",
"args": ["/Users/YourName/lfm-mcp/server.js"],
"cwd": "/Users/YourName/lfm-mcp",
"env": {
"PATH": "/Users/YourName/.local/bin:${PATH}"
}
}
}
}Option 2: Add lfm to your system PATH See Installation Guide - Manual Install
If npm install fails:
-
Make sure you're in the right directory:
cd ~/lfm-mcp ls package.json # Should show the file
-
Try deleting
node_modulesandpackage-lock.json, then retry:rm -rf node_modules package-lock.json npm install
-
Make sure Node.js is up to date:
node --version # Should be v16 or later
-
Check the MCP server is configured: Look for a section in your config file with
"lfm": {...} -
Check paths are correct:
- No typos in file paths
- Paths use forward slashes on macOS/Linux
- Paths use double backslashes on Windows (
\\not\) - Your actual username (not
YourName)
-
Restart Claude completely (quit and reopen)
-
Check MCP logs (if available):
- Claude Code: Look in the developer console
- Claude Desktop: Check for error messages
-
Test the server manually:
cd ~/lfm-mcp node server.js
If this shows errors, fix those first
See the Troubleshooting Guide for more help, or open an issue.
The MCP server package includes:
- server.js - The MCP server itself
- lfm-guidelines.md - Guidelines for Claude on how to use your music data
- package.json - Node.js dependencies
- README.md - MCP-specific documentation
Important: Don't delete any of these files! They're all needed for the server to work properly.
-
Start each session with initialization:
Initialize my Last.fm session -
Be specific with time periods:
- ❌ "Show me my top artists"
- ✅ "Show me my top artists from 2024"
-
Ask natural questions:
"What were my most-played albums last month?" "Give me recommendations based on my recent listening" "Check if I've listened to any Pink Floyd albums"
Music stats:
- "What are my top 10 artists of all time?"
- "Show me my most-played tracks from last week"
- "What albums did I listen to most in January 2024?"
Discovery:
- "Find artists similar to Taylor Swift"
- "Give me music recommendations I haven't heard"
- "What Radiohead albums have I listened to?"
Playback (if Spotify configured):
- "Play Pink Floyd's Dark Side of the Moon"
- "Queue some music similar to what I've been listening to"
To remove the MCP integration:
-
Remove from Claude config:
- Delete the
"lfm"entry from yourmcp.jsonorclaude_desktop_config.json
- Delete the
-
Delete the MCP server folder:
# Windows Remove-Item -Recurse C:\Users\YourName\lfm-mcp # macOS/Linux rm -rf ~/lfm-mcp
-
Restart Claude
The LFM CLI tool will still be installed and usable from the command line.
- Explore Commands: Quick Start Guide
- Get Help: Troubleshooting Guide
- Full Documentation: README.md
Happy music exploring! 🎵