๐ต MusicMCP.AI MCP Server
AI-Powered Music Generation via the Model Context Protocol

The official MusicMCP.AI Model Context Protocol (MCP) server enables seamless interaction with our advanced AI music generation platform. It lets MCP clients such as Claude Desktop and OpenAI Agents generate AI music through natural language commands.
โจ Features
- ๐ผ AI Music Generation โ Generate songs from text prompts using MusicMCP.AI's state-of-the-art models
- ๐ต Dual Generation Modes โ Support for both Inspiration mode and Custom mode
- ๐ Direct Download Links โ Get direct download URLs for generated music
- ๐น Instrumental Options โ Generate instrumental-only tracks or full songs with vocals
- โ
Credit Balance Check โ Verify your API key validity and remaining credits
- ๐ฅ Health Monitoring โ Check the API service health status
๐ Quickstart with Claude Desktop
Step 1 โ Get Your API Key
Obtain your API key from the MusicMCP.AI Platform.
Step 2 โ Install uv
Install the Python package manager:
curl -LsSf https://astral.sh/uv/install.sh | sh
Step 3 โ Configure Claude
Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json and add:
{
"mcpServers": {
"MusicMCP.AI": {
"command": "uvx",
"args": [
"aimusic-mcp"
],
"env": {
"MUSICMCP_API_KEY": "<insert-your-api-key-here>",
"MUSICMCP_API_URL": "https://www.musicmcp.ai/api",
"TIME_OUT_SECONDS": "600"
}
}
}
}
Step 4 โ Restart Claude
Restart the Claude app. You'll see 4 MCP tools available, indicating successful loading. โ
โ๏ธ Environment Variables
| Variable |
Description |
Default |
Required |
MUSICMCP_API_KEY |
Your MusicMCP.AI API key |
- |
โ
Yes |
MUSICMCP_API_URL |
MusicMCP.AI API base URL |
https://www.musicmcp.ai/api |
โ No |
TIME_OUT_SECONDS |
Timeout for music generation (seconds) |
600 (10 min) |
โ No |
๐ ๏ธ Available Tools
1. ๐ผ Generate Prompt Song (Inspiration Mode)
Generate AI music from simple text descriptions. The AI automatically creates the title, lyrics, and style.
๐ฐ Cost: 5 credits per generation (creates 2 songs)
Parameters:
| Name |
Type |
Required |
Description |
prompt |
str |
โ
|
Simple description of the music theme (1โ1200 characters) |
instrumental |
bool |
โ
|
Whether to generate instrumental music only |
style |
str |
โ |
Music style (e.g., "ambient", "pop", "rock") |
Example Prompts:
"Help me generate a song about a peaceful morning"
"Want a song that expresses longing"
"Create music about friendship"
Output Example:
โ
Song 1 generated successfully!
๐ Title: Peaceful Morning
๐ ID: c7630638-b8ba-4984-876b-6dd7e6eeb796
๐ Download URL: https://cdn.musicmcp.ai/songs/abc123.mp3
๐ผ๏ธ Cover Image: https://cdn.musicmcp.ai/images/abc123.jpg
โฑ๏ธ Duration: 180s
๐ต Style Tags: ambient, meditation, peaceful
๐น Instrumental: No
๐
Created: 2025-01-15T10:30:45.123Z
๐ Lyrics:
[Verse]
Gentle sunlight fills the room
Morning dew and sweet perfume
Birds are singing their refrain
Another peaceful day again
You can download or play the audio from the URL above.
โ
Song 2 generated successfully!
๐ Title: Morning Peace
๐ ID: d8741749-c9cb-5095-987c-7ee8f7ffb907
๐ Download URL: https://cdn.musicmcp.ai/songs/def456.mp3
๐ผ๏ธ Cover Image: https://cdn.musicmcp.ai/images/def456.jpg
โฑ๏ธ Duration: 213s
๐ต Style Tags: ambient, meditation, peaceful
๐น Instrumental: No
๐
Created: 2025-01-15T10:30:45.126Z
๐ Lyrics:
[Verse]
Calm and quiet, soft and still
Peaceful thoughts upon the hill
Nature's beauty all around
Gentle whispers, soothing sound
You can download or play the audio from the URL above.
2. ๐ต Generate Custom Song (Custom Mode)
Generate AI music with specific lyrics, title, and style parameters that you provide.
๐ฐ Cost: 5 credits per generation (creates 2 songs)
Parameters:
| Name |
Type |
Required |
Description |
title |
str |
โ
|
Song title |
instrumental |
bool |
โ
|
Whether to generate instrumental music only |
lyric |
str |
โ |
Complete lyrics content (not required when instrumental is true) |
tags |
str |
โ |
Music style tags (e.g., 'pop', 'rock', 'folk') |
Example Usage:
Please help me generate a song:
Title: Summer Dreams
Lyrics: [complete lyrics content]
Style: folk
Or for instrumental:
Title: Summer Breeze
Instrumental: yes
Style: ambient
Output Example:
โ
Custom song 'Summer Dreams' (version 1) generated successfully!
๐ Title: Summer Dreams
๐ ID: d1ed75a7-3e0b-42c6-b2be-7631204074fe
๐ Download URL: https://cdn.musicmcp.ai/songs/xyz789.mp3
๐ผ๏ธ Cover Image: https://cdn.musicmcp.ai/images/xyz789.jpg
โฑ๏ธ Duration: 195s
๐ต Style Tags: folk, acoustic, summer
๐น Instrumental: No
๐
Created: 2025-01-15T11:45:30.456Z
๐ Lyrics:
[Verse]
Walking through the summer fields
Golden wheat and nature's yields
Sunshine dancing on my face
Summer's warm and sweet embrace
You can download or play the audio from the URL above.
โ
Custom song 'Summer Dreams' (version 2) generated successfully!
๐ Title: Summer Dreams
๐ ID: e2fe86b8-4f1c-53d7-c3cf-8742305185gf
๐ Download URL: https://cdn.musicmcp.ai/songs/uvw012.mp3
๐ผ๏ธ Cover Image: https://cdn.musicmcp.ai/images/uvw012.jpg
โฑ๏ธ Duration: 203s
๐ต Style Tags: folk, acoustic, summer
๐น Instrumental: No
๐
Created: 2025-01-15T11:45:30.459Z
๐ Lyrics:
[Verse]
Walking through the summer fields
Golden wheat and nature's yields
Sunshine dancing on my face
Summer's warm and sweet embrace
You can download or play the audio from the URL above.
3. โ
Check Credit Balance
Check if your API key is valid and see your remaining credits.
๐ฐ Cost: Free
Example Usage:
"Check my credit balance"
"How many credits do I have left?"
4. ๐ฅ Check API Health
Monitor the health status of the MusicMCP.AI API service.
๐ฐ Cost: Free
Example Usage:
"Check API service status"
๐ฐ Credits & Pricing
| Operation |
Credits Cost |
Output |
| Generate Inspiration Music |
5 credits |
2 songs |
| Generate Custom Music |
5 credits |
2 songs |
| Query Music Status |
0 credits (Free) |
- |
| Check Credit Balance |
0 credits (Free) |
- |
| API Health Check |
0 credits (Free) |
- |
๐ก Example Usage
โ ๏ธ Note
MusicMCP.AI credits are required to use the music generation tools.
๐ผ Inspiration Mode
- "Please help me generate a song about a peaceful morning"
- "Want a song that expresses longing"
- "Create music about friendship"
- "Generate an ambient music track"
๐ต Custom Mode
- "Please help me generate a song, Title: Summer Dreams, Lyrics: [complete lyrics], Style: folk"
- "Create a song, Title: Spring Promise, Lyrics: [complete lyrics], Pop style"
- "Generate an instrumental song, Title: Ocean Breeze, Style: ambient"
๐ Management Functions
- "Check my credit balance"
- "How many credits do I have left?"
- "Check API service status"
๐ฆ Installation
Using uv (Recommended)
uvx aimusic-mcp
Using pip
pip install aimusic-mcp
๐ API Integration
This MCP server integrates with MusicMCP.AI's RESTful API:
| Method |
Endpoint |
Description |
POST |
/music/generate/inspiration |
Create music generation task (inspiration mode) |
POST |
/music/generate/custom |
Create custom music generation task |
POST |
/music/generate/query |
Query music status (batch query supported) |
GET |
/credit |
Check credit balance |
GET |
/health |
Check API service health |
๐ Async API Workflow
Music generation is asynchronous. The MCP server handles this automatically.
Step 1 โ Submit Generation Request
POST /music/generate/inspiration or /music/generate/custom
โ Returns: {"code": 200, "data": {"ids": ["id1", "id2"]}}
Step 2 โ Automatic Polling (handled internally by MCP)
POST /music/generate/query with {"ids": ["id1", "id2"]}
โ Polls every 2 seconds until status = 1 (completed)
โ Song status: 0 = Failed, 1 = Completed, 2 = In Progress
Step 3 โ Return Complete Song Information
Once all songs are completed, returns full details:
- songName, songUrl, imgUrl, duration, tags, etc.
Behind the Scenes:
- User calls
generate_prompt_song() or generate_custom_song()
- MCP sends generation request โ receives 2 song IDs
- MCP automatically polls
/music/generate/query every 2 seconds
- When all songs complete (status=1), returns download URLs
- Default timeout: 10 minutes (configurable via
TIME_OUT_SECONDS)
โ ๏ธ Important Notes
- โฑ๏ธ Generation typically takes 2โ5 minutes per song
- ๐ The MCP server handles all polling automatically
- ๐ต Each generation always creates 2 song variations
- ๐ฐ Credits (5) are deducted when the generation request succeeds
- โ ๏ธ If generation fails, credits are NOT consumed
๐ Troubleshooting
Common Issues
1. API Key Error
Ensure MUSICMCP_API_KEY is set correctly.
- Use the
check_credit_balance tool to check your key
2. Insufficient Credits (402 Error)
You don't have enough credits.
- Check your balance at https://www.musicmcp.ai
- Recharge your account
3. Timeout Errors
Increase TIME_OUT_SECONDS if music generation takes longer.
๐ Logs
When running with Claude Desktop, logs can be found at:
- Windows:
%APPDATA%\Claude\logs\mcp-server-MusicMCP.AI.log
- macOS:
~/Library/Logs/Claude/mcp-server-MusicMCP.AI.log
๐งช Development
Running Tests
pytest tests/
Local Development
python -m musicmcp_ai_mcp.api
Code Structure
musicmcp_ai_mcp/
โโโ __init__.py # Package initialization
โโโ __main__.py # CLI entry point
โโโ api.py # Core MCP server implementation (430 lines)
๐ Links
- Platform: https://www.musicmcp.ai
- Documentation: https://www.musicmcp.ai/docs
- Support: support@musicmcp.ai
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
Made with โค๏ธ by the MusicMCP.AI Team
Transform your ideas into music with AI