How to Use the MusicBrainz MCP in Mastra AI
Build resilient music data pipelines. Automate metadata lookups and enrichment for any artist or track with Mastra AI and MusicBrainz.
Works with every AI agent you already use
…and any MCP-compatible client
Connect MusicBrainz MCP to Mastra AI
Create your Vinkius account to connect MusicBrainz to Mastra AI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Automate Music Catalog Ingestion
Create a workflow that pulls in new music metadata automatically. Your Mastra AI agent can use a simple input, like a track title, and run it through `search_recordings` to find potential matches. The workflow can then branch based on how many results it gets. If there's a single, high-confidence match, the agent proceeds to call `get_recording` and `get_release` to pull the full dataset. If there are multiple matches, it can flag the item for human review, using Mastra's `requireToolApproval` feature. It's a reliable way to clean up a messy catalog.
Create Failsafe Metadata Workflows
MusicBrainz is community-driven, so data can be inconsistent. A Mastra AI workflow handles this. For example, if a `get_release` call fails to find a barcode, your agent can automatically retry by calling `get_release_group` and then browsing its associated releases. This conditional logic is Mastra's strength. You can build a sequence: try `search_releases` with a UPC, if that fails, try `search_recordings` with an ISRC. The built-in exponential backoff in your MCP connection means your agent won't hammer the API if there's a temporary issue.
Enrich Your Data with this MCP Server
Go beyond basic track and artist names. Set up a Mastra AI agent to enrich your existing database. It can take an artist ID you already have and use `get_artist` with the `inc="aliases"` parameter to find all their alternate names or spellings. You can also identify composers and writers. The workflow can take a recording, find its associated `work` via `get_recording`, and then use `get_work` to retrieve the ISWC and writer credits. This whole process runs as a background job, managed by the Mastra AI engine.
Set up MusicBrainz MCP in Mastra AI
Prerequisites
- Node.js 18+ and a TypeScript project
-
@mastra/mcp+@mastra/corepackages - Active Vinkius subscription with a valid endpoint token
- 1
Install dependencies
Run
npm install @mastra/mcp @mastra/coreplus your preferred model provider (e.g.@ai-sdk/openai). - 2
Configure the MCPClient
Create an
MCPClientwith your Vinkius endpoint as aURLobject. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. - 3
Discover and inject tools
Call
mcpClient.listTools()and spread the result into your agent'stoolsobject. All MusicBrainz tools become native Mastra tools. - 4
Run with any model
Swap
openai("gpt-4o")for any AI SDK-compatible provider. Callagent.generate()and the agent routes tool calls through MCP automatically.
import { MCPClient } from "@mastra/mcp";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";
const mcpClient = new MCPClient({
id: "musicbrainz-mcp-client",
servers: {
"musicbrainz-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "MusicBrainz Agent",
model: openai("gpt-4o"),
instructions: "You have access to MusicBrainz tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent MusicBrainz transactions"
);
console.log(result.text); Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by MusicBrainz. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about MusicBrainz MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the MusicBrainz MCP today
We host it, we monitor it, we maintain it. You just paste one token.