MusicBrainz MCP Server

MusicBrainz MCP Server

A comprehensive MCP server for querying the MusicBrainz database, providing tools to search for artists, releases, recordings, and browse music metadata.

Category
Visit Server

README

MusicBrainz MCP Server

A comprehensive Model Context Protocol (MCP) server for querying the MusicBrainz database, built with FastMCP framework. This server provides seamless access to music metadata including artists, releases, recordings, and more through a standardized MCP interface.

๐ŸŽต Features

  • 10 Comprehensive MCP Tools for music database queries
  • Real-time MusicBrainz API Integration with rate limiting and error handling
  • Async/Await Support for high-performance operations
  • Comprehensive Caching System with configurable TTL
  • Robust Error Handling with detailed error messages
  • Flexible Configuration via environment variables or config files
  • Production Ready with comprehensive testing (101 tests, 99% passing)

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • Internet connection for MusicBrainz API access

Installation

  1. Clone the repository:
git clone <repository-url>
cd MusicBrainzMcp
  1. Create virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -e .
  1. Run the server:
python -m musicbrainz_mcp.main

The server will start and be available for MCP client connections.

๐Ÿš€ Quick Start with Smithery.ai

The easiest way to use the MusicBrainz MCP Server is through smithery.ai:

  1. Visit smithery.ai and sign in
  2. Search for "MusicBrainz MCP Server" in the tool directory
  3. Configure your settings:
    • User Agent: YourApp/1.0.0 (your.email@example.com)
    • Rate Limit: 1.0 (requests per second)
    • Timeout: 30.0 (seconds)
  4. Start querying music data instantly!

Popular Music Queries You Can Try

  • Search for Taylor Swift: search_artist with query "Taylor Swift"
  • Find "Blinding Lights": search_recording with query "Blinding Lights"
  • Browse recent releases: browse_artist_releases for any artist
  • Get detailed info: get_artist_details with any artist MBID

๐Ÿ“– Documentation

๐Ÿ› ๏ธ Available MCP Tools

Tool Description Example Use Case
search_artist Search for artists by name Find "The Beatles"
search_release Search for releases/albums Find "Abbey Road" album
search_recording Search for individual tracks Find "Come Together" song
search_release_group Search for release groups Find album groups
get_artist_details Get detailed artist info by MBID Get Beatles discography
get_release_details Get detailed release info Get album track listing
get_recording_details Get detailed recording info Get song metadata
browse_artist_releases Browse an artist's releases List Beatles albums
browse_artist_recordings Browse an artist's recordings List Beatles songs
lookup_by_mbid Generic lookup by MusicBrainz ID Get any entity by ID

โš™๏ธ Configuration

Environment Variables

# MusicBrainz API Configuration
MUSICBRAINZ_USER_AGENT="YourApp/1.0.0"  # Required: Your app identifier
MUSICBRAINZ_RATE_LIMIT="1.0"            # Requests per second (default: 1.0)
MUSICBRAINZ_TIMEOUT="10.0"              # Request timeout in seconds

# Caching Configuration
CACHE_ENABLED="true"                     # Enable/disable caching
CACHE_DEFAULT_TTL="300"                  # Cache TTL in seconds (5 minutes)

# Server Configuration
DEBUG="false"                            # Enable debug logging

Configuration File

Create config.json in the project root:

{
  "api": {
    "user_agent": "YourApp/1.0.0",
    "rate_limit": 1.0,
    "timeout": 10.0
  },
  "cache": {
    "enabled": true,
    "default_ttl": 300
  },
  "debug": false
}

๐Ÿ’ก Usage Examples

Basic Artist Search

# Using MCP client to search for artists
result = await client.call_tool("search_artist", {
    "params": {
        "query": "The Beatles",
        "limit": 10
    }
})

Get Artist Details

# Get detailed information about an artist
result = await client.call_tool("get_artist_details", {
    "params": {
        "mbid": "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
        "inc": ["releases", "recordings"]
    }
})

Browse Artist Releases

# Browse all releases by an artist
result = await client.call_tool("browse_artist_releases", {
    "params": {
        "artist_mbid": "b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d",
        "limit": 20,
        "release_type": ["album"],
        "release_status": ["official"]
    }
})

For more examples, see docs/examples.md.

๐Ÿš€ Deployment

Docker Deployment

  1. Build the Docker image:
docker build -t musicbrainz-mcp .
  1. Run the container:
docker run -d \
  --name musicbrainz-mcp \
  -e MUSICBRAINZ_USER_AGENT="YourApp/1.0.0" \
  -p 8000:8000 \
  musicbrainz-mcp

Systemd Service

