A Model Context Protocol (MCP) server that provides AI music generation capabilities using the Suno API. This server allows Claude and other MCP clients to generate music, retrieve track information, and manage API credits through a simple tool interface.
✨ Features automatic Docker builds via GitHub Actions - always get the latest version with docker pull!
- Generate Music: Create AI-generated music from text prompts with customizable parameters
- Track Status Monitoring: Check generation progress and retrieve completed track information using task IDs
- Track Information: Retrieve detailed information about generated tracks including status, URLs, and metadata using track IDs
- Credit Management: Check API credit balance and usage statistics
- Multiple Model Versions: Support for Suno v3.5, v4, v4.5, v4.5plus, and v5 models (v5 recommended for superior quality and speed)
- Custom Mode: Fine-tune generation with exact lyrics, specific genre tags, and advanced controls
- Advanced Controls: Style weighting, weirdness constraint, vocal gender selection, and more
- Option 1 (Docker - Recommended): Docker and Docker Compose installed
- Option 2 (Native Python): Python 3.10 or higher
- A Suno API key (obtain from sunoapi.org)
- An MCP-compatible client: Claude Desktop or Claude Code
Pull the pre-built image directly from GitHub Container Registry - no code or build required!
- Pull the Docker image:
docker pull ghcr.io/codekeanu/suno-mcp:latest- Create a
.envfile with your API key:
# Create a directory for your config
mkdir suno-mcp-config
cd suno-mcp-config
# Create .env file
cat > .env << EOF
SUNO_API_KEY=your_actual_api_key_here
SUNO_API_BASE_URL=https://api.sunoapi.org
EOFThat's it! Skip to the Usage section to configure Claude Desktop or Claude Code.
Build the Docker image yourself from source code.
- Clone this repository:
git clone https://github.com/CodeKeanu/suno-mcp.git
cd suno-mcp- Configure your API key:
cp .env.example .env- Edit
.envand add your Suno API key:
SUNO_API_KEY=your_actual_api_key_here
SUNO_API_BASE_URL=https://api.sunoapi.org
- Build the Docker image:
docker build -t suno-mcp-server:latest .
# Or use docker-compose:
docker-compose buildNote: If you build from source, use suno-mcp-server:latest in the configuration examples below instead of ghcr.io/codekeanu/suno-mcp:latest.
- Clone this repository:
git clone https://github.com/CodeKeanu/suno-mcp.git
cd suno-mcp- Install dependencies:
pip install -r requirements.txt- Configure your API key:
cp .env.example .env- Edit
.envand add your Suno API key:
SUNO_API_KEY=your_actual_api_key_here
SUNO_API_BASE_URL=https://api.sunoapi.org
Claude Desktop is the official desktop application for Claude that supports MCP servers.
-
Locate your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Add the Suno MCP server configuration (replace
/absolute/path/to/.envwith your actual path):
{
"mcpServers": {
"suno": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--env-file",
"/absolute/path/to/.env",
"ghcr.io/codekeanu/suno-mcp:latest"
]
}
}
}Example paths:
- macOS:
/Users/yourusername/suno-mcp-config/.env - Windows:
C:\\Users\\yourusername\\suno-mcp-config\\.env - Linux:
/home/yourusername/suno-mcp-config/.env
Important Notes:
- Use absolute paths (full path from root), not relative paths
- On Windows, use double backslashes (
\\) or forward slashes (/) - Ensure Docker Desktop is running before starting Claude Desktop
- The
.envfile must contain your valid Suno API key - The image will be automatically pulled from GitHub Container Registry on first run
-
Restart Claude Desktop completely for changes to take effect
-
Test the integration by asking Claude:
- "Can you check my Suno API credits?"
- "Generate a short happy instrumental song"
Alternative: Environment Variables (No .env file needed)
If you prefer not to use a .env file, you can pass the API key directly:
{
"mcpServers": {
"suno": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"SUNO_API_KEY=your_actual_api_key_here",
"-e",
"SUNO_API_BASE_URL=https://api.sunoapi.org",
"ghcr.io/codekeanu/suno-mcp:latest"
]
}
}
}For native Python (without Docker):
{
"mcpServers": {
"suno": {
"command": "python",
"args": ["/absolute/path/to/suno-mcp/server.py"],
"env": {
"SUNO_API_KEY": "your_actual_api_key_here",
"SUNO_API_BASE_URL": "https://api.sunoapi.org"
}
}
}
}Claude Code is a CLI tool for software development with Claude.
Option 1: Using Claude Code Settings UI
- Open Claude Code settings
- Navigate to MCP Servers section
- Add a new server with:
- Name:
suno - Command:
docker - Arguments:
["run", "--rm", "-i", "--env-file", "/absolute/path/to/.env", "ghcr.io/codekeanu/suno-mcp:latest"] - Replace
/absolute/path/to/.envwith your actual path
- Name:
Option 2: Manual Configuration
Add to your MCP settings file (typically ~/.config/claude-code/mcp_settings.json):
{
"mcpServers": {
"suno": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--env-file",
"/absolute/path/to/.env",
"ghcr.io/codekeanu/suno-mcp:latest"
]
}
}
}Important: Replace /absolute/path/to/.env with the actual path to your .env file.
Docker Flags Explained:
--rm: Automatically remove container when it exits-i: Keep stdin open for MCP stdio communication--env-file: Load environment variables from.envfile (keeps API key secure)
Option 1: Using Claude Code Settings UI
- Open Claude Code settings
- Navigate to MCP Servers section
- Add a new server with:
- Name:
suno - Command:
python - Arguments:
["/absolute/path/to/suno-mcp/server.py"] - Environment Variables:
SUNO_API_KEY: Your API keySUNO_API_BASE_URL:https://api.sunoapi.org
- Name:
Option 2: Manual Configuration
Add to your MCP settings file:
{
"mcpServers": {
"suno": {
"command": "python",
"args": ["/absolute/path/to/suno-mcp/server.py"],
"env": {
"SUNO_API_KEY": "your_actual_api_key_here",
"SUNO_API_BASE_URL": "https://api.sunoapi.org"
}
}
}
}Important:
- Replace
/absolute/path/to/suno-mcp/server.pywith your actual path - Restart Claude Code after adding the configuration
The server exposes 4 MCP tools for music generation and management:
Generate AI music from a text prompt with extensive customization options.
Parameters:
Core Parameters:
prompt(conditional): Text description/lyrics for the music- Custom Mode with vocals: Used as exact lyrics (max 3000-5000 chars depending on model)
- Non-custom Mode: Used as core idea for auto-generated lyrics (max 500 chars)
- Custom Mode instrumental: Not required if
make_instrumental=true
make_instrumental(optional, default: false): Generate instrumental only without vocalsmodel_version(optional, default: "v3.5"): AI model version- Options: "v3.5", "v4", "v4.5", "v4.5plus", "v5"
- Recommendation: Use "v5" for superior musical expression and faster generation
wait_audio(optional, default: true): Wait for generation to complete before returning
Custom Mode Parameters:
custom_mode(optional, default: false): Enable advanced control mode- When enabled, requires
styleandtitleparameters - Allows exact lyrics specification and fine-grained style control
- When enabled, requires
style(required if custom_mode=true): Music style/genre tags (max 200-1000 chars)- Example: "orchestral epic, cinematic, powerful strings, dramatic choir"
title(required if custom_mode=true): Song title (max 80 chars)
Advanced Parameters:
callback_url(optional): Webhook URL for completion notification- Note: The Suno API may require this parameter. If generation fails with "Please enter callBackUrl", provide a URL (e.g., "https://example.com/webhook")
persona_id(optional): Persona identifier for stylistic influence (Custom Mode only)negative_tags(optional): Styles or traits to exclude (e.g., "aggressive, heavy metal")vocal_gender(optional): Preferred vocal gender ("m" or "f")style_weight(optional): Weight of style guidance (0.00-1.00)- Higher values adhere more strictly to the specified style
weirdness_constraint(optional): Creative deviation tolerance (0.00-1.00)- Higher values allow more experimental/unusual results
audio_weight(optional): Input audio influence weighting (0.00-1.00)
Returns:
- Task ID for async generation tracking
- Track information if
wait_audio=true
Example:
Generate a calm piano meditation piece using v5 model
Get the status of a music generation task and retrieve track information once complete.
Parameters:
task_id(required): The task ID returned fromgenerate_music
Returns:
- Task status (e.g., "TEXT_SUCCESS")
- Operation type and model information
- Track details including IDs, titles, audio URLs, and metadata when generation is complete
Example:
Check status of task: 684b694f002afbb35b49994b32a6a01e
Note: This tool uses task IDs (not track IDs). Use this to monitor async generations started with wait_audio=false or to retrieve information about recently completed generations.
Get detailed information about specific tracks using track IDs.
Parameters:
track_ids(required): Array of track IDs to retrieve information for
Returns:
- Detailed track information including status, URLs, duration, tags, and creation time
Example:
Get information for tracks: ["7752c889-3601-4e55-b805-54a28a53de85", "be973545-05f9-4a00-9177-81d4ce0ed5c1"]
Note: This tool uses specific track IDs (not task IDs). Track IDs are returned from generate_music or get_task_status.
Check your Suno API account credit balance.
Parameters: None
Returns:
- Remaining API credits
Example:
Check my Suno API credits
-
Generate Music with v5 Model:
Generate an epic orchestral battle theme using v5 model in custom mode- Claude will use custom mode with appropriate style tags
- Returns task ID and track information
- Uses v5 model for best quality
-
Check Credits:
How many Suno credits do I have left?
-
Start Async Generation:
Generate a 3-minute ambient soundscape, don't wait for completion- Returns task ID immediately
- Generation continues in background
-
Monitor Progress:
Check status of task: [task-id]- Shows generation progress
- Returns track IDs and URLs when complete
-
Get Track Details:
Get information for tracks: ["track-id-1", "track-id-2"]- Retrieves detailed metadata and download URLs
-
Task ID: Returned from
generate_music, used withget_task_status- Example:
684b694f002afbb35b49994b32a6a01e - Used to monitor generation progress
- Example:
-
Track ID: Specific to each generated song, used with
get_music_info- Example:
7752c889-3601-4e55-b805-54a28a53de85 - Suno typically generates 2 tracks per request
- Each track has its own unique ID
- Example:
This section covers Docker-specific usage and management.
# Using Docker directly
docker build -t suno-mcp-server:latest .
# Or using Docker Compose (if installed)
docker-compose build
# OR (newer plugin syntax)
docker compose buildFor testing or standalone use:
# Run with environment file
docker run --rm -i --env-file .env suno-mcp-server:latest
# Or pass environment variables directly
docker run --rm -i \
-e SUNO_API_KEY=your_api_key_here \
-e SUNO_API_BASE_URL=https://api.sunoapi.org \
suno-mcp-server:latestThe Docker container includes automatic health monitoring:
# Check container health status
docker ps
# View health check logs
docker inspect --format='{{json .State.Health}}' suno-mcp-server
# Manual health check
docker exec suno-mcp-server python healthcheck.pyHealth checks verify:
- Environment variables are properly set
- Required Python modules are available
- Suno client can initialize correctly
# Build the image
docker-compose build
# Start the server (for testing)
docker-compose up
# View logs
docker-compose logs -f
# Stop the server
docker-compose down
# Rebuild after code changes
docker-compose build --no-cache- Never commit
.envto version control - It contains your API key - Use
.envfile - Keeps secrets out of command history and scripts - Non-root execution - Container runs as
appuser(UID 1000) - Minimal image - Based on
python:3.12-slimto reduce attack surface - Read-only filesystem - Optional; uncomment in
docker-compose.ymlif needed
The docker-compose.yml includes resource limits:
- CPU limit: 1.0 cores
- Memory limit: 512MB
- CPU reservation: 0.5 cores
- Memory reservation: 256MB
Adjust these in docker-compose.yml if needed for your environment.
After making code changes:
# Rebuild the image
docker-compose build
# Or rebuild without cache
docker-compose build --no-cache
# Restart Claude Code to pick up the new image# Check health check output
docker logs suno-mcp-server
# Run health check manually
docker run --rm -i --env-file .env suno-mcp-server:latest python healthcheck.py- Ensure Docker is running:
sudo systemctl start docker - Check Docker permissions:
sudo usermod -aG docker $USER(then log out/in)
- Check logs:
docker logs suno-mcp-server - Verify
.envfile exists and contains valid API key - Ensure image built successfully:
docker images | grep suno-mcp-server
- Verify
.envfile path in docker-compose.yml or docker run command - Check file permissions:
ls -la .env - Ensure
.envfile format is correct (no quotes around values)
- Docker:
- Ensure
.envfile exists in your project directory - Verify the absolute path to
.envin your MCP configuration is correct - Check that the
.envfile contains:SUNO_API_KEY=your_actual_key - Make sure Docker can access the file (permissions)
- Ensure
- Native:
- Ensure your
.envfile exists and contains a valid API key - Or verify the
SUNO_API_KEYis set in theenvsection of your MCP configuration
- Ensure your
- Verify your API key is correct and active
- Check that your API key has sufficient credits
- The Suno API requires a
callback_urlparameter for some operations - Provide a webhook URL (can be a placeholder like "https://example.com/webhook")
- Claude Code will automatically handle this when using the generate_music tool
- Music generation can take time; the default timeout is 5 minutes
- For longer generations, set
wait_audio: falseand useget_task_statusto poll for completion
- When using custom mode, both
styleandtitleparameters are required - Provide genre/style tags (e.g., "epic orchestral, cinematic")
- Always specify model version: Use
model_version: "v5"for best results - Use custom mode for precise control: Enables exact lyrics and detailed style specification
- Monitor credits regularly: Each generation consumes credits (typically 6 credits per generation)
- Suno generates 2 tracks: Each request produces 2 variations of your prompt
- Use task IDs vs track IDs correctly:
- Task IDs: For checking generation status
- Track IDs: For retrieving specific track information
- Server Name:
suno-mcp-server - Version: 1.0.0
- Protocol: Model Context Protocol (MCP)
- API: Suno API v1
- Python Version: 3.10+
- Async Support: Full async/await implementation using httpx
/api/v1/generate- Music generation/api/v1/generate/record-info- Task/track status retrieval/api/v1/generate/credit- Credit balance check
The server automatically converts user-friendly version names to API format:
v3.5→V3_5(chirp-v3-5)v4→V4(chirp-v4)v4.5→V4_5(chirp-v4-5)v4.5plus→V4_5PLUS(chirp-v4-5-plus)v5→V5(chirp-crow) - Recommended
- Standard generation: ~6 credits per request
- Generates 2 track variations per request
- Costs may vary based on model version and generation length
This server uses the Suno API v1. For more information:
- Documentation: https://docs.sunoapi.org/
- API Key Management: https://sunoapi.org/api-key
- Support: support@sunoapi.org
Contributions are welcome! Please feel free to submit issues or pull requests.
This MCP server is provided as-is for use with the Suno API. Please refer to Suno's terms of service for API usage guidelines.
For issues related to:
- This MCP Server: Open an issue
- Suno API: Visit https://docs.sunoapi.org/ or contact support@sunoapi.org
- MCP Protocol: Visit https://modelcontextprotocol.io/
Built with ❤️ using the Model Context Protocol