Initial commit: Suno MCP server with 24 tools, proxy support, and opencode skill

This commit is contained in:
OpenCode
2026-07-13 11:31:28 +07:00
commit 10548187f4
32 changed files with 4031 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
/**
* Suno API HTTP client with rate limiting and polling helpers.
*
* Rate limit: 20 requests per 10 seconds (sunoapi.org).
* Proxy support via SUNO_HTTP_PROXY / HTTPS_PROXY / HTTP_PROXY env vars.
*/
export interface SunoApiResponse<T = unknown> {
code: number;
msg: string;
data: T;
}
export interface SunoTrack {
id: string;
audio_url?: string;
audioUrl?: string;
source_audio_url?: string;
stream_audio_url?: string;
streamAudioUrl?: string;
source_stream_audio_url?: string;
image_url?: string;
imageUrl?: string;
source_image_url?: string;
prompt?: string;
model_name?: string;
modelName?: string;
title?: string;
tags?: string;
createTime?: string;
duration?: number;
}
export interface SunoTaskData {
taskId: string;
parentMusicId?: string;
param?: string;
response?: {
taskId?: string;
data?: SunoTrack[];
sunoData?: SunoTrack[];
};
status: string;
type?: string;
operationType?: 'generate' | 'extend' | 'upload_cover' | 'upload_extend';
errorCode?: number | null;
errorMessage?: string | null;
}
export declare class SunoClient {
private readonly baseUrl;
private readonly apiKey;
private readonly maxRequests;
private readonly windowMs;
private readonly proxyAgent?;
private requestTimestamps;
constructor(apiKey: string);
/**
* Enforce rate limit: max 20 requests per 10 seconds.
*/
private throttle;
request<T = unknown>(method: 'GET' | 'POST', path: string, body?: Record<string, unknown>): Promise<SunoApiResponse<T>>;
get<T = unknown>(path: string): Promise<SunoApiResponse<T>>;
post<T = unknown>(path: string, body: Record<string, unknown>): Promise<SunoApiResponse<T>>;
/**
* Poll task status until terminal state or timeout.
*/
pollTaskStatus(taskId: string, options?: {
intervalMs?: number;
maxAttempts?: number;
statusPath?: string;
}): Promise<SunoTaskData>;
}
//# sourceMappingURL=client.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;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y support via SUNO_HTTP_PROXY / HTTPS_PROXY / HTTP_PROXY env vars.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SunoClient = void 0;
const undici_1 = require("undici");
function getProxyUrl() {
return (process.env.SUNO_HTTP_PROXY ||
process.env.HTTPS_PROXY ||
process.env.https_proxy ||
process.env.HTTP_PROXY ||
process.env.http_proxy);
}
class SunoClient {
baseUrl = 'https://api.sunoapi.org/api/v1';
apiKey;
maxRequests = 20;
windowMs = 10_000;
proxyAgent;
requestTimestamps = [];
constructor(apiKey) {
this.apiKey = apiKey;
const proxyUrl = getProxyUrl();
if (proxyUrl) {
this.proxyAgent = new undici_1.ProxyAgent(proxyUrl);
}
}
/**
* Enforce rate limit: max 20 requests per 10 seconds.
*/
async throttle() {
const now = Date.now();
this.requestTimestamps = this.requestTimestamps.filter((ts) => now - ts < this.windowMs);
if (this.requestTimestamps.length >= this.maxRequests) {
const oldest = this.requestTimestamps[0];
const wait = this.windowMs - (now - oldest);
if (wait > 0) {
await new Promise((resolve) => setTimeout(resolve, wait));
return this.throttle();
}
}
this.requestTimestamps.push(now);
}
async request(method, path, body) {
await this.throttle();
const url = path.startsWith('http') ? path : `${this.baseUrl}${path}`;
const headers = {
Authorization: `Bearer ${this.apiKey}`,
'Content-Type': 'application/json',
};
const fetchOptions = {
method,
headers,
body: body ? JSON.stringify(body) : undefined,
};
if (this.proxyAgent) {
fetchOptions.dispatcher = this.proxyAgent;
}
const response = await fetch(url, fetchOptions);
const text = await response.text();
let json;
try {
json = JSON.parse(text);
}
catch {
throw new Error(`Invalid JSON response from Suno API: ${text}`);
}
if (json.code !== 200) {
throw new Error(`Suno API error ${json.code}: ${json.msg || 'unknown error'}`);
}
return json;
}
get(path) {
return this.request('GET', path);
}
post(path, body) {
return this.request('POST', path, body);
}
/**
* Poll task status until terminal state or timeout.
*/
async pollTaskStatus(taskId, options = {}) {
const intervalMs = options.intervalMs ?? 15_000;
const maxAttempts = options.maxAttempts ?? 60;
const statusPath = options.statusPath ?? `/generate/record-info?taskId=${encodeURIComponent(taskId)}`;
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
const result = await this.get(statusPath);
const status = result.data.status;
if (status === 'SUCCESS' ||
status === 'FAILED' ||
status === 'CREATE_TASK_FAILED' ||
status === 'GENERATE_AUDIO_FAILED' ||
status === 'CALLBACK_EXCEPTION' ||
status === 'SENSITIVE_WORD_ERROR') {
return result.data;
}
if (attempt < maxAttempts) {
await new Promise((resolve) => setTimeout(resolve, intervalMs));
}
}
throw new Error(`Polling timeout for task ${taskId} after ${maxAttempts} attempts`);
}
}
exports.SunoClient = SunoClient;
//# sourceMappingURL=client.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,mCAAoC;AA4CpC,SAAS,WAAW;IAClB,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,eAAe;QAC3B,OAAO,CAAC,GAAG,CAAC,WAAW;QACvB,OAAO,CAAC,GAAG,CAAC,WAAW;QACvB,OAAO,CAAC,GAAG,CAAC,UAAU;QACtB,OAAO,CAAC,GAAG,CAAC,UAAU,CACvB,CAAC;AACJ,CAAC;AAED,MAAa,UAAU;IACJ,OAAO,GAAG,gCAAgC,CAAC;IAC3C,MAAM,CAAS;IACf,WAAW,GAAG,EAAE,CAAC;IACjB,QAAQ,GAAG,MAAM,CAAC;IAClB,UAAU,CAAc;IACjC,iBAAiB,GAAa,EAAE,CAAC;IAEzC,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,UAAU,GAAG,IAAI,mBAAU,CAAC,QAAQ,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,QAAQ;QACpB,MAAM,GAAG,GAAG,IAAI,CAA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AW,EAAE,OAAO,EAAE,EAAE,CAAC;YACxD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAe,UAAU,CAAC,CAAC;YACxD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YAElC,IACE,MAAM,KAAK,SAAS;gBACpB,MAAM,KAAK,QAAQ;gBACnB,MAAM,KAAK,oBAAoB;gBAC/B,MAAM,KAAK,uBAAuB;gBAClC,MAAM,KAAK,oBAAoB;gBAC/B,MAAM,KAAK,sBAAsB,EACjC,CAAC;gBACD,OAAO,MAAM,CAAC,IAAI,CAAC;YACrB,CAAC;YAED,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;gBAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,UAAU,WAAW,WAAW,CAAC,CAAC;IACtF,CAAC;CACF;AAzHD,gCAyHC"}
+12
View File
@@ -0,0 +1,12 @@
import { SunoClient } from './client';
export declare class ToolHandlers {
private readonly client;
constructor(client: SunoClient);
handle(name: string, args: unknown): Promise<{
content: {
type: string;
text: string;
}[];
}>;
}
//# sourceMappingURL=handlers.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,UAAU,CAAC;AA2EpD,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEzC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;CAsUlG"}
+447
View File
@@ -0,0 +1,447 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolHandlers = void 0;
const schemas = __importStar(require("./schemas"));
const ASYNC_POLLING_PATHS = {
'suno_generate_music': '/generate/record-info?taskId=',
'suno_extend_music': '/generate/record-info?taskId=',
'suno_replace_section': '/generate/record-info?taskId=',
'suno_upload_and_cover': '/generate/record-info?taskId=',
'suno_upload_and_extend': '/generate/record-info?taskId=',
'suno_add_vocals': '/generate/record-info?taskId=',
'suno_add_instrumental': '/generate/record-info?taskId=',
'suno_generate_mashup': '/generate/record-info?taskId=',
'suno_separate_vocals': '/vocal-removal/record-info?taskId=',
'suno_separate_stems': '/vocal-removal/record-info?taskId=',
'suno_create_video': '/generate/video-info?taskId=',
'suno_create_cover': '/generate/cover-info?taskId=',
'suno_convert_to_wav': '/generate/wav-info?taskId=',
'suno_generate_sounds': '/generate/record-info?taskId=',
};
function formatTaskResult(data) {
const status = data.status;
if (status !== 'SUCCESS') {
return JSON.stringify({
taskId: data.taskId,
status,
errorCode: data.errorCode,
errorMessage: data.errorMessage,
}, null, 2);
}
const response = data.response;
const tracks = response?.data ?? response?.sunoData ?? [];
return JSON.stringify({
taskId: data.taskId,
status,
operationType: data.operationType,
tracks: tracks.map((t) => ({
id: t.id,
title: t.title,
tags: t.tags,
duration: t.duration,
prompt: t.prompt,
audio_url: t.audio_url ?? t.audioUrl,
stream_audio_url: t.stream_audio_url ?? t.streamAudioUrl,
image_url: t.image_url ?? t.imageUrl,
})),
}, null, 2);
}
async function runAsyncTask(client, taskName, createPath, payload) {
const createResult = await client.post(createPath, payload);
const taskId = createResult.data.taskId;
const statusPathTemplate = ASYNC_POLLING_PATHS[taskName];
if (!statusPathTemplate) {
return JSON.stringify({ taskId, status: 'PENDING', note: 'Use suno_get_task_status to poll.' }, null, 2);
}
const statusData = await client.pollTaskStatus(taskId, {
statusPath: `${statusPathTemplate}${encodeURIComponent(taskId)}`,
});
return formatTaskResult(statusData);
}
class ToolHandlers {
client;
constructor(client) {
this.client = client;
}
async handle(name, args) {
let resultText;
switch (name) {
case 'suno_generate_music': {
const input = schemas.GenerateMusicSchema.parse(args);
const payload = {
prompt: input.prompt,
customMode: input.customMode,
instrumental: input.instrumental,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
if (input.negativeTags !== undefined)
payload.negativeTags = input.negativeTags;
if (input.vocalGender !== undefined)
payload.vocalGender = input.vocalGender;
if (input.styleWeight !== undefined)
payload.styleWeight = input.styleWeight;
if (input.weirdnessConstraint !== undefined)
payload.weirdnessConstraint = input.weirdnessConstraint;
if (input.audioWeight !== undefined)
payload.audioWeight = input.audioWeight;
if (input.personaId !== undefined)
payload.personaId = input.personaId;
if (input.personaModel !== undefined)
payload.personaModel = input.personaModel;
resultText = await runAsyncTask(this.client, name, '/generate', payload);
break;
}
case 'suno_generate_lyrics': {
const input = schemas.GenerateLyricsSchema.parse(args);
const result = await this.client.post('/lyrics', {
prompt: input.prompt,
callBackUrl: input.callBackUrl ?? '',
});
resultText = JSON.stringify({ taskId: result.data.taskId, status: 'PENDING' }, null, 2);
break;
}
case 'suno_generate_sounds': {
const input = schemas.GenerateSoundsSchema.parse(args);
const payload = {
prompt: input.prompt,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.soundLoop !== undefined)
payload.soundLoop = input.soundLoop;
if (input.soundTempo !== undefined)
payload.soundTempo = input.soundTempo;
if (input.soundKey !== undefined)
payload.soundKey = input.soundKey;
if (input.grabLyrics !== undefined)
payload.grabLyrics = input.grabLyrics;
resultText = await runAsyncTask(this.client, name, '/generate/sounds', payload);
break;
}
case 'suno_extend_music': {
const input = schemas.ExtendMusicSchema.parse(args);
const payload = {
audioId: input.audioId,
defaultParamFlag: input.defaultParamFlag,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.prompt !== undefined)
payload.prompt = input.prompt;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
if (input.continueAt !== undefined)
payload.continueAt = input.continueAt;
if (input.negativeTags !== undefined)
payload.negativeTags = input.negativeTags;
if (input.vocalGender !== undefined)
payload.vocalGender = input.vocalGender;
if (input.styleWeight !== undefined)
payload.styleWeight = input.styleWeight;
if (input.weirdnessConstraint !== undefined)
payload.weirdnessConstraint = input.weirdnessConstraint;
if (input.audioWeight !== undefined)
payload.audioWeight = input.audioWeight;
if (input.personaId !== undefined)
payload.personaId = input.personaId;
if (input.personaModel !== undefined)
payload.personaModel = input.personaModel;
resultText = await runAsyncTask(this.client, name, '/generate/extend', payload);
break;
}
case 'suno_replace_section': {
const input = schemas.ReplaceSectionSchema.parse(args);
const payload = {
audioId: input.audioId,
prompt: input.prompt,
start: input.start,
end: input.end,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.replaceAudioUrl !== undefined)
payload.replaceAudioUrl = input.replaceAudioUrl;
if (input.customMode !== undefined)
payload.customMode = input.customMode;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
if (input.instrumental !== undefined)
payload.instrumental = input.instrumental;
resultText = await runAsyncTask(this.client, name, '/generate/replace-section', payload);
break;
}
case 'suno_add_vocals': {
const input = schemas.AddVocalsSchema.parse(args);
const payload = {
audioId: input.audioId,
prompt: input.prompt,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.customMode !== undefined)
payload.customMode = input.customMode;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
resultText = await runAsyncTask(this.client, name, '/generate/add-vocals', payload);
break;
}
case 'suno_add_instrumental': {
const input = schemas.AddInstrumentalSchema.parse(args);
const payload = {
audioId: input.audioId,
prompt: input.prompt,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.customMode !== undefined)
payload.customMode = input.customMode;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
resultText = await runAsyncTask(this.client, name, '/generate/add-instrumental', payload);
break;
}
case 'suno_upload_and_cover': {
const input = schemas.UploadAndCoverSchema.parse(args);
const payload = {
uploadUrl: input.uploadUrl,
customMode: input.customMode,
instrumental: input.instrumental,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.prompt !== undefined)
payload.prompt = input.prompt;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
if (input.negativeTags !== undefined)
payload.negativeTags = input.negativeTags;
if (input.vocalGender !== undefined)
payload.vocalGender = input.vocalGender;
if (input.styleWeight !== undefined)
payload.styleWeight = input.styleWeight;
if (input.weirdnessConstraint !== undefined)
payload.weirdnessConstraint = input.weirdnessConstraint;
if (input.audioWeight !== undefined)
payload.audioWeight = input.audioWeight;
if (input.personaId !== undefined)
payload.personaId = input.personaId;
if (input.personaModel !== undefined)
payload.personaModel = input.personaModel;
resultText = await runAsyncTask(this.client, name, '/generate/upload-cover', payload);
break;
}
case 'suno_upload_and_extend': {
const input = schemas.UploadAndExtendSchema.parse(args);
const payload = {
uploadUrl: input.uploadUrl,
defaultParamFlag: input.defaultParamFlag,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.prompt !== undefined)
payload.prompt = input.prompt;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
if (input.continueAt !== undefined)
payload.continueAt = input.continueAt;
resultText = await runAsyncTask(this.client, name, '/generate/upload-extend', payload);
break;
}
case 'suno_generate_mashup': {
const input = schemas.GenerateMashupSchema.parse(args);
const payload = {
uploadUrlList: input.uploadUrlList,
customMode: input.customMode,
prompt: input.prompt,
model: input.model,
callBackUrl: input.callBackUrl ?? '',
};
if (input.instrumental !== undefined)
payload.instrumental = input.instrumental;
if (input.style !== undefined)
payload.style = input.style;
if (input.title !== undefined)
payload.title = input.title;
if (input.negativeTags !== undefined)
payload.negativeTags = input.negativeTags;
if (input.vocalGender !== undefined)
payload.vocalGender = input.vocalGender;
if (input.styleWeight !== undefined)
payload.styleWeight = input.styleWeight;
if (input.weirdnessConstraint !== undefined)
payload.weirdnessConstraint = input.weirdnessConstraint;
if (input.audioWeight !== undefined)
payload.audioWeight = input.audioWeight;
resultText = await runAsyncTask(this.client, name, '/generate/mashup', payload);
break;
}
case 'suno_separate_vocals': {
const input = schemas.SeparateVocalsSchema.parse(args);
resultText = await runAsyncTask(this.client, name, '/vocal-removal/generate', {
taskId: input.taskId,
audioId: input.audioId,
callBackUrl: input.callBackUrl ?? '',
});
break;
}
case 'suno_separate_stems': {
const input = schemas.SeparateStemsSchema.parse(args);
resultText = await runAsyncTask(this.client, name, '/vocal-removal/generate', {
taskId: input.taskId,
audioId: input.audioId,
type: 'split_stem',
callBackUrl: input.callBackUrl ?? '',
});
break;
}
case 'suno_create_video': {
const input = schemas.CreateVideoSchema.parse(args);
const payload = {
taskId: input.taskId,
audioId: input.audioId,
callBackUrl: input.callBackUrl ?? '',
};
if (input.author !== undefined)
payload.author = input.author;
if (input.domainName !== undefined)
payload.domainName = input.domainName;
resultText = await runAsyncTask(this.client, name, '/generate/video', payload);
break;
}
case 'suno_create_cover': {
const input = schemas.CreateCoverSchema.parse(args);
resultText = await runAsyncTask(this.client, name, '/generate/cover', {
taskId: input.taskId,
audioId: input.audioId,
callBackUrl: input.callBackUrl ?? '',
});
break;
}
case 'suno_convert_to_wav': {
const input = schemas.ConvertToWavSchema.parse(args);
resultText = await runAsyncTask(this.client, name, '/generate/wav', {
taskId: input.taskId,
audioId: input.audioId,
callBackUrl: input.callBackUrl ?? '',
});
break;
}
case 'suno_boost_style': {
const input = schemas.BoostStyleSchema.parse(args);
const result = await this.client.post('/style/generate', {
content: input.content,
});
resultText = result.data.result;
break;
}
case 'suno_generate_persona': {
const input = schemas.GeneratePersonaSchema.parse(args);
const payload = { taskId: input.taskId };
if (input.audioId !== undefined)
payload.audioId = input.audioId;
const result = await this.client.post('/generate/persona', payload);
resultText = JSON.stringify(result.data, null, 2);
break;
}
case 'suno_get_task_status': {
const input = schemas.GetTaskStatusSchema.parse(args);
const data = await this.client.get(`/generate/record-info?taskId=${encodeURIComponent(input.taskId)}`);
resultText = formatTaskResult(data.data);
break;
}
case 'suno_get_timestamped_lyrics': {
const input = schemas.GetTimestampedLyricsSchema.parse(args);
const result = await this.client.get(`/generate/timestamped-lyrics?taskId=${encodeURIComponent(input.taskId)}&audioId=${encodeURIComponent(input.audioId)}`);
resultText = JSON.stringify(result.data, null, 2);
break;
}
case 'suno_get_lyrics_details': {
const input = schemas.GetLyricsDetailsSchema.parse(args);
const result = await this.client.get(`/generate/lyrics-info?taskId=${encodeURIComponent(input.taskId)}`);
resultText = JSON.stringify(result.data, null, 2);
break;
}
case 'suno_get_wav_details': {
const input = schemas.GetWavDetailsSchema.parse(args);
const result = await this.client.get(`/generate/wav-info?taskId=${encodeURIComponent(input.taskId)}`);
resultText = JSON.stringify(result.data, null, 2);
break;
}
case 'suno_get_vocal_separation_details': {
const input = schemas.GetVocalSeparationDetailsSchema.parse(args);
const result = await this.client.get(`/vocal-removal/record-info?taskId=${encodeURIComponent(input.taskId)}`);
resultText = JSON.stringify(result.data, null, 2);
break;
}
case 'suno_get_video_details': {
const input = schemas.GetVideoDetailsSchema.parse(args);
const result = await this.client.get(`/generate/video-info?taskId=${encodeURIComponent(input.taskId)}`);
resultText = JSON.stringify(result.data, null, 2);
break;
}
case 'suno_get_credits': {
schemas.GetCreditsSchema.parse(args);
const result = await this.client.get('/generate/credit');
resultText = JSON.stringify({ credits: result.data }, null, 2);
break;
}
default:
throw new Error(`Unknown tool: ${name}`);
}
return {
content: [{ type: 'text', text: resultText }],
};
}
}
exports.ToolHandlers = ToolHandlers;
//# sourceMappingURL=handlers.js.map
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env node
export {};
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
const client_js_1 = require("./client.js");
const handlers_js_1 = require("./handlers.js");
const tools_js_1 = require("./tools.js");
function main() {
const apiKey = process.env.SUNO_API_KEY;
if (!apiKey) {
console.error('SUNO_API_KEY environment variable is required');
process.exit(1);
}
const client = new client_js_1.SunoClient(apiKey);
const handlers = new handlers_js_1.ToolHandlers(client);
const server = new index_js_1.Server({
name: 'suno-mcp-server',
version: '1.0.0',
}, {
capabilities: {
tools: {},
},
});
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
return { tools: tools_js_1.TOOLS };
});
server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
try {
const result = await handlers.handle(request.params.name, request.params.arguments ?? {});
return result;
}
catch (error) {
const message = error instanceof Error ? error.message : String(error);
return {
content: [{ type: 'text', text: `Error: ${message}` }],
isError: true,
};
}
});
const transport = new stdio_js_1.StdioServerTransport();
server.connect(transport).catch((error) => {
console.error('Failed to start MCP server:', error);
process.exit(1);
});
}
main();
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,wEAAmE;AACnE,wEAAiF;AACjF,iEAI4C;AAC5C,2CAAyC;AACzC,+CAA6C;AAC7C,yCAAmC;AAEnC,SAAS,IAAI;IACX,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,sBAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,0BAAY,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAI,iBAAM,CACvB;QACE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE;SACV;KACF,CACF,CAAC;IAEF,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,EAAE,KAAK,IAAI,EAAE;QAC1D,OAAO,EAAE,KAAK,EAAE,gBAAe,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,iBAAiB,CAAC,gCAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAChE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;YAC1F,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;gBACtD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACjD,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
+496
View File
@@ -0,0 +1,496 @@
import { z } from 'zod';
export declare const GenerateMusicSchema: z.ZodObject<{
model: z.ZodEnum<[string, ...string[]]>;
negativeTags: z.ZodOptional<z.ZodString>;
vocalGender: z.ZodOptional<z.ZodEnum<["m", "f"]>>;
styleWeight: z.ZodOptional<z.ZodNumber>;
weirdnessConstraint: z.ZodOptional<z.ZodNumber>;
audioWeight: z.ZodOptional<z.ZodNumber>;
personaId: z.ZodOptional<z.ZodString>;
personaModel: z.ZodOptional<z.ZodEnum<["style_persona", "voice_persona"]>>;
callBackUrl: z.ZodOptional<z.ZodString>;
prompt: z.ZodOptional<z.ZodString>;
customMode: z.ZodBoolean;
instrumental: z.ZodBoolean;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
customMode: boolean;
instrumental: boolean;
model: string;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
personaId?: string | undefined;
personaModel?: "style_persona" | "voice_persona" | undefined;
callBackUrl?: string | undefined;
}, {
customMode: boolean;
instrumental: boolean;
model: string;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
personaId?: string | undefined;
personaModel?: "style_persona" | "voice_persona" | undefined;
callBackUrl?: string | undefined;
}>;
export declare const GenerateLyricsSchema: z.ZodObject<{
prompt: z.ZodString;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
prompt: string;
callBackUrl?: string | undefined;
}, {
prompt: string;
callBackUrl?: string | undefined;
}>;
export declare const GenerateSoundsSchema: z.ZodObject<{
prompt: z.ZodString;
model: z.ZodEnum<[string, ...string[]]>;
soundLoop: z.ZodOptional<z.ZodBoolean>;
soundTempo: z.ZodOptional<z.ZodNumber>;
soundKey: z.ZodOptional<z.ZodEnum<["Any", "Cm", "C#m", "Dm", "D#m", "Em", "Fm", "F#m", "Gm", "G#m", "Am", "A#m", "Bm", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]>>;
grabLyrics: z.ZodOptional<z.ZodBoolean>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
prompt: string;
model: string;
callBackUrl?: string | undefined;
soundLoop?: boolean | undefined;
soundTempo?: number | undefined;
soundKey?: "Any" | "Cm" | "C#m" | "Dm" | "D#m" | "Em" | "Fm" | "F#m" | "Gm" | "G#m" | "Am" | "A#m" | "Bm" | "C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "B" | undefined;
grabLyrics?: boolean | undefined;
}, {
prompt: string;
model: string;
callBackUrl?: string | undefined;
soundLoop?: boolean | undefined;
soundTempo?: number | undefined;
soundKey?: "Any" | "Cm" | "C#m" | "Dm" | "D#m" | "Em" | "Fm" | "F#m" | "Gm" | "G#m" | "Am" | "A#m" | "Bm" | "C" | "C#" | "D" | "D#" | "E" | "F" | "F#" | "G" | "G#" | "A" | "A#" | "B" | undefined;
grabLyrics?: boolean | undefined;
}>;
export declare const ExtendMusicSchema: z.ZodObject<{
audioId: z.ZodString;
defaultParamFlag: z.ZodBoolean;
prompt: z.ZodOptional<z.ZodString>;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
continueAt: z.ZodOptional<z.ZodNumber>;
model: z.ZodEnum<[string, ...string[]]>;
negativeTags: z.ZodOptional<z.ZodString>;
vocalGender: z.ZodOptional<z.ZodEnum<["m", "f"]>>;
styleWeight: z.ZodOptional<z.ZodNumber>;
weirdnessConstraint: z.ZodOptional<z.ZodNumber>;
audioWeight: z.ZodOptional<z.ZodNumber>;
personaId: z.ZodOptional<z.ZodString>;
personaModel: z.ZodOptional<z.ZodEnum<["style_persona", "voice_persona"]>>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
model: string;
audioId: string;
defaultParamFlag: boolean;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
personaId?: string | undefined;
personaModel?: "style_persona" | "voice_persona" | undefined;
callBackUrl?: string | undefined;
continueAt?: number | undefined;
}, {
model: string;
audioId: string;
defaultParamFlag: boolean;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
personaId?: string | undefined;
personaModel?: "style_persona" | "voice_persona" | undefined;
callBackUrl?: string | undefined;
continueAt?: number | undefined;
}>;
export declare const ReplaceSectionSchema: z.ZodObject<{
audioId: z.ZodString;
prompt: z.ZodString;
replaceAudioUrl: z.ZodOptional<z.ZodString>;
start: z.ZodNumber;
end: z.ZodNumber;
customMode: z.ZodOptional<z.ZodBoolean>;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
instrumental: z.ZodOptional<z.ZodBoolean>;
model: z.ZodEnum<[string, ...string[]]>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
prompt: string;
model: string;
audioId: string;
start: number;
end: number;
customMode?: boolean | undefined;
instrumental?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
replaceAudioUrl?: string | undefined;
}, {
prompt: string;
model: string;
audioId: string;
start: number;
end: number;
customMode?: boolean | undefined;
instrumental?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
replaceAudioUrl?: string | undefined;
}>;
export declare const AddVocalsSchema: z.ZodObject<{
audioId: z.ZodString;
prompt: z.ZodOptional<z.ZodString>;
customMode: z.ZodOptional<z.ZodBoolean>;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
model: z.ZodEnum<[string, ...string[]]>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
model: string;
audioId: string;
prompt?: string | undefined;
customMode?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
}, {
model: string;
audioId: string;
prompt?: string | undefined;
customMode?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
}>;
export declare const AddInstrumentalSchema: z.ZodObject<{
audioId: z.ZodString;
prompt: z.ZodOptional<z.ZodString>;
customMode: z.ZodOptional<z.ZodBoolean>;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
model: z.ZodEnum<[string, ...string[]]>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
model: string;
audioId: string;
prompt?: string | undefined;
customMode?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
}, {
model: string;
audioId: string;
prompt?: string | undefined;
customMode?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
}>;
export declare const UploadAndCoverSchema: z.ZodObject<{
uploadUrl: z.ZodString;
prompt: z.ZodOptional<z.ZodString>;
customMode: z.ZodBoolean;
instrumental: z.ZodBoolean;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
model: z.ZodEnum<[string, ...string[]]>;
negativeTags: z.ZodOptional<z.ZodString>;
vocalGender: z.ZodOptional<z.ZodEnum<["m", "f"]>>;
styleWeight: z.ZodOptional<z.ZodNumber>;
weirdnessConstraint: z.ZodOptional<z.ZodNumber>;
audioWeight: z.ZodOptional<z.ZodNumber>;
personaId: z.ZodOptional<z.ZodString>;
personaModel: z.ZodOptional<z.ZodEnum<["style_persona", "voice_persona"]>>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
customMode: boolean;
instrumental: boolean;
model: string;
uploadUrl: string;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
personaId?: string | undefined;
personaModel?: "style_persona" | "voice_persona" | undefined;
callBackUrl?: string | undefined;
}, {
customMode: boolean;
instrumental: boolean;
model: string;
uploadUrl: string;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
personaId?: string | undefined;
personaModel?: "style_persona" | "voice_persona" | undefined;
callBackUrl?: string | undefined;
}>;
export declare const UploadAndExtendSchema: z.ZodObject<{
uploadUrl: z.ZodString;
defaultParamFlag: z.ZodBoolean;
prompt: z.ZodOptional<z.ZodString>;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
continueAt: z.ZodOptional<z.ZodNumber>;
model: z.ZodEnum<[string, ...string[]]>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
model: string;
defaultParamFlag: boolean;
uploadUrl: string;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
continueAt?: number | undefined;
}, {
model: string;
defaultParamFlag: boolean;
uploadUrl: string;
prompt?: string | undefined;
style?: string | undefined;
title?: string | undefined;
callBackUrl?: string | undefined;
continueAt?: number | undefined;
}>;
export declare const SeparateVocalsSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}>;
export declare const SeparateStemsSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}>;
export declare const CreateVideoSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
author: z.ZodOptional<z.ZodString>;
domainName: z.ZodOptional<z.ZodString>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
author?: string | undefined;
domainName?: string | undefined;
}, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
author?: string | undefined;
domainName?: string | undefined;
}>;
export declare const CreateCoverSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}>;
export declare const ConvertToWavSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}, {
audioId: string;
taskId: string;
callBackUrl?: string | undefined;
}>;
export declare const BoostStyleSchema: z.ZodObject<{
content: z.ZodString;
}, "strict", z.ZodTypeAny, {
content: string;
}, {
content: string;
}>;
export declare const GeneratePersonaSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
}, {
audioId: string;
taskId: string;
}>;
export declare const GenerateMashupSchema: z.ZodObject<{
uploadUrlList: z.ZodArray<z.ZodString, "many">;
customMode: z.ZodBoolean;
instrumental: z.ZodOptional<z.ZodBoolean>;
prompt: z.ZodString;
style: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
model: z.ZodEnum<["V4", "V4_5", "V4_5PLUS", "V4_5ALL", "V5"]>;
negativeTags: z.ZodOptional<z.ZodString>;
vocalGender: z.ZodOptional<z.ZodEnum<["m", "f"]>>;
styleWeight: z.ZodOptional<z.ZodNumber>;
weirdnessConstraint: z.ZodOptional<z.ZodNumber>;
audioWeight: z.ZodOptional<z.ZodNumber>;
callBackUrl: z.ZodOptional<z.ZodString>;
}, "strict", z.ZodTypeAny, {
prompt: string;
customMode: boolean;
model: "V4" | "V4_5" | "V4_5PLUS" | "V4_5ALL" | "V5";
uploadUrlList: string[];
instrumental?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
callBackUrl?: string | undefined;
}, {
prompt: string;
customMode: boolean;
model: "V4" | "V4_5" | "V4_5PLUS" | "V4_5ALL" | "V5";
uploadUrlList: string[];
instrumental?: boolean | undefined;
style?: string | undefined;
title?: string | undefined;
negativeTags?: string | undefined;
vocalGender?: "m" | "f" | undefined;
styleWeight?: number | undefined;
weirdnessConstraint?: number | undefined;
audioWeight?: number | undefined;
callBackUrl?: string | undefined;
}>;
export declare const GetTaskStatusSchema: z.ZodObject<{
taskId: z.ZodString;
}, "strict", z.ZodTypeAny, {
taskId: string;
}, {
taskId: string;
}>;
export declare const GetTimestampedLyricsSchema: z.ZodObject<{
taskId: z.ZodString;
audioId: z.ZodString;
}, "strict", z.ZodTypeAny, {
audioId: string;
taskId: string;
}, {
audioId: string;
taskId: string;
}>;
export declare const GetLyricsDetailsSchema: z.ZodObject<{
taskId: z.ZodString;
}, "strict", z.ZodTypeAny, {
taskId: string;
}, {
taskId: string;
}>;
export declare const GetWavDetailsSchema: z.ZodObject<{
taskId: z.ZodString;
}, "strict", z.ZodTypeAny, {
taskId: string;
}, {
taskId: string;
}>;
export declare const GetVocalSeparationDetailsSchema: z.ZodObject<{
taskId: z.ZodString;
}, "strict", z.ZodTypeAny, {
taskId: string;
}, {
taskId: string;
}>;
export declare const GetVideoDetailsSchema: z.ZodObject<{
taskId: z.ZodString;
}, "strict", z.ZodTypeAny, {
taskId: string;
}, {
taskId: string;
}>;
export declare const GetCreditsSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
export type GenerateMusicInput = z.infer<typeof GenerateMusicSchema>;
export type GenerateLyricsInput = z.infer<typeof GenerateLyricsSchema>;
export type GenerateSoundsInput = z.infer<typeof GenerateSoundsSchema>;
export type ExtendMusicInput = z.infer<typeof ExtendMusicSchema>;
export type ReplaceSectionInput = z.infer<typeof ReplaceSectionSchema>;
export type AddVocalsInput = z.infer<typeof AddVocalsSchema>;
export type AddInstrumentalInput = z.infer<typeof AddInstrumentalSchema>;
export type UploadAndCoverInput = z.infer<typeof UploadAndCoverSchema>;
export type UploadAndExtendInput = z.infer<typeof UploadAndExtendSchema>;
export type SeparateVocalsInput = z.infer<typeof SeparateVocalsSchema>;
export type SeparateStemsInput = z.infer<typeof SeparateStemsSchema>;
export type CreateVideoInput = z.infer<typeof CreateVideoSchema>;
export type CreateCoverInput = z.infer<typeof CreateCoverSchema>;
export type ConvertToWavInput = z.infer<typeof ConvertToWavSchema>;
export type BoostStyleInput = z.infer<typeof BoostStyleSchema>;
export type GeneratePersonaInput = z.infer<typeof GeneratePersonaSchema>;
export type GenerateMashupInput = z.infer<typeof GenerateMashupSchema>;
export type GetTaskStatusInput = z.infer<typeof GetTaskStatusSchema>;
export type GetTimestampedLyricsInput = z.infer<typeof GetTimestampedLyricsSchema>;
export type GetLyricsDetailsInput = z.infer<typeof GetLyricsDetailsSchema>;
export type GetWavDetailsInput = z.infer<typeof GetWavDetailsSchema>;
export type GetVocalSeparationDetailsInput = z.infer<typeof GetVocalSeparationDetailsSchema>;
export type GetVideoDetailsInput = z.infer<typeof GetVideoDetailsSchema>;
//# sourceMappingURL=schemas.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAC;AAGZ,eAAO,MAAM,oBAAoB;;;;;;;;;EAGtB,CAAC;AAGZ,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;EAWtB,CAAC;AAGZ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBnB,CAAC;AAGZ,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY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C,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACnF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAC7F,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
+214
View File
@@ -0,0 +1,214 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetCreditsSchema = exports.GetVideoDetailsSchema = exports.GetVocalSeparationDetailsSchema = exports.GetWavDetailsSchema = exports.GetLyricsDetailsSchema = exports.GetTimestampedLyricsSchema = exports.GetTaskStatusSchema = exports.GenerateMashupSchema = exports.GeneratePersonaSchema = exports.BoostStyleSchema = exports.ConvertToWavSchema = exports.CreateCoverSchema = exports.CreateVideoSchema = exports.SeparateStemsSchema = exports.SeparateVocalsSchema = exports.UploadAndExtendSchema = exports.UploadAndCoverSchema = exports.AddInstrumentalSchema = exports.AddVocalsSchema = exports.ReplaceSectionSchema = exports.ExtendMusicSchema = exports.GenerateSoundsSchema = exports.GenerateLyricsSchema = exports.GenerateMusicSchema = void 0;
const zod_1 = require("zod");
const MODELS = ['V4', 'V4_5', 'V4_5PLUS', 'V4_5ALL', 'V5', 'V5_5'];
const SOUND_MODELS = ['V5'];
const ModelEnum = zod_1.z.enum(MODELS).describe('Model version (V4, V4_5, V4_5PLUS, V4_5ALL, V5, V5_5)');
const SoundModelEnum = zod_1.z.enum(SOUND_MODELS).describe('Sounds model (V5 only)');
const PersonaModelEnum = zod_1.z.enum(['style_persona', 'voice_persona']).optional();
const CallbackUrl = zod_1.z.string().optional().describe('Optional webhook URL for async completion');
const CommonGenerateParams = {
model: ModelEnum,
negativeTags: zod_1.z.string().optional().describe('Styles to exclude'),
vocalGender: zod_1.z.enum(['m', 'f']).optional().describe('Preferred vocal gender'),
styleWeight: zod_1.z.number().min(0).max(1).optional().describe('Style weight 0.00-1.00'),
weirdnessConstraint: zod_1.z.number().min(0).max(1).optional().describe('Weirdness constraint 0.00-1.00'),
audioWeight: zod_1.z.number().min(0).max(1).optional().describe('Audio influence weight 0.00-1.00'),
personaId: zod_1.z.string().optional().describe('Persona or voice ID'),
personaModel: PersonaModelEnum.describe('Use style_persona or voice_persona'),
callBackUrl: CallbackUrl,
};
// 1. Generate Music (12 credits)
exports.GenerateMusicSchema = zod_1.z.object({
prompt: zod_1.z.string().optional().describe('Music description / lyrics (max 500 chars non-custom, 3000-5000 custom mode; required when customMode=false or customMode=true with instrumental=false)'),
customMode: zod_1.z.boolean().describe('Enable custom mode (requires style and title)'),
instrumental: zod_1.z.boolean().describe('Generate instrumental without vocals'),
style: zod_1.z.string().optional().describe('Music style/genre (required when customMode=true)'),
title: zod_1.z.string().optional().describe('Song title (required when customMode=true)'),
...CommonGenerateParams,
}).strict();
// 2. Generate Lyrics (0.4 credits)
exports.GenerateLyricsSchema = zod_1.z.object({
prompt: zod_1.z.string().describe('Topic or theme for lyrics'),
callBackUrl: CallbackUrl,
}).strict();
// 3. Generate Sounds (2.5 credits)
exports.GenerateSoundsSchema = zod_1.z.object({
prompt: zod_1.z.string().max(500).describe('Sound description (max 500 chars)'),
model: SoundModelEnum,
soundLoop: zod_1.z.boolean().optional().describe('Enable loop playback'),
soundTempo: zod_1.z.number().int().min(1).max(300).optional().describe('BPM'),
soundKey: zod_1.z.enum([
'Any', 'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am', 'A#m', 'Bm',
'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'
]).optional().describe('Pitch key'),
grabLyrics: zod_1.z.boolean().optional().describe('Fetch lyric subtitles'),
callBackUrl: CallbackUrl,
}).strict();
// 4. Extend Music (12 credits)
exports.ExtendMusicSchema = zod_1.z.object({
audioId: zod_1.z.string().describe('ID of the source track to extend'),
defaultParamFlag: zod_1.z.boolean().describe('Use custom params (true) or source params (false)'),
prompt: zod_1.z.string().optional().describe('Extension description (required with custom params)'),
style: zod_1.z.string().optional().describe('Style (required with custom params)'),
title: zod_1.z.string().optional().describe('Title (required with custom params)'),
continueAt: zod_1.z.number().positive().optional().describe('Start time in seconds (required with custom params)'),
model: ModelEnum,
negativeTags: zod_1.z.string().optional(),
vocalGender: zod_1.z.enum(['m', 'f']).optional(),
styleWeight: zod_1.z.number().min(0).max(1).optional(),
weirdnessConstraint: zod_1.z.number().min(0).max(1).optional(),
audioWeight: zod_1.z.number().min(0).max(1).optional(),
personaId: zod_1.z.string().optional(),
personaModel: PersonaModelEnum,
callBackUrl: CallbackUrl,
}).strict();
// 5. Replace Section (5 credits)
exports.ReplaceSectionSchema = zod_1.z.object({
audioId: zod_1.z.string().describe('ID of track to modify (or taskId if replacing within own generated track)'),
prompt: zod_1.z.string().describe('Description for replacement section'),
replaceAudioUrl: zod_1.z.string().optional().describe('Custom uploaded audio URL for replacement'),
start: zod_1.z.number().nonnegative().describe('Start time in seconds'),
end: zod_1.z.number().positive().describe('End time in seconds'),
customMode: zod_1.z.boolean().optional().describe('Enable custom mode'),
style: zod_1.z.string().optional().describe('Style (custom mode)'),
title: zod_1.z.string().optional().describe('Title (custom mode)'),
instrumental: zod_1.z.boolean().optional().describe('Instrumental (custom mode)'),
model: ModelEnum,
callBackUrl: CallbackUrl,
}).strict();
// 6. Add Vocals (12 credits)
exports.AddVocalsSchema = zod_1.z.object({
audioId: zod_1.z.string().describe('Instrumental track ID'),
prompt: zod_1.z.string().optional().describe('Vocal/lyrics concept'),
customMode: zod_1.z.boolean().optional(),
style: zod_1.z.string().optional(),
title: zod_1.z.string().optional(),
model: ModelEnum,
callBackUrl: CallbackUrl,
}).strict();
// 7. Add Instrumental (12 credits)
exports.AddInstrumentalSchema = zod_1.z.object({
audioId: zod_1.z.string().describe('Vocal or melody track ID'),
prompt: zod_1.z.string().optional().describe('Desired backing arrangement'),
customMode: zod_1.z.boolean().optional(),
style: zod_1.z.string().optional(),
title: zod_1.z.string().optional(),
model: ModelEnum,
callBackUrl: CallbackUrl,
}).strict();
// 8. Upload and Cover (12 credits)
exports.UploadAndCoverSchema = zod_1.z.object({
uploadUrl: zod_1.z.string().url().describe('Public URL of audio file to cover (max 8 minutes)'),
prompt: zod_1.z.string().optional(),
customMode: zod_1.z.boolean(),
instrumental: zod_1.z.boolean(),
style: zod_1.z.string().optional(),
title: zod_1.z.string().optional(),
model: ModelEnum,
negativeTags: zod_1.z.string().optional(),
vocalGender: zod_1.z.enum(['m', 'f']).optional(),
styleWeight: zod_1.z.number().min(0).max(1).optional(),
weirdnessConstraint: zod_1.z.number().min(0).max(1).optional(),
audioWeight: zod_1.z.number().min(0).max(1).optional(),
personaId: zod_1.z.string().optional(),
personaModel: PersonaModelEnum,
callBackUrl: CallbackUrl,
}).strict();
// 9. Upload and Extend (12 credits)
exports.UploadAndExtendSchema = zod_1.z.object({
uploadUrl: zod_1.z.string().url().describe('Public URL of audio file to extend'),
defaultParamFlag: zod_1.z.boolean(),
prompt: zod_1.z.string().optional(),
style: zod_1.z.string().optional(),
title: zod_1.z.string().optional(),
continueAt: zod_1.z.number().positive().optional(),
model: ModelEnum,
callBackUrl: CallbackUrl,
}).strict();
// 10. Separate Vocals (10 credits)
exports.SeparateVocalsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Original generation task ID'),
audioId: zod_1.z.string().describe('Track ID to separate'),
callBackUrl: CallbackUrl,
}).strict();
// 11. Separate Stems / Advanced (20 credits)
exports.SeparateStemsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Original generation task ID'),
audioId: zod_1.z.string().describe('Track ID to separate into stems'),
callBackUrl: CallbackUrl,
}).strict();
// 12. Create Music Video (2 credits)
exports.CreateVideoSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Music generation task ID'),
audioId: zod_1.z.string().describe('Track ID for the video'),
author: zod_1.z.string().optional().describe('Artist name'),
domainName: zod_1.z.string().optional().describe('Brand domain'),
callBackUrl: CallbackUrl,
}).strict();
// 13. Create Music Cover (0 credits)
exports.CreateCoverSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Music generation task ID'),
audioId: zod_1.z.string().describe('Track ID for cover image'),
callBackUrl: CallbackUrl,
}).strict();
// 14. Convert to WAV (0.4 credits)
exports.ConvertToWavSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Music generation task ID'),
audioId: zod_1.z.string().describe('Track ID to convert'),
callBackUrl: CallbackUrl,
}).strict();
// 15. Boost Style (0.4 credits)
exports.BoostStyleSchema = zod_1.z.object({
content: zod_1.z.string().describe('Short style description, e.g. "Pop, Mysterious"'),
}).strict();
// 16. Generate Persona (0 credits)
exports.GeneratePersonaSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Music generation task ID to derive persona from'),
audioId: zod_1.z.string().describe('Track ID to derive persona from'),
}).strict();
// 17. Generate Mashup (12 credits)
exports.GenerateMashupSchema = zod_1.z.object({
uploadUrlList: zod_1.z.array(zod_1.z.string().url()).length(2).describe('Exactly 2 audio URLs to mash up'),
customMode: zod_1.z.boolean(),
instrumental: zod_1.z.boolean().optional(),
prompt: zod_1.z.string().describe('Mashup concept / lyrics'),
style: zod_1.z.string().optional(),
title: zod_1.z.string().optional(),
model: zod_1.z.enum(['V4', 'V4_5', 'V4_5PLUS', 'V4_5ALL', 'V5']),
negativeTags: zod_1.z.string().optional(),
vocalGender: zod_1.z.enum(['m', 'f']).optional(),
styleWeight: zod_1.z.number().min(0).max(1).optional(),
weirdnessConstraint: zod_1.z.number().min(0).max(1).optional(),
audioWeight: zod_1.z.number().min(0).max(1).optional(),
callBackUrl: CallbackUrl,
}).strict();
// 18. Get Task Status (0 credits)
exports.GetTaskStatusSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Task ID to check'),
}).strict();
// 19. Get Timestamped Lyrics (0.5 credits)
exports.GetTimestampedLyricsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Music generation task ID'),
audioId: zod_1.z.string().describe('Track ID'),
}).strict();
// 20. Get Lyrics Details (0 credits)
exports.GetLyricsDetailsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Lyrics generation task ID'),
}).strict();
// 21. Get WAV Details (0 credits)
exports.GetWavDetailsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('WAV conversion task ID'),
}).strict();
// 22. Get Vocal Separation Details (0 credits)
exports.GetVocalSeparationDetailsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Vocal separation task ID'),
}).strict();
// 23. Get Video Details (0 credits)
exports.GetVideoDetailsSchema = zod_1.z.object({
taskId: zod_1.z.string().describe('Music video task ID'),
}).strict();
// 24. Get Credits (0 credits)
exports.GetCreditsSchema = zod_1.z.object({}).strict();
//# sourceMappingURL=schemas.js.map
File diff suppressed because one or more lines are too long
+7
View File
@@ -0,0 +1,7 @@
export interface ToolDefinition {
name: string;
description: string;
inputSchema: object;
}
export declare const TOOLS: ToolDefinition[];
//# sourceMappingURL=tools.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAgBD,eAAO,MAAM,KAAK,EAAE,cAAc,EAyHjC,CAAC"}
+45
View File
@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TOOLS = void 0;
const zod_to_json_schema_1 = require("zod-to-json-schema");
const schemas_1 = require("./schemas");
function makeTool(name, description, schema) {
const jsonSchema = (0, zod_to_json_schema_1.zodToJsonSchema)(schema, {
name,
$refStrategy: 'none',
});
const definition = jsonSchema.definitions?.[name] ?? jsonSchema;
definition.additionalProperties = false;
return {
name,
description,
inputSchema: definition,
};
}
exports.TOOLS = [
makeTool('suno_generate_music', 'Generate music from a text prompt. Cost: 12 credits. Returns 2 tracks. Use customMode=true for full control (style, title, lyrics).', schemas_1.GenerateMusicSchema),
makeTool('suno_generate_lyrics', 'Generate lyrics from a topic. Cost: 0.4 credits.', schemas_1.GenerateLyricsSchema),
makeTool('suno_generate_sounds', 'Generate sound effects / ambient loops. Cost: 2.5 credits. Model V5 only.', schemas_1.GenerateSoundsSchema),
makeTool('suno_extend_music', 'Extend an existing track. Cost: 12 credits. Set defaultParamFlag=false to reuse source parameters.', schemas_1.ExtendMusicSchema),
makeTool('suno_replace_section', 'Replace a time segment of a track. Cost: 5 credits. Provide start/end seconds.', schemas_1.ReplaceSectionSchema),
makeTool('suno_add_vocals', 'Generate vocals over an instrumental track. Cost: 12 credits.', schemas_1.AddVocalsSchema),
makeTool('suno_add_instrumental', 'Generate backing music for a vocal/melody track. Cost: 12 credits.', schemas_1.AddInstrumentalSchema),
makeTool('suno_upload_and_cover', 'Upload an audio file URL and create a cover in a new style. Cost: 12 credits. Audio must be <= 8 minutes.', schemas_1.UploadAndCoverSchema),
makeTool('suno_upload_and_extend', 'Upload an audio file URL and extend it. Cost: 12 credits.', schemas_1.UploadAndExtendSchema),
makeTool('suno_separate_vocals', 'Separate vocals from music. Cost: 10 credits.', schemas_1.SeparateVocalsSchema),
makeTool('suno_separate_stems', 'Advanced stem separation (per-instrument). Cost: 20 credits.', schemas_1.SeparateStemsSchema),
makeTool('suno_create_video', 'Create an MP4 video from a music track. Cost: 2 credits.', schemas_1.CreateVideoSchema),
makeTool('suno_create_cover', 'Generate a cover image for a track. Cost: 0 credits.', schemas_1.CreateCoverSchema),
makeTool('suno_convert_to_wav', 'Convert a track to WAV format. Cost: 0.4 credits.', schemas_1.ConvertToWavSchema),
makeTool('suno_boost_style', 'Enhance a short style description into a detailed prompt. Cost: 0.4 credits.', schemas_1.BoostStyleSchema),
makeTool('suno_generate_persona', 'Create a reusable persona from a track. Cost: 0 credits.', schemas_1.GeneratePersonaSchema),
makeTool('suno_generate_mashup', 'Create a mashup from exactly 2 audio URLs. Cost: 12 credits.', schemas_1.GenerateMashupSchema),
makeTool('suno_get_task_status', 'Check music/extend/cover task status and get resulting tracks including prompt, title, tags and audio_url. Cost: 0 credits.', schemas_1.GetTaskStatusSchema),
makeTool('suno_get_timestamped_lyrics', 'Get timestamped lyrics for a track. Cost: 0.5 credits.', schemas_1.GetTimestampedLyricsSchema),
makeTool('suno_get_lyrics_details', 'Get details of a lyrics generation task. Cost: 0 credits.', schemas_1.GetLyricsDetailsSchema),
makeTool('suno_get_wav_details', 'Get details of a WAV conversion task. Cost: 0 credits.', schemas_1.GetWavDetailsSchema),
makeTool('suno_get_vocal_separation_details', 'Get details of a vocal/stem separation task. Cost: 0 credits.', schemas_1.GetVocalSeparationDetailsSchema),
makeTool('suno_get_video_details', 'Get details of a music video task. Cost: 0 credits.', schemas_1.GetVideoDetailsSchema),
makeTool('suno_get_credits', 'Get remaining Suno API credits. Cost: 0 credits.', schemas_1.GetCreditsSchema),
];
//# sourceMappingURL=tools.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AACrD,uCAyBmB;AAQnB,SAAS,QAAQ,CAAC,IAAY,EAAE,WAAmB,EAAE,MAA8C;IACjG,MAAM,UAAU,GAAG,IAAA,oCAAe,EAAC,MAAa,EAAE;QAChD,IAAI;QACJ,YAAY,EAAE,MAAM;KACrB,CAAC,CAAC;IACH,MAAM,UAAU,GAAI,UAAkB,CAAC,WAAW,EAAE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