@dondonudonjp/vertexai-imagen-mcp-server
Version:
[DEPRECATED] MCP Server for Vertex AI Imagen image generation. Imagen endpoints shut down 2026-06-30; migrate to the nanoBanana MCP Server (Gemini image models).
86 lines • 3.73 kB
TypeScript
/**
* Get default output directory (cross-platform)
*
* Priority:
* 1. VERTEXAI_IMAGEN_OUTPUT_DIR environment variable
* 2. ~/Downloads/vertexai-imagen-files (default)
*/
export declare function getDefaultOutputDirectory(): string;
/**
* Generate unique file path by adding number suffix if file exists
*
* Examples:
* - image.png → image.png (if not exists)
* - image.png → image_1.png (if image.png exists)
* - image.png → image_2.png (if image.png and image_1.png exist)
*
* @param filePath Original file path
* @returns Unique file path (may be the same as input if no conflict)
*/
export declare function generateUniqueFilePath(filePath: string): Promise<string>;
/**
* Normalize and validate output path (cross-platform)
*
* - Absolute paths: used as-is (must be within configured base directory)
* - Relative paths: resolved relative to default output directory
* - Creates parent directory if it doesn't exist
* - Optionally generates unique file name if file already exists
* - Validates path is within base directory (prevents path traversal attacks)
*
* @param outputPath Output file path
* @param autoNumbering If true, automatically add number suffix to avoid overwriting (default: true)
* @throws Error if path traversal is detected or directory creation fails
*/
export declare function normalizeAndValidatePath(outputPath: string, autoNumbering?: boolean): Promise<string>;
/**
* Resolve input file path (for reading existing files)
*
* - Absolute paths: used as-is (with WSL path conversion if needed, must be within configured base directory)
* - Relative paths: resolved relative to default output directory
* (assuming the file was generated by this tool and saved to output directory)
* - Validates path is within base directory (prevents path traversal attacks)
*
* @param inputPath Input file path
* @returns Absolute path
* @throws Error if path traversal is detected
*/
export declare function resolveInputPath(inputPath: string): string;
/**
* Get user-friendly display path
* Converts absolute path to ~ notation for better readability
*/
export declare function getDisplayPath(absolutePath: string): string;
/**
* Generate multiple file paths with numbered suffixes for multi-sample generation
*
* Examples:
* - generateMultipleFilePaths("image.png", 3) → ["image_1.png", "image_2.png", "image_3.png"]
* - generateMultipleFilePaths("output.jpg", 1) → ["output_1.jpg"]
*
* Each path is checked for uniqueness using generateUniqueFilePath to avoid overwriting.
*
* @param baseOutputPath Base output file path
* @param sampleCount Number of files to generate paths for
* @param autoNumbering If true, automatically add number suffix to avoid overwriting (default: true)
* @returns Array of unique file paths
*/
export declare function generateMultipleFilePaths(baseOutputPath: string, sampleCount: number, autoNumbering?: boolean): Promise<string[]>;
/**
* Validate that a resolved path is within a base directory
* Prevents path traversal attacks (CWE-22)
*
* @param targetPath - The path to validate (will be resolved to absolute path)
* @param basePath - The base directory path (will be resolved to absolute path)
* @throws Error if targetPath is outside basePath
*
* @example
* // Valid: path within base directory
* validatePathWithinBase('/home/user/images/photo.png', '/home/user/images');
*
* @example
* // Invalid: path traversal detected
* validatePathWithinBase('/home/user/images/../../../etc/passwd', '/home/user/images');
* // throws Error: Security Error: Path traversal detected
*/
export declare function validatePathWithinBase(targetPath: string, basePath: string): void;
//# sourceMappingURL=path.d.ts.map