MusicBrainz MCP Server
Provides tools to search and retrieve music metadata from the MusicBrainz database, including artists, releases, recordings, and more.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MusicBrainz MCP Serversearch for artist Radiohead"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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)
Related MCP server: beatport-mcp-server
๐ Quick Start
Prerequisites
Python 3.8+
Internet connection for MusicBrainz API access
Installation
Clone the repository:
git clone <repository-url>
cd MusicBrainzMcpCreate virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -e .Run the server:
python -m musicbrainz_mcp.mainThe 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:
Visit smithery.ai and sign in
Search for "MusicBrainz MCP Server" in the tool directory
Configure your settings:
User Agent:
YourApp/1.0.0 (your.email@example.com)Rate Limit:
1.0(requests per second)Timeout:
30.0(seconds)
Start querying music data instantly!
Popular Music Queries You Can Try
Search for Taylor Swift:
search_artistwith query "Taylor Swift"Find "Blinding Lights":
search_recordingwith query "Blinding Lights"Browse recent releases:
browse_artist_releasesfor any artistGet detailed info:
get_artist_detailswith any artist MBID
๐ Documentation
API Reference - Complete documentation of all 10 MCP tools
Configuration Guide - Environment variables and configuration options
Usage Examples - Practical examples and tutorials
Client Testing Guide - FastMCP client implementation and testing
Test Results - Comprehensive test results (100% success rate)
Deployment Guide - Production deployment instructions
๐ ๏ธ Available MCP Tools
Tool | Description | Example Use Case |
| Search for artists by name | Find "The Beatles" |
| Search for releases/albums | Find "Abbey Road" album |
| Search for individual tracks | Find "Come Together" song |
| Search for release groups | Find album groups |
| Get detailed artist info by MBID | Get Beatles discography |
| Get detailed release info | Get album track listing |
| Get detailed recording info | Get song metadata |
| Browse an artist's releases | List Beatles albums |
| Browse an artist's recordings | List Beatles songs |
| 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 loggingConfiguration 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
Build the Docker image:
docker build -t musicbrainz-mcp .Run the container:
docker run -d \
--name musicbrainz-mcp \
-e MUSICBRAINZ_USER_AGENT="YourApp/1.0.0" \
-p 8000:8000 \
musicbrainz-mcpSystemd 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.targetCloud Deployment
The server can be deployed on any cloud platform that supports Python applications:
Heroku: Use the included
ProcfileAWS 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 -vTest Results:
โ 101 total tests
โ 100 passing, 1 skipped
โ 99% success rate
โ Zero failures, zero warnings
๐ ๏ธ Development
Setup Development Environment
Clone and setup:
git clone <repository-url>
cd MusicBrainzMcp
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"Install pre-commit hooks:
pre-commit installRun tests:
pytestProject 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 exceededSolution: Reduce the
MUSICBRAINZ_RATE_LIMITvalue or wait before retryingDefault: 1 request per second (MusicBrainz recommendation)
2. Network Timeout
MusicBrainzAPIError: Request timeoutSolution: Increase
MUSICBRAINZ_TIMEOUTvalue or check network connectivityDefault: 10 seconds
3. Invalid MBID Format
ValidationError: Invalid MBID formatSolution: Ensure MBIDs are valid UUID format (e.g.,
b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d)
4. Missing User Agent
MusicBrainzAPIError: User agent requiredSolution: Set
MUSICBRAINZ_USER_AGENTenvironment variable
Debug Mode
Enable debug logging for troubleshooting:
export DEBUG=true
python -m musicbrainz_mcp.mainHealth 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:
Fork the repository
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes with proper tests
Run the test suite:
pytestCommit your changes:
git commit -m 'Add amazing feature'Push to the branch:
git push origin feature/amazing-featureOpen 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
MusicBrainz - For providing the comprehensive music database
FastMCP - For the excellent MCP framework
Model Context Protocol - For the standardized protocol
๐ Support
Documentation: docs/
Issues: GitHub Issues
Discussions: GitHub Discussions
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.serverBasic Usage
The server provides several MCP tools for querying MusicBrainz:
search_artist- Search for artists by namesearch_release- Search for releases/albumssearch_recording- Search for recordings/tracksget_artist_details- Get detailed artist informationget_release_details- Get detailed release informationlookup_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 namelimit(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 titleartist(string, optional): Filter by artist namelimit(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 titleartist(string, optional): Filter by artist namelimit(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 artistinclude(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 releaseinclude(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 IDentity_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 requestsMUSICBRAINZ_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 srcProject 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 configurationContributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes
Add tests for your changes
Run the test suite (
pytest)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
MusicBrainz for providing the comprehensive music database
FastMCP for the excellent MCP framework
Model Context Protocol for the standardized protocol
Support
๐ Documentation
๐ Issue Tracker
๐ฌ Discussions
Made with โค๏ธ for the music community
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/usercourses63/musicbrainz-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server