Suno MCP
Suno MCP
一个用于通过 Suno 生成音乐的 MCP (Model Context Protocol) 服务器。
功能特性
生成歌曲:支持自定义歌词和风格标签
根据描述生成:让 Suno AI 编写歌词
等待完成:获取带有 Markdown 嵌入的音频 URL
下载 MP3:下载到本地文件夹
自动刷新令牌:令牌过期时自动刷新
Related MCP server: Suno-MCP
要求
Node.js 18+
BrowserOS(或任何带有
--remote-debugging-port的 Chromium),运行在http://localhost:9100且已登录 Suno。可通过CDP_URL覆盖。Suno 账户(免费或付费均可)
安装
npm install与 Claude Code 一起使用
添加到你的 .mcp.json 中:
{
"suno": {
"command": "node",
"args": ["/path/to/suno-mcp/src/index.js"]
}
}工具
工具 | 描述 |
| 使用自定义歌词和风格生成 |
| AI 根据描述编写歌词 |
| 等待生成完成,返回 URL + Markdown |
| 检查生成状态 |
| 获取账户积分信息 |
| 列出最近的歌曲 |
| 将 MP3 下载到文件夹 |
工作原理
身份验证
Suno 使用 Clerk 进行身份验证,并使用短效 JWT 令牌。客户端通过 CDP 在活动的 Suno 标签页中调用 window.Clerk.session.getToken() —— Clerk 会在后台处理刷新,因此无需重新加载页面。令牌会在其 exp 声明过期前 5 分钟进行缓存。
歌曲生成
由于 hCaptcha 的存在,直接调用 API 会失败。客户端不是抓取表单选择器,而是驱动 Suno 自己的 React 应用:
通过 CDP 连接到 Suno 标签页;如有必要,导航至
/create。从“创建”按钮遍历 React fiber 树,找到将
onCreateClick/lyrics/styles/mode作为 props 暴露的组件 —— 即语义化的生成处理程序。使用与 React 兼容的原生 setter 填充歌词和风格文本区域,从而更新内部状态。
等待 fiber 的 props 反映出新值(即 React 已重新渲染)。
通过 CDP
Input.dispatchMouseEvent在按钮坐标处分发受信任的鼠标点击事件。hCaptcha 将 CDP 合成的事件视为真实的用户手势(直接从 JS 调用onCreateClick()则不行 —— 验证码会拒绝)。通过 CDP
Network事件捕获/api/generate/v2的响应,以返回新的片段 ID。如果错过了网络事件,则回退到轮询/api/project/default。
这种方法对于 UI 改版具有鲁棒性:它依赖于语义化的 React props (onCreateClick, lyrics, styles) 和 aria-label="Create song" 按钮 —— 这两者都是核心功能且不太可能改变 —— 而不是依赖类名、textContent 匹配或 DOM 布局。
示例
// Generate a song
const result = await suno_generate_song({
lyrics: "[Verse]\nHello world\n\n[Chorus]\nThis is a test",
style: "indie folk, acoustic, male vocals"
});
// Wait for it to complete
const songs = await suno_wait_for_songs({
ids: result.songIds
});
// Download it
await suno_download_song({
songId: songs[0].id,
folder: "./downloads"
});已知限制
标题字段无法可靠工作(Suno UI 限制 —— 目前未通过新的生成路径连接)。
generate_from_description(简单模式)如果找不到 UI 模式切换开关,目前会回退到自定义模式;为了获得确定性的行为,请通过generate_song传递歌词和风格。需要 BrowserOS 且保持活跃、可见的 Suno 会话。创建按钮在屏幕上必须具有非零尺寸,以便受信任的点击能够生效。
令牌每约 1 小时过期一次(通过 Clerk 自动刷新)。
许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI-powered music generation through natural language commands, supporting both inspiration mode (AI-generated lyrics and style) and custom mode (user-provided lyrics and parameters) to create songs with direct download links.43MIT
- AlicenseAqualityDmaintenanceEnables music generation through Suno AI, providing tools for account authentication, prompt-based track creation, and automatic downloading of audio files. It facilitates seamless AI music production workflows within Claude Desktop via Playwright-driven browser automation.101MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI music generation via Suno AI, allowing users to generate tracks with prompts and styles, and download them as MP3.MIT
- AlicenseAqualityDmaintenanceEnables AI-powered music generation through natural language commands, supporting both inspiration and custom modes with automatic polling for async generation.4MIT
Related MCP Connectors
Generate Suno AI music (v5.5) from any MCP client. Async; billed only on success.
MCP server for Suno AI music generation, lyrics, and covers
Generate AI music via the Lacuna Music API from MCP clients like Claude Desktop & Code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/unforced/suno-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server