AI-Powered Music Generation with Model Context Protocol
Official MusicMCP.AI Model Context Protocol (MCP) server that enables seamless interaction with our advanced AI music generation platform. This server allows MCP clients like Claude Desktop, OpenAI Agents and others to generate AI music through natural language commands.
โจ Features
๐ผ AI Music Generation: Generate songs based on text prompts using MusicMCP.AI's state-of-the-art AI 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 music or full songs with vocals
โ Credit Balance Check: Check your API key validity and remaining credits
๐ฅ Health Monitoring: Check API service health status
๐ Quickstart with Claude Desktop
1. Get Your API Key
Obtain your API key from MusicMCP.AI Platform.
2. Install uv
3. Configure Claude
Go to Claude > Settings > Developer > Edit Config > and add:
4. Restart Claude
Restart the Claude app and you'll see 4 MCP tools available, indicating successful loading.
โ๏ธ Environment Variables
Variable | Description | Default | Required |
| Your MusicMCP.AI API key | โ | โ Yes |
| MusicMCP.AI API base URL |
| โ No |
| Timeout for music generation in seconds |
(10 min) | โ No |
๐ ๏ธ Available Tools
1. ๐ผ Generate Prompt Song (Inspiration Mode)
Generate AI music based on simple text descriptions. AI automatically creates title, lyrics, and style.
Cost: 5 credits per generation (creates 2 songs)
Parameters:
prompt(str): Simple description of the music theme (1โ1200 characters)instrumental(bool): Whether to generate instrumental music onlystyle(str, optional): Music style (e.g.,"ambient","pop","rock")
Example prompts:
Help me generate a song about a peaceful morningWant a song that expresses longingCreate music about friendship
Output example:
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:
title(str): Song title (required)instrumental(bool): Whether to generate instrumental music only (required)lyric(str, optional): Complete lyrics content (not required wheninstrumentalis true)tags(str, optional): Music style tags (e.g.,"pop","rock","folk")
Example usage:
Or for instrumental:
Output example:
3. โ Check Credit Balance
Check if your API key is valid and see your remaining credits.
Cost: Free
Example usage:
Check my credit balanceHow 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 | โ |
Check Credit Balance | 0 credits | โ |
API Health Check | 0 credits | โ |
๐ก 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 morningWant a song that expresses longingCreate music about friendshipGenerate an ambient music track
Custom Mode
Please help me generate a song, Title: Summer Dreams, Lyrics: [complete lyrics], Style: folkCreate a song, Title: Spring Promise, Lyrics: [complete lyrics], Pop styleGenerate an instrumental song, Title: Ocean Breeze, Style: ambient
Management Functions
Check my credit balanceHow many credits do I have left?Check API service status
๐ฆ Installation
Using uv (Recommended)
Using pip
๐ API Integration
This MCP server integrates with MusicMCP.AI's RESTful API:
POST /music/generate/inspiration: Create music generation task (inspiration mode)POST /music/generate/custom: Create custom music generation taskPOST /music/generate/query: Query music status (batch query supported)GET /credit: Check credit balanceGET /health: Check API service health
๐ Async API Workflow
Music generation is asynchronous. The MCP server handles this automatically:
Step 1: Submit Generation Request
Call:
POST /music/generate/inspirationor
POST /music/generate/custom
Response example:
Step 2: Automatic Polling (handled internally by MCP)
MCP calls:
Polls every 2 seconds until
status = 1(completed)Song status:
0= Failed1= Completed2= In Progress
Step 3: Return Complete Song Information
When all songs complete, the MCP server returns full details:
songName,songUrl,imgUrl,duration,tags, etc.
Behind the scenes:
User calls
generate_prompt_song()orgenerate_custom_song()MCP sends generation request โ receives 2 song IDs
MCP automatically polls
/music/generate/queryevery 2 secondsWhen all songs complete (
status = 1), MCP returns download URLs and metadata
Defaults & behavior:
โฑ๏ธ Generation typically takes 2โ5 minutes per song
๐ MCP handles polling automatically
๐ต Each generation always creates 2 song variations
๐ฐ Credits (5) are deducted when 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 verify.
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.logmacOS:
~/Library/Logs/Claude/mcp-server-MusicMCP.AI.log
๐งช Development
Running Tests
Local Development
Code Structure
๐ Links
Platform: https://www.musicmcp.ai
Documentation: https://www.musicmcp.ai/docs
Support: mailto: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.
This server cannot be installed