Most coding sessions end up with the same small distraction: you want low-key instrumental music in the background, or a quick 60-second lo-fi loop for a product demo, and suddenly you are ten tabs deep into stock audio sites checking license restrictions.
If you already spend most of your day in Claude Code, you can wire up an MCP server once and generate an original instrumental track straight from your terminal. In this walkthrough, we will connect the Auteo MCP server to Claude Code, inspect the setup with the CLI fallback, and run a concrete lo-fi hip hop prompt through the open-source YuE2 model.
Why generate audio from the terminal?
When you are building a demo video, a game prototype, or a coding stream overlay, leaving your editor to hunt for background music breaks flow. Putting music generation behind Model Context Protocol (MCP) turns it into a repeatable tool call:
- Prompts stay versioned alongside your project assets or video scripts.
- You get deterministic metadata — exact prompt text, model ID, duration, and output file path.
- No local GPU setup is required. Open-source song models like YuE2 normally demand substantial VRAM and environment setup if you self-host them locally. Calling them over MCP lets Claude Code submit the job and return the finished MP3.
Step 1: Create an API key
The Auteo MCP endpoint uses Streamable HTTP with Bearer token authentication. Before adding it to Claude Code, generate an API key from your Auteo account settings (https://auteo.ai/me/settings#api-keys) and export it in your shell:
export AUTEO_API_KEY="your_api_key_here"
Keeping the token in an environment variable prevents it from leaking into project-level config files if you commit .mcp.json to Git.
Step 2: Register the MCP server in Claude Code
Run the built-in claude mcp add command to attach the remote endpoint over HTTP:
claude mcp add --transport http auteo https://auteo.ai/api/mcp \
--header "Authorization: Bearer ${AUTEO_API_KEY}"
Verify that Claude Code sees the server:
claude mcp list
You should see auteo listed with transport http and URL https://auteo.ai/api/mcp. If you prefer configuring it in ~/.claude.json or a project-scoped .mcp.json, the equivalent entry looks like this:
{
"mcpServers": {
"auteo": {
"type": "http",
"url": "https://auteo.ai/api/mcp",
"headers": {
"Authorization": "Bearer ${AUTEO_API_KEY}"
}
}
}
}
Optional: CLI fallback with @auteo/cli
If you want to script batch generations in a Makefile or CI job outside of an interactive Claude Code session, you can install the official CLI package instead:
npm i -g @auteo/cli
auteo auth login
auteo account
You can also run it one-off without a global install via npx @auteo/cli, and install the companion agent skills with npx skills add AuteoAI/skills so Claude Code knows the exact parameter conventions.
Step 3: Write a structured lo-fi prompt for YuE2
Open-source music models respond best when you separate instrumentation, groove, texture, and tempo rather than writing vague adjectives like "chill vibes."
In our 10-genre practitioner benchmark of YuE2 (you can explore the audio files and logs on the YuE2 model page or download the raw CSV and MP3s from the open YuE2 sample dataset on Hugging Face), we used the following instrumental prompt titled "Desk Lamp":
Instrumental lo-fi hip hop, soft electric piano chords, dusty muted drums, mellow bass, light vinyl crackle, around 78 BPM.
Notice three deliberate choices in that prompt:
- "Instrumental" explicitly suppresses lead vocals so the track does not compete with voiceovers or your own thoughts while coding.
- Specific instrument roles ("soft electric piano chords", "dusty muted drums", "mellow bass") anchor the arrangement instead of leaving timbre up to chance.
- Tempo and surface texture ("light vinyl crackle, around 78 BPM") lock in the classic lo-fi pocket.
Step 4: Ask Claude Code to generate the track
Start Claude Code in your workspace and pass the prompt directly in plain English:
Use the Auteo MCP server to generate an instrumental music track with the YuE2 model.
Title: Desk Lamp
Style: Instrumental lo-fi hip hop, soft electric piano chords, dusty muted drums, mellow bass, light vinyl crackle, around 78 BPM.
Instrumental: true
Save the resulting MP3 to ./assets/audio/desk-lamp-lofi.mp3.
Claude Code will discover the music generation tool exposed by the MCP server, submit the request to YuE2 (m-a-p/yue2), poll until rendering completes, and download the MP3 locally.
What the output actually looks like
Here is the real run log from our benchmark execution of this exact "Desk Lamp" prompt on YuE2:
| Metric | Observed Value |
|---|---|
| Model | YuE2 (m-a-p/yue2) |
| Prompt ID |
lofi ("Desk Lamp") |
| Instrumental |
true (no lead voice) |
| Output Duration | 69 seconds |
| End-to-End Time | 36 seconds |
| Output Format | MP3 (lofi.mp3, ~2.76 MB) |
When we reviewed the rendered audio against a three-point checklist:
- No lead voice: Passed — cleanly instrumental from start to finish.
- Soft keys and dusty drum groove: Passed — warm Rhodes-style electric piano chords layered over a restrained, slightly swung beat.
- Faint vinyl texture: Passed — subtle crackle sits underneath without muddying the low end.
One practical note on latency: when the queue is clear, a ~69-second YuE2 track completes in roughly 36 seconds end-to-end. Under heavier queue load on a single self-hosted GPU, longer tracks (such as a 2-minute cinematic orchestral piece or a nearly 4-minute rock song) can take several minutes. Keeping instrumental background loops around 60–90 seconds gives the fastest turnaround for rapid iteration.
Tips for iterating in Claude Code
Once the MCP server is connected, a few small habits make audio generation much smoother:
-
Store prompts in JSON. Keeping a
prompts.jsonfile in your repo lets you ask Claude Code to regenerate a track with a single tweak — for example, bumping tempo from78 BPMto84 BPMor swapping electric piano for acoustic guitar. -
Check loudness before dropping into a video. Run a quick
ffmpegloudness normalization pass (-af loudnorm=I=-16:TP=-1.5:LRA=11) so your generated background loop sits evenly under narration. -
Verify vocals vs. instrumental flags. Always specify
instrumental: true(and mention "Instrumental" at the start of the style description) whenever you need voiceover-safe background music.
Wrapping up
Wiring an MCP server into Claude Code turns background music from a manual browsing chore into a single reproducible command. With YuE2 available through the same endpoint you already use from your terminal, you can draft, audition, and save custom lo-fi tracks in under a minute without ever leaving your editor.
Top comments (0)