Create /etc/systemd/system/musicbrainz-mcp.service:

[Unit]
Description=MusicBrainz MCP Server
After=network.target

[Service]
Type=simple
User=musicbrainz
WorkingDirectory=/opt/musicbrainz-mcp
Environment=MUSICBRAINZ_USER_AGENT=YourApp/1.0.0
ExecStart=/opt/musicbrainz-mcp/venv/bin/python -m musicbrainz_mcp.main
Restart=always

[Install]
WantedBy=multi-user.target

Cloud Deployment

The server can be deployed on any cloud platform that supports Python applications:

  • Heroku: Use the included Procfile
  • AWS Lambda: Package as a serverless function
  • Google Cloud Run: Use the Docker container
  • Azure Container Instances: Deploy the Docker image

๐Ÿงช Testing

Run the comprehensive test suite:

# Run all tests
pytest

# Run with coverage
pytest --cov=musicbrainz_mcp

# Run only unit tests
pytest -m unit

# Run only integration tests
pytest -m integration

# Run with verbose output
pytest -v

Test Results:

  • โœ… 101 total tests
  • โœ… 100 passing, 1 skipped
  • โœ… 99% success rate
  • โœ… Zero failures, zero warnings

๐Ÿ› ๏ธ Development

Setup Development Environment

  1. Clone and setup:
git clone <repository-url>
cd MusicBrainzMcp
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
  1. Install pre-commit hooks:
pre-commit install
  1. Run tests:
pytest

Project Structure

MusicBrainzMcp/
โ”œโ”€โ”€ src/musicbrainz_mcp/          # Main package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py                   # Server entry point
โ”‚   โ”œโ”€โ”€ server.py                 # FastMCP server implementation
โ”‚   โ”œโ”€โ”€ musicbrainz_client.py     # MusicBrainz API client
โ”‚   โ”œโ”€โ”€ models.py                 # Pydantic data models
โ”‚   โ”œโ”€โ”€ schemas.py                # Response schemas
โ”‚   โ”œโ”€โ”€ config.py                 # Configuration management
โ”‚   โ”œโ”€โ”€ cache.py                  # Caching system
โ”‚   โ”œโ”€โ”€ exceptions.py             # Custom exceptions
โ”‚   โ””โ”€โ”€ utils.py                  # Utility functions
โ”œโ”€โ”€ tests/                        # Test suite
โ”‚   โ”œโ”€โ”€ test_client.py           # Client tests
โ”‚   โ”œโ”€โ”€ test_server.py           # Server tests
โ”‚   โ”œโ”€โ”€ test_models.py           # Model tests
โ”‚   โ”œโ”€โ”€ test_utils.py            # Utility tests
โ”‚   โ”œโ”€โ”€ test_integration.py      # Integration tests
โ”‚   โ””โ”€โ”€ mock_data.py             # Test data
โ”œโ”€โ”€ docs/                        # Documentation
โ”œโ”€โ”€ examples/                    # Usage examples
โ””โ”€โ”€ pyproject.toml              # Project configuration

๐Ÿ”ง Troubleshooting

Common Issues

1. Rate Limit Errors

MusicBrainzRateLimitError: Rate limit exceeded
  • Solution: Reduce the MUSICBRAINZ_RATE_LIMIT value or wait before retrying
  • Default: 1 request per second (MusicBrainz recommendation)

2. Network Timeout

MusicBrainzAPIError: Request timeout
  • Solution: Increase MUSICBRAINZ_TIMEOUT value or check network connectivity
  • Default: 10 seconds

3. Invalid MBID Format

ValidationError: Invalid MBID format
  • Solution: Ensure MBIDs are valid UUID format (e.g., b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d)

4. Missing User Agent

MusicBrainzAPIError: User agent required
  • Solution: Set MUSICBRAINZ_USER_AGENT environment variable

Debug Mode

Enable debug logging for troubleshooting:

export DEBUG=true
python -m musicbrainz_mcp.main

Health Check

Test server connectivity:

# Test basic connectivity
result = await client.call_tool("search_artist", {
    "params": {"query": "test", "limit": 1}
})

๐Ÿค Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes with proper tests
  4. Run the test suite: pytest
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Development Guidelines

  • Code Style: Follow PEP 8 and use type hints
  • Testing: Add tests for new functionality
  • Documentation: Update docs for API changes
  • Commit Messages: Use conventional commit format

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support


Made with โค๏ธ for the music community This server provides comprehensive access to music metadata including artists, albums, recordings, releases, and related information through a standardized MCP interface.

