Overview
Use the Music MCP server from your ATXP-powered agent to create music from a natural-language prompt.Example prompts
- “Create a modern country song about a cat riding a horse.”
- “Create an electronic dance music song about a child and a puppy.”
Tools
music_create
music_create
Take in lyrics and prompt and produce a hex encoded MP3 file. An example prompt would be “polka, upbeat, fast”. Example lyrics would be “[intro]Hey there cowboy[verse]That’s a mighty fine horse you got[outro]”. The output will contain a URL to the MP3 file.
Arguments
Accepts a JSON object with the following properties:The prompt for the music. For example, what style of music to create. Example: “blues, melancholic, raw, lonely bar, heartbreak”
The lyrics you would like to include in the music. You can use new lines to separate verses. You can use [intro][verse][chorus][bridge][outro] to specify the structure of the song.
Response
Returns a JSON object with the following properties:The status of the music generation operation. Returns “success” when the music is generated successfully.
The URL that the generated MP3 file is accessible at.
music_create_async
music_create_async
Takes in lyrics and prompt and starts asynchronous music generation. Returns a task ID that can be used to check status and retrieve the result. Use this for longer music generation tasks to avoid timeouts.
Arguments
Accepts a JSON object with the following properties:The prompt for the music. For example, what style of music to create. Example: “blues, melancholic, raw, lonely bar, heartbreak”
The lyrics you would like to include in the music. You can use new lines to separate verses. You can use [intro][verse][chorus][bridge][outro] to specify the structure of the song.
Response
Returns a JSON object with the following properties:A unique task identifier that can be used with
music_get_async
to check the status and retrieve the result.music_get_async
music_get_async
Retrieves the status and result of an asynchronous music generation task using the task ID. Tasks expire after 12 hours.
Arguments
Accepts a JSON object with the following properties:The task ID returned from
music_create_async
.Response
Returns a JSON object with the following properties:The current status of the task. Can be “pending”, “running”, “completed”, or “error”.
The URL that the generated MP3 file is accessible at. Only present when status is “completed”.
Timestamp when the task was created.
Timestamp when the task was completed. Only present when status is “completed” or “error”.
Error message if the task failed. Only present when status is “error”.
Usage
1
Define the Music service
Create a reusable service configuration that points to the MCP server and standardizes how you pass arguments and read results. This lets your agent easily interact with the Music tools in a consistent manner.
2
Create an ATXP client
- Using an ATXP account
- Using a Base account
- Using a Solana account
- Using a Worldchain account
- Using a Polygon account
Create a client using an ATXP account by importing the ATXP client SDK and other dependencies.
3
Use the Music service in your agent
- Synchronous Generation
- Asynchronous Generation
Call the Music tool by passing your natural-language instruction as the argument the
getArguments
method.Read the response using the getResult
method.You should see the result of the music creation printed in your console.