UNPKG

midjourney-mcp

Version:

A Model Context Protocol server for Midjourney integration via MJ API

89 lines 2.45 kB
/** * MJ API client for Midjourney operations */ import { Config } from "./config.js"; export interface ApiResponse<T = any> { code: number; description: string; properties?: Record<string, any>; result?: T; } export interface TaskResponse { action?: 'IMAGINE' | 'UPSCALE' | 'VARIATION' | 'REROLL' | 'DESCRIBE' | 'BLEND'; description?: string; failReason?: string; finishTime?: number; id?: string; imageUrl?: string; progress?: string; prompt?: string; promptEn?: string; properties?: Record<string, any>; startTime?: number; state?: string; status?: 'NOT_START' | 'SUBMITTED' | 'IN_PROGRESS' | 'FAILURE' | 'SUCCESS'; submitTime?: number; buttons?: Array<{ customId: string; label: string; type: string; style: string; emoji: string; }>; } export interface ImagineRequest { prompt: string; base64Array?: string[]; notifyHook?: string; state?: string; } export interface ChangeRequest { taskId: string; action: 'UPSCALE' | 'VARIATION' | 'REROLL'; index?: number; notifyHook?: string; state?: string; } export declare class ApiError extends Error { code: number; description: string; originalError?: any | undefined; constructor(code: number, description: string, originalError?: any | undefined); } export declare class MJApiClient { private config; constructor(config: Config); /** * Make HTTP request with retry logic */ private makeRequest; /** * Submit an imagine task */ submitImagine(request: ImagineRequest): Promise<ApiResponse<string>>; /** * Get task by ID */ getTask(taskId: string): Promise<TaskResponse>; /** * Submit upscale task */ submitUpscale(taskId: string, index: number, state?: string): Promise<ApiResponse<string>>; /** * Submit variation task */ submitVariation(taskId: string, index: number, state?: string): Promise<ApiResponse<string>>; /** * Submit reroll task */ submitReroll(taskId: string, state?: string): Promise<ApiResponse<string>>; /** * Submit blend task */ submitBlend(base64Array: string[], state?: string): Promise<ApiResponse<string>>; /** * Submit describe task */ submitDescribe(base64: string, state?: string): Promise<ApiResponse<string>>; } //# sourceMappingURL=api-client.d.ts.map