Generate Suno music from Claude Code, Cursor & AI agents
Updated 2026-07-08
You can give an AI agent the ability to make music. Tunova ships a hosted MCP server, so Claude Code, Cursor, Windsurf, or a multi-agent workflow can generate a Suno track in the middle of a conversation — no glue code. But an agent is a harder client than a script, and a thin wrapper isn’t enough. Here’s the setup, and what actually makes agentic music generation reliable.
Why agents need more than a Suno wrapper
A human calling an API sees a failed request and decides what to do. An agent loops. If a tool returns an ambiguous error — or silently charges for a render that failed — an autonomous agent will happily retry into a hole, burning both time and budget with nothing to show for it. This is the “silent-failure budget-burn” problem, and it’s why most community MCP wrappers are fine for a demo and painful in an actual agent loop.
Reliable agentic generation needs three things a wrapper usually skips:
- Typed results an agent can reason about — a clear job_id, a clear status, or a clear error, not a wall of text the model has to guess at.
- Request-ids — so a stuck job is debuggable instead of a mystery.
- No charge on failure — so an autonomous retry is safe. If failed renders and 429s are free, the agent can retry a transient failure without spending money on the attempts that produced nothing.
Tunova’s tools return structured results, every call carries a request id, and generation is billed on success only — so an agent’s retry loop can be as patient as it needs to be.
The three tools
generate_song— start a song from a prompt (or your own lyrics withcustom: true). Returns ajob_idimmediately; a full render takes 1-3 minutes. Costs 10 tokens, billed only on success.wait_for_song— poll server-side for up to ~45s with ajob_id. Returns the audio URLs when ready, or a status so the agent calls again. Read-only, so a retry can never start a second song or double-charge.check_song— a one-shot status check byjob_id, no waiting.
Set up in Claude Code
The fastest path is the Tunova plugin — it wires the MCP server and a music skill in two commands:
Set your sk_live_ key (grab one free at tunova.ai/keys), and Claude Code can generate a song from a prompt in-conversation. See the integrations hub for the Codex setup too.
Set up in Cursor, Windsurf, or any MCP client
Tunova’s server is a standard remote MCP endpoint, so any client that speaks Streamable HTTP works — point it at the URL and pass your key as a header. For Cursor, add this to ~/.cursor/mcp.json:
Restart the client; it discovers generate_song, wait_for_song andcheck_song automatically. Same endpoint, same key, same token billing as the REST API.
Lyrics-to-track in one conversation
Once the server is connected, the agent flow is just two tool calls — start, then wait:
Because wait_for_song only reads status, the agent can call it as many times as it takes without any risk of starting a duplicate render — the pattern that makes a minutes-long job safe inside a seconds-scale tool loop.
n8n, Make & multi-agent orchestration
The same job model powers no-code and multi-step automations: kick off generate_song, then either poll or receive an HMAC-signed webhook when the track is ready. See the integrations hub for n8n templates and the HTTP pattern that keeps an async job from stranding a workflow.
How billed-on-success makes autonomous retries safe
This is the part that matters for agents specifically. On a pay-per-attempt API, an agent that retries is an agent that overspends — every transient failure is billed, and you can’t safely let it loop. Tunova bills only on a successful, delivered song: failed renders auto-refund, and rate-limit / transient-capacity responses never reserve a token. So the correct agent policy is the simple one — retry the transient failures until a track lands — and it costs exactly the number of songs you actually got. Pair it with the error taxonomy to know which failures are worth a retry.
FAQ
Is there an MCP server for generating Suno music?
Yes. Tunova hosts one at POST https://api.tunova.ai/mcp (stateless Streamable HTTP JSON-RPC). It exposes three tools — generate_song, wait_for_song, check_song — so any MCP client (Claude Code, Cursor, Windsurf, custom agents) can generate music. You authenticate with your sk_live_ key as the X-API-Key header.
How do I add Suno music generation to Claude Code?
The fastest way is the Tunova plugin: run /plugin marketplace add erliona/tunova-agent-plugin, then /plugin install tunova-music@tunova, and set your sk_live_ key. Claude Code can then generate a song from a prompt inside the conversation.
How do I add the Suno MCP server to Cursor?
Add a remote MCP entry to Cursor's mcp.json pointing at https://api.tunova.ai/mcp with your sk_live_ key in an X-API-Key header. Cursor discovers the generate_song / wait_for_song / check_song tools automatically.
Can an AI agent generate music autonomously without burning my budget on failures?
With Tunova, yes. Tools return typed results (job_id, status, or a clear error), generation is billed on success only, and a failed render is auto-refunded — so an agent can retry a transient failure without spending money on the attempts that didn't produce a song.
Why does generate_song return a job_id instead of the audio?
A full render takes 1-3 minutes — far longer than an MCP client's ~60-second tool timeout. So generate_song returns immediately with a job_id, and wait_for_song polls server-side (up to ~45s per call) and returns the audio when ready, or a 'still rendering' status so the agent calls again.
Related
- Suno API error handling — the typed-error taxonomy agents rely on.
- Integrations hub — Claude, Codex, Cursor, n8n, SDKs, REST.
- Suno API in Python & Node — the raw submit → poll loop behind the tools.
- Is there an official Suno API? — where a hosted route fits.
- The MCP endpoint — the server card and tool list.
Tunova is an independent service, not affiliated with or endorsed by Suno. “Suno” is a trademark of its owner.