MusicMCP.AI MCP Server
Enables AI-powered music generation through natural language commands, supporting inspiration and custom modes with dual song outputs.
README
<div align="center">
🎵 MusicMCP.AI MCP Server
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.
</div>
✨ 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
- ✅ API Key Validation: Check your API key validity and remaining credits
- 🏥 Health Monitoring: Check API service health status
- 📊 API Information: Get detailed information about available endpoints and costs
🚀 Quickstart with Claude Desktop
- Get Your API Key: Obtain your API key from MusicMCP.AI Platform
- Install uv: Install the Python package manager with
curl -LsSf https://astral.sh/uv/install.sh | sh - 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"
}
}
}
}
- Restart Claude: Restart the Claude app and you'll see 5 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 in seconds | 600 (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 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 Preview:
[Verse]
Gentle sunlight fills the room
Morning dew and sweet perfume...
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 Preview:
[Verse]
Calm and quiet, soft and still
Peaceful thoughts upon the hill...
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:
title(str): Song title (required)instrumental(bool): Whether to generate instrumental music only (required)lyric(str, optional): Complete lyrics content (not required when instrumental is true)tags(str, optional): 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 Preview:
[Verse]
Walking through the summer fields
Golden wheat and nature's yields...
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 Preview:
[Verse]
Walking through the summer fields
Golden wheat and nature's yields...
You can download or play the audio from the URL above.
3. ✅ Validate API Key
Check if your API key is valid and see your remaining credits.
Cost: Free
Example Usage:
"Validate my API key"
"Check my credit balance"
4. 🏥 Check API Health
Monitor the health status of the MusicMCP.AI API service.
Cost: Free
Example Usage:
"Check API service status"
5. 📊 Get API Info
Get detailed information about the API including rate limits and documentation.
Cost: Free
Example Usage:
"Get API information"
💰 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) | - |
| Validate API Key | 0 credits (Free) | - |
| API Health Check | 0 credits (Free) | - |
| Get API Info | 0 credits (Free) | - |
💡 Example Usage
⚠️ Note: MusicMCP.AI credits are required to use the music generation tools.
Try asking Claude:
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:
- "Validate my API key"
- "Check how many credits I have left"
- "Check API service status"
📦 Installation
Using uv (Recommended)
uvx aimusic-mcp
Using pip
pip install aimusic-mcp
From Source
git clone https://github.com/ai-music-repo/aimusic-mcp-tool.git
cd aimusic-mcp-tool
pip install -e .
Quick Install Script
chmod +x install.sh
./install.sh
🔌 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)POST /validate: Validate API key and check creditsGET /health: Check API service healthGET /info: Get API information
🔄 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()orgenerate_custom_song() - MCP sends generation request → receives 2 song IDs
- MCP automatically polls
/music/generate/queryevery 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 generation request succeeds
- ⚠️ If generation fails, credits are NOT consumed
🐛 Troubleshooting
Common Issues
-
API Key Error: Ensure
MUSICMCP_API_KEYis set correctly- Use the
validate_api_keytool to check your key
- Use the
-
Insufficient Credits (402 Error): You don't have enough credits
- Check your balance at https://www.musicmcp.ai
- Recharge your account
-
Timeout Errors: Increase
TIME_OUT_SECONDSif 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
- GitHub: https://github.com/ai-music-repo/aimusic-mcp-tool
- Issues: https://github.com/ai-music-repo/aimusic-mcp-tool/issues
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
<div align="center">
Made with ❤️ by the MusicMCP.AI Team
Transform your ideas into music with AI
</div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。