
Building the ONCE MCP Server
How we built a Model Context Protocol server for AI-powered music distribution.
ONCE Engineering
The Model Context Protocol (MCP) is an emerging standard for connecting AI assistants to external tools and data sources. We built an MCP server that lets AI assistants manage the entire music distribution workflow, from uploading tracks to monitoring delivery status across stores.
Why MCP?
Traditional APIs require developers to write integration code, handle auth flows, and build UIs for every operation. MCP inverts this: you describe your tools, and any compatible AI assistant can use them natively.
For ONCE, this means an artist can say "release my new single to Spotify and Apple Music" and their AI assistant handles everything (metadata, cover art, audio upload, and submission) through our MCP server.
Architecture
The server exposes a set of tools over the MCP protocol:
// Tool definition example
{
name: "submit_release",
description: "Submit a release to distribution networks",
parameters: {
release: { type: "object", required: true },
tracks: { type: "array", required: true },
distributors: { type: "object" }
}
}
Each tool maps to a Supabase edge function or direct database operation. The MCP layer handles:
- Authentication: Token exchange via
auth_login - Validation: Schema checks before submission
- File handling: Streaming uploads for cover art and audio
- State management: Draft snapshots for multi-turn conversations
Draft Snapshots
One challenge with conversational release creation is that it happens over multiple turns. An artist might provide the track title, then come back later with the cover art, then finalize metadata.
We solved this with draft snapshots, partial release data persisted between sessions:
await upsertReleaseSnapshot({
conversationId: "conv_abc123",
status: "collecting",
release: { title: "New Single", artist: "..." },
tracks: [{ title: "Track 1", audioUrl: null }],
});
When the conversation resumes, the assistant picks up where it left off.
What's Next
We're exploring multi-agent workflows where a validation agent reviews metadata before a submission agent pushes to distributors. More on that in a future post.
The ONCE MCP server is available at https://once.app/api/mcp. See the docs for setup instructions.
MCP Docs