@graisol/gpt-image-mcp
Version:
A Model Context Protocol (MCP) server for OpenAI GPT-Image-1 image generation and editing
60 lines (59 loc) • 1.65 kB
TypeScript
/**
* Image Manager for handling image storage, caching, and metadata
*/
import { ImageMetadata, GenerationHistory, ServerConfig } from '../types/index.js';
export declare class ImageManager {
private config;
private historyFile;
private storageDir;
constructor(config: ServerConfig);
/**
* Initialize storage directory and history file
*/
private initializeStorage;
/**
* Store image metadata in the history
*/
storeImageMetadata(metadata: ImageMetadata): Promise<void>;
/**
* Get information about a specific image
*/
getImageInfo(imageId: string): Promise<ImageMetadata | null>;
/**
* List recent image generations with optional filtering
*/
listGenerations(options?: {
limit?: number;
offset?: number;
filter?: string;
}): Promise<GenerationHistory>;
/**
* Save image data to local storage (for base64 responses or URLs)
*/
saveImageData(imageId: string, data: string, format: 'base64' | 'url'): Promise<string>;
/**
* Clean up old images and metadata
*/
cleanupOldImages(): Promise<void>;
/**
* Get storage statistics
*/
getStorageStats(): Promise<{
total_images: number;
storage_size: number;
oldest_image: number;
newest_image: number;
}>;
/**
* Load generation history from file
*/
private loadHistory;
/**
* Save generation history to file
*/
private saveHistory;
/**
* Validate image data (basic validation)
*/
validateImageData(data: string, format: 'base64' | 'url'): boolean;
}