An open API service indexing awesome lists of open source software.

https://github.com/rianvdm/discogs-mcp

A Discogs MCP Server with OAuth, to use with your favorite LLM client. Ask for recommendations, stats about your collection, details about releases you own, and more!
https://github.com/rianvdm/discogs-mcp

discogs mcp mcp-server music

Last synced: 28 days ago
JSON representation

A Discogs MCP Server with OAuth, to use with your favorite LLM client. Ask for recommendations, stats about your collection, details about releases you own, and more!

Awesome Lists containing this project

README

          

# ๐ŸŽต Discogs MCP Server

[![Version](https://img.shields.io/badge/version-3.1.0-blue.svg)](https://github.com/rianvdm/discogs-mcp/releases/tag/v3.1.0)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![Cloudflare Workers](https://img.shields.io/badge/Cloudflare-Workers-F38020?logo=cloudflare&logoColor=white)](https://workers.cloudflare.com/)
[![MCP](https://img.shields.io/badge/MCP-2024--11--05-blue)](https://github.com/modelcontextprotocol)

A powerful **Model Context Protocol (MCP) server** that enables AI assistants to interact with your personal Discogs music collection. Built on Cloudflare Workers using the official **Cloudflare Agents SDK** and **@modelcontextprotocol/sdk**.

## โœจ Features

- ๐Ÿ” **Secure OAuth Authentication**: Connect your Discogs account safely
- ๐Ÿง  **Intelligent Mood Mapping**: Translate emotions into music ("mellow", "energetic", "Sunday evening vibes")
- ๐Ÿ” **Advanced Search Intelligence**: Multi-strategy search with OR logic and relevance scoring
- ๐Ÿ“Š **Collection Analytics**: Comprehensive statistics and insights about your music
- ๐ŸŽฏ **Context-Aware Recommendations**: Smart suggestions based on mood, genre, and similarity
- โšก **Edge Computing**: Global low-latency responses via Cloudflare Workers
- ๐Ÿ—‚๏ธ **Smart Caching**: Intelligent KV-based caching for optimal performance

## โš ๏ธ This Is Not a Shared Service

**`discogs-mcp.com` is the maintainer's private instance.** It's locked to a single Discogs account and will return a 403 for anyone else.

Why? The Discogs API rate limit (60 requests per minute, per registered app) is too tight to share across users. One active collection query from a single user can saturate it. Rather than run a broken multi-tenant service, **each user deploys their own Worker with their own Discogs API credentials**.

The good news: deploying your own copy is straightforward, runs on the Cloudflare Workers free tier, and takes about 10 minutes. See [Self-Hosting](#-self-hosting) below.

## ๐Ÿš€ Self-Hosting

### Prerequisites

- Node.js 18+
- Cloudflare account (free tier is fine)
- Discogs account with a [registered developer app](https://www.discogs.com/settings/developers) (you'll need a **Consumer Key** and **Consumer Secret**)

### 1. Clone and install

```bash
git clone https://github.com/rianvdm/discogs-mcp.git
cd discogs-mcp
npm install
```

### 2. Create KV namespaces

```bash
wrangler kv namespace create MCP_SESSIONS --env production
wrangler kv namespace create MCP_LOGS --env production
wrangler kv namespace create OAUTH_KV --env production
```

Copy the returned IDs into `wrangler.toml` under `[env.production]`.

### 3. Set your Discogs credentials

```bash
wrangler secret put DISCOGS_CONSUMER_KEY --env production
wrangler secret put DISCOGS_CONSUMER_SECRET --env production
wrangler secret put JWT_SECRET --env production # any random string
```

### 4. (Optional but recommended) Lock your instance to your own Discogs user

By default, anyone with a Discogs account who discovers your Worker URL can authenticate and consume your rate-limit budget. To restrict it to just you โ€” or to a small group of trusted users โ€” set `ALLOWED_DISCOGS_USER_ID` in `wrangler.toml` under `[env.production.vars]`:

```toml
[env.production.vars]
# Single user
ALLOWED_DISCOGS_USER_ID = "123456"

# Or a comma-separated list for multiple users
ALLOWED_DISCOGS_USER_ID = "123456,789012,345678"
```

You can find your numeric ID by visiting `https://api.discogs.com/users/` and looking at the `id` field. Leave the value empty to run an open instance.

### 5. Deploy

```bash
npm run deploy:prod
```

Your Worker URL will be something like `https://discogs-mcp..workers.dev`. The MCP endpoint is `/mcp`.

### 6. Connect your MCP client

Replace `https://your-worker.workers.dev` below with your own URL.

**Claude Desktop** โ€” Settings โ†’ Integrations โ†’ Add Integration โ†’ `https://your-worker.workers.dev/mcp`

**Claude Code**:

```bash
claude mcp add --transport http discogs https://your-worker.workers.dev/mcp
```

**Windsurf** (`~/.codeium/windsurf/mcp_config.json`):

```json
{
"mcpServers": {
"discogs": {
"serverUrl": "https://your-worker.workers.dev/mcp"
}
}
}
```

**Continue.dev / Zed / Generic:**

```json
{
"mcpServers": {
"discogs": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://your-worker.workers.dev/mcp"]
}
}
}
```

**MCP Inspector (testing)**:

```bash
npx @modelcontextprotocol/inspector https://your-worker.workers.dev/mcp
```

## ๐Ÿ” Authentication

This server uses **MCP OAuth 2.1** with Discogs as the identity provider. When you connect for the first time:

1. Your MCP client automatically opens a browser window
2. Authorize the application on Discogs
3. You're redirected back and authenticated โ€” no copy-pasting required
4. Your session persists for 7 days

## ๐Ÿ› ๏ธ Available Tools

### ๐Ÿ”“ Public Tools (No Authentication Required)

| Tool | Description |
| ------------- | ------------------------------------------------------ |
| `ping` | Test server connectivity |
| `server_info` | Get server information and capabilities |
| `auth_status` | Check authentication status and get login instructions |

### ๐Ÿ” Authenticated Tools (Requires Login)

**Search & discovery**

| Tool | Description |
| ---------------------- | ---------------------------------------------------------------------------- |
| `search_collection` | Search your collection with explicit genre filters, mood-aware ranking, and master-level dedup |
| `search_discogs` | Search the Discogs-wide catalog (releases, masters, artists, labels) โ€” marks results you already own |
| `get_release` | Get detailed information about a specific release (tracklist, formats, labels) |
| `get_collection_stats` | View genre breakdown, decade analysis, format distribution, and ratings |
| `get_recommendations` | Get personalized recommendations by genre, decade, mood, or similarity |

**Collection management**

| Tool | Description |
| ------------------------ | --------------------------------------------------------------------------- |
| `add_to_collection` | Add a release to a folder (defaults to Uncategorized) |
| `remove_from_collection` | Remove a specific release instance from a folder |
| `move_release` | Move a release instance between folders |
| `rate_release` | Rate a release from 0 (no rating) to 5 stars |

**Folders**

| Tool | Description |
| ---------------- | ------------------------------------------------------------------- |
| `list_folders` | List all folders with release counts |
| `create_folder` | Create a new folder |
| `edit_folder` | Rename an existing folder (system folders excluded) |
| `delete_folder` | Delete an empty folder (system folders excluded) |

**Custom fields**

| Tool | Description |
| -------------------- | ------------------------------------------------------------------------------------ |
| `list_custom_fields` | List all custom fields defined on your collection |
| `edit_custom_field` | Set a custom field value on a specific release instance |

**Diagnostics**

| Tool | Description |
| ----------------- | ------------------------------------------------------------------- |
| `get_cache_stats` | View cache performance (total entries, pending requests, breakdown) |

## ๐Ÿ“š MCP Resources

Access Discogs data via standardized MCP resource URIs:

```
discogs://collection # Complete collection (JSON)
discogs://release/{id} # Specific release details
discogs://search?q={query} # Search results
```

## ๐Ÿ—๏ธ Local Development

```bash
# Set dev secrets (same Discogs app is fine for dev)
wrangler secret put DISCOGS_CONSUMER_KEY
wrangler secret put DISCOGS_CONSUMER_SECRET
wrangler secret put JWT_SECRET

# Run the Worker locally
npm run dev

# Test with MCP Inspector
npx @modelcontextprotocol/inspector http://localhost:8787/mcp
```

The default `[vars]` block in `wrangler.toml` leaves `ALLOWED_DISCOGS_USER_ID` empty, so local dev is open to any Discogs account โ€” convenient for testing.

## ๐Ÿงช Testing

```bash
npm test # Run all tests
npm test -- --watch # Run tests in watch mode
```

## ๐Ÿค Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## ๐Ÿ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- [Discogs](https://www.discogs.com/) for the music database API
- [Model Context Protocol](https://modelcontextprotocol.io/) for the standard
- [Cloudflare Workers](https://workers.cloudflare.com/) for the platform