Features

  • ๐ŸŽต Comprehensive Music Data: Access artists, albums, recordings, releases, and more
  • ๐Ÿš€ FastMCP Framework: Built on the robust FastMCP framework for reliable MCP protocol handling
  • ๐Ÿ” Powerful Search: Search across all MusicBrainz entity types with flexible query options
  • ๐Ÿ“Š Rich Metadata: Get detailed information including relationships, tags, and ratings
  • โšก Async Performance: Non-blocking async operations for optimal performance
  • ๐Ÿ›ก๏ธ Rate Limiting: Built-in compliance with MusicBrainz API guidelines
  • ๐Ÿงช Well Tested: Comprehensive test suite with high code coverage
  • ๐Ÿ“š Great Documentation: Detailed docs with examples and API reference

Quick Start

Installation

# Clone the repository
git clone https://github.com/yourusername/musicbrainz-mcp.git
cd musicbrainz-mcp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e ".[dev]"

Running the Server

# Start the MCP server
musicbrainz-mcp

# Or run directly with Python
python -m musicbrainz_mcp.server

Basic Usage

The server provides several MCP tools for querying MusicBrainz:

  • search_artist - Search for artists by name
  • search_release - Search for releases/albums
  • search_recording - Search for recordings/tracks
  • get_artist_details - Get detailed artist information
  • get_release_details - Get detailed release information
  • lookup_by_mbid - Direct lookup using MusicBrainz IDs

MCP Tools

search_artist

Search for artists by name or query string.

Parameters:

  • query (string): Search query for artist name
  • limit (integer, optional): Maximum number of results (default: 25)
  • offset (integer, optional): Offset for pagination (default: 0)

Example:

{
  "query": "The Beatles",
  "limit": 10
}

search_release

Search for releases (albums, singles, etc.) by title or artist.

Parameters:

  • query (string): Search query for release title
  • artist (string, optional): Filter by artist name
  • limit (integer, optional): Maximum number of results (default: 25)
  • offset (integer, optional): Offset for pagination (default: 0)

search_recording

Search for recordings (individual tracks) by title or artist.

Parameters:

  • query (string): Search query for recording title
  • artist (string, optional): Filter by artist name
  • limit (integer, optional): Maximum number of results (default: 25)
  • offset (integer, optional): Offset for pagination (default: 0)

get_artist_details

Get detailed information about a specific artist.

Parameters:

  • mbid (string): MusicBrainz ID of the artist
  • include (array, optional): Additional data to include (releases, recordings, etc.)

get_release_details

Get detailed information about a specific release.

Parameters:

  • mbid (string): MusicBrainz ID of the release
  • include (array, optional): Additional data to include (tracks, artist-credits, etc.)

lookup_by_mbid

Direct lookup of any entity by its MusicBrainz ID.

Parameters:

  • mbid (string): MusicBrainz ID
  • entity_type (string): Type of entity (artist, release, recording, etc.)
  • include (array, optional): Additional data to include

Configuration

The server can be configured through environment variables:

  • MUSICBRAINZ_USER_AGENT: Custom User-Agent for API requests
  • MUSICBRAINZ_RATE_LIMIT: Rate limit in requests per second (default: 1.0)
  • MUSICBRAINZ_TIMEOUT: Request timeout in seconds (default: 30)
  • MUSICBRAINZ_BASE_URL: Base URL for MusicBrainz API (default: https://musicbrainz.org/ws/2)

Development

Setup Development Environment

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

# Run tests with coverage
pytest --cov=musicbrainz_mcp --cov-report=html

# Format code
black src tests
ruff check src tests

# Type checking
mypy src

Project Structure

musicbrainz-mcp/
โ”œโ”€โ”€ src/musicbrainz_mcp/
โ”‚   โ”œโ”€โ”€ __init__.py          # Package initialization
โ”‚   โ”œโ”€โ”€ server.py            # Main MCP server implementation
โ”‚   โ”œโ”€โ”€ musicbrainz_client.py # MusicBrainz API client
โ”‚   โ”œโ”€โ”€ models.py            # Pydantic data models
โ”‚   โ”œโ”€โ”€ tools.py             # MCP tool definitions
โ”‚   โ”œโ”€โ”€ utils.py             # Utility functions
โ”‚   โ”œโ”€โ”€ config.py            # Configuration management
โ”‚   โ””โ”€โ”€ exceptions.py        # Custom exceptions
โ”œโ”€โ”€ tests/                   # Test suite
โ”œโ”€โ”€ docs/                    # Documentation
โ”œโ”€โ”€ examples/                # Usage examples
โ””โ”€โ”€ pyproject.toml          # Project configuration

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for your changes
  5. Run the test suite (pytest)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support


Made with โค๏ธ for the music community smithery badge

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured