Initial commit: Suno MCP server with 24 tools, proxy support, and opencode skill
This commit is contained in:
Vendored
+70
@@ -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
|
||||
Reference in New Issue
Block a user