Skip to main content
Glama

Suno 音乐生成器 MCP 服务器

这是一个基于 Model Context Protocol (MCP) 的服务器,它允许您通过调用工具来使用 Suno API 生成音乐。

✨ 特性

  • 通过 MCP 与 Suno API 交互。

  • 支持自定义模式(提供歌词、风格、标题)和灵感模式(提供描述)。

  • 支持继续生成已有的歌曲片段。

  • 自动轮询任务状态并在完成后返回音频 URL。

  • 可配置的 API Key 和模型版本。

Related MCP server: StreamerSongList MCP Server

🚀 开始使用

📋 先决条件

  • Node.js (建议使用 LTS 版本)

  • npm (通常随 Node.js 一起安装) 或 yarn

⚙️ 安装

  1. 克隆此仓库 (如果您还没有的话):

    git clone <your-repository-url>
    cd <repository-directory>
  2. 安装项目依赖:

    npm install
    # 或者使用 yarn
    # yarn install

🔑 配置

  1. 在项目根目录下创建一个名为 config.env 的文件。

  2. 在该文件中添加您的 Suno API Key:

    SunoKey=sk_YOUR_SUNO_API_KEY_HERE

    sk_YOUR_SUNO_API_KEY_HERE 替换为您真实的 Suno API Key。

▶️ 运行 MCP 服务器

要启动 MCP 服务器,请在项目根目录下运行:

npm start
# 或者,如果您在 package.json 中定义了 "dev" 脚本并希望使用 ts-node-dev 进行热重载开发:
# npm run dev
# 或者直接运行编译后的 JavaScript 文件:
# node build/index.js

服务器启动后,它将通过标准输入/输出 (stdio) 与兼容的 MCP 客户端进行通信。

🔌 在 MCP 客户端中部署

要在您的 MCP 客户端(例如一个支持 MCP 的 AI 助手或开发工具)中使用此服务器,您通常需要在客户端的配置文件中添加一个服务器条目。以下是一个示例配置,请根据您的客户端具体要求进行调整:

{
  "YOUR_UNIQUE_SERVER_ID": { // 替换为您客户端生成的唯一 ID
    "name": "Suno-MCP",     // 您为此服务器指定的名称
    "type": "stdio",        // 通信类型,对于此服务器是 "stdio"
    "description": "让AI唱歌", // 服务器的简短描述
    "isActive": true,       // 是否激活此服务器
    "command": "node",      // 用于启动服务器的命令
    "args": [
      "<path-to-your-project>/MCP-Suno/build/index.js" // 指向编译后的 index.js 文件的绝对或相对路径
    ],
    "env": {
      // 环境变量可以传递给服务器进程
      // 如果您在此处设置了 SunoKey,它可能会覆盖 config.env 中的值
      // "SunoKey": "sk_YOUR_SUNO_API_KEY_FROM_CLIENT_CONFIG"
    },
    "cwd": "<path-to-your-project>/MCP-Suno" // 可选:设置服务器的工作目录,通常是项目根目录
  }
}

重要提示:

  • YOUR_UNIQUE_SERVER_ID: 这通常由您的 MCP 客户端自动生成或要求您提供一个唯一的标识符。

  • command: 对于 Node.js 项目,通常是 node

  • args: 数组中的第一个参数应该是到编译后的 build/index.js 文件的路径。请确保将 <path-to-your-project> 替换为您的实际项目路径。

  • env: 您可以在这里设置环境变量。服务器脚本 (index.ts) 会尝试从项目根目录下的 config.env 文件加载 SunoKey。如果客户端配置中的 env 也设置了 SunoKey,其行为(是否覆盖)可能取决于 Node.js 处理环境变量的优先级和 dotenv 包的配置。为了确保 SunoKey 被正确加载,建议主要通过项目根目录下的 config.env 文件进行配置,如“🔑 配置”部分所述。

  • cwd: 设置工作目录为项目根目录(包含 build 文件夹和 config.env 的目录)通常是个好主意,以确保相对路径(如 ../config.env 相对于 build/index.js)能正确解析。

请查阅您的 MCP 客户端文档以获取有关如何添加和配置 MCP 服务器的详细说明。

🛠️ 工具说明

此 MCP 服务器提供以下工具:

generate_music_suno

使用 Suno API 生成歌曲。

描述:

Generates a song using the Suno API. Provide lyrics, style, and title for custom mode, or a description for inspiration mode. Returns the audio URL upon completion. Polling for results may take a few minutes.

When returning an audio URL, please use the following HTML format for user convenience:
```html
<audio controls>
  <source src="YOUR_AUDIO_URL_HERE" type="audio/mpeg">
</audio>
<br>
<a href="YOUR_AUDIO_URL_HERE" download="SONG_TITLE.mp3">
  点击这里下载喵!
</a>

**输入参数 (`inputSchema`):**

*   `prompt` (string): 歌词内容。自定义模式下必需。示例: `'[Verse 1]\nUnder the starry sky...'`
*   `tags` (string): 音乐风格标签,逗号分隔。自定义模式下必需。示例: `'acoustic, folk, pop'`
*   `title` (string): 歌曲标题。自定义模式下必需。示例: `'Starry Night Serenade'`
*   `mv` (string, 可选): 模型版本。可选值: `"chirp-v3-0"`, `"chirp-v3-5"`, `"chirp-v4"`。默认为 `'chirp-v4'`。
*   `make_instrumental` (boolean, 可选): 是否生成纯音乐。默认为 `false`。
*   `gpt_description_prompt` (string, 可选): 灵感模式的描述。如果提供此参数,则 `prompt`, `tags`, 和 `title` 不是用户严格要求的。示例: `'A cheerful upbeat song about a sunny day.'`
*   `task_id` (string, 可选): 要继续的先前歌曲的任务 ID。如果提供,则 `continue_at` 和 `continue_clip_id` 也需要。
*   `continue_at` (number, 可选): 从歌曲的哪个时间点(秒)开始继续。需要 `task_id` 和 `continue_clip_id`。
*   `continue_clip_id` (string, 可选): 要继续的歌曲片段的剪辑 ID。需要 `task_id` 和 `continue_at`。

**验证逻辑:**
*   如果未提供 `gpt_description_prompt`,则 `prompt`, `tags`, 和 `title` 都是必需的。
*   如果提供了 `task_id`,则 `continue_at` 和 `continue_clip_id` 也必须提供。

**输出:**
成功时,返回一个包含音频 URL 的文本内容。如果发生错误,将返回错误信息。

## 💡 示例 MCP 请求

**生成自定义歌曲:**
```json
{
  "type": "call_tool",
  "params": {
    "name": "generate_music_suno",
    "arguments": {
      "prompt": "[Verse 1]\nIn the digital realm, where code streams flow,\nA kitty coder, with a vibrant glow.\n[Chorus]\nMeow, meow, MCP, oh so grand,\nGenerating tunes across the land!",
      "tags": "electronic, upbeat, synthwave",
      "title": "MCP Kitty's Anthem",
      "mv": "chirp-v4"
    }
  }
}

使用灵感模式生成歌曲:

{
  "type": "call_tool",
  "params": {
    "name": "generate_music_suno",
    "arguments": {
      "gpt_description_prompt": "A lofi chill beat for late night coding sessions",
      "mv": "chirp-v3-5"
    }
  }
}

继续生成歌曲:

{
  "type": "call_tool",
  "params": {
    "name": "generate_music_suno",
    "arguments": {
      "task_id": "your_previous_task_id_here",
      "continue_at": 60,
      "continue_clip_id": "your_previous_clip_id_here",
      "mv": "chirp-v4"
      // prompt, tags, title might be needed by Suno API for continuation,
      // or it might infer from the original task.
      // Check Suno API documentation for specifics on continuation.
    }
  }
}

🤝 贡献

欢迎提交 Pull Request 或 Issue 来改进此项目!

📄 许可证

(根据您的项目选择一个许可证,例如 MIT, Apache 2.0 等) 例如: This project is licensed under the MIT License.

Available Tools

1 tool
generate_music_sunoA

Generates a song using the Suno API. Provide lyrics, style, and title for custom mode, or a description for inspiration mode. Returns the audio URL upon completion. Polling for results may take a few minutes.

When returning an audio URL, please use the following HTML format for user convenience:

<audio controls>
  <source src="YOUR_AUDIO_URL_HERE" type="audio/mpeg">
</audio>
<br>
<a href="YOUR_AUDIO_URL_HERE" download="SONG_TITLE.mp3">
  点击这里下载喵!
</a>
ParametersJSON Schema
NameRequiredDescriptionDefault
continue_atNoOptional. Time in seconds from which to continue the song. Requires 'task_id' and 'continue_clip_id'.
continue_clip_idNoOptional. Clip ID of the song part to continue. Requires 'task_id' and 'continue_at'.
gpt_description_promptNoOptional. Description for inspiration mode. If provided, 'prompt', 'tags', and 'title' are not strictly required by the user but might be used by the API. Example: 'A cheerful upbeat song about a sunny day.'
make_instrumentalNoOptional. Whether to generate instrumental music. Defaults to false.
mvNoOptional. Model version. Defaults to 'chirp-v4'.
promptNoLyrics content. Required for custom mode. Example: '[Verse 1]\nUnder the starry sky...'
tagsNoMusic style tags, comma-separated. Required for custom mode. Example: 'acoustic, folk, pop'
task_idNoOptional. Task ID of a previous song to continue. If provided, 'continue_at' and 'continue_clip_id' are also required.
titleNoSong title. Required for custom mode. Example: 'Starry Night Serenade'

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: the tool returns an audio URL, polling may take minutes, and it includes a specific HTML format for user convenience. However, it doesn't cover potential errors, rate limits, or authentication needs, leaving some gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose, followed by usage notes and output details. The HTML format section is lengthy but serves a practical purpose. Some sentences could be more concise, but overall it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (9 parameters, no output schema, no annotations), the description does a good job covering the tool's purpose, modes, and output handling. It lacks details on error cases or advanced usage scenarios, but for a generative tool with rich schema coverage, it's reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 9 parameters thoroughly. The description adds minimal value by mentioning lyrics, style, and title for custom mode and description for inspiration mode, but doesn't provide additional syntax or format details beyond what the schema provides. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'Generates a song using the Suno API' with specific verbs ('generates') and resources ('song'), and mentions two modes (custom and inspiration). However, it doesn't distinguish from any siblings since none exist, so it can't achieve a perfect 5 for sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning two modes (custom vs inspiration) and their required inputs, but it doesn't explicitly state when to choose one mode over the other or provide broader contextual guidance. No alternatives are mentioned, but since there are no sibling tools, this is less critical.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.6/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool 'generate_music_suno' has a singular, well-defined purpose of generating music via the Suno API.

Naming Consistency5/5

The single tool name 'generate_music_suno' follows a clear verb_noun pattern, and there are no other tools to cause inconsistency. The naming is straightforward and descriptive.

Tool Count2/5

A single tool is too few for a server named 'Suno-MCP', which suggests a broader music generation domain. This minimal toolset feels thin and may limit functionality, as agents might expect additional operations like listing generated songs or managing settings.

Completeness2/5

The tool surface is severely incomplete for a music generation server. While 'generate_music_suno' handles creation, there are obvious gaps such as retrieving, updating, or deleting generated songs, and no tools for managing styles or user preferences, which could hinder agent workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lioensky/MCP-Suno'

If you have feedback or need assistance with the MCP directory API, please join our Discord server