comfyui-mcp
Version:
Local-first, agent-native control plane for ComfyUI — MCP server + autonomous sidebar agent that drives your live graph in natural language on ANY LLM: Claude/ChatGPT/Gemini on your subscription (no API key), free local models via Ollama (fully offline),
42 lines • 1.74 kB
JavaScript
import { ValidationError } from "../../utils/errors.js";
import { isAzureBlobUrl, downloadAzureBlobToFile, uploadAzureBlobFile } from "./azure-blob.js";
import { uploadHfFile } from "./hf.js";
import { isHttpUrl, uploadHttpFile } from "./http.js";
import { downloadS3ToFile, isS3Url, uploadS3File } from "./s3.js";
export function supportsCloudDownload(url) {
return isS3Url(url) || isAzureBlobUrl(url);
}
export async function downloadCloudUrlToFile(url, targetPath, auth = {}) {
if (isS3Url(url)) {
await downloadS3ToFile(url, targetPath, auth.s3);
return;
}
if (isAzureBlobUrl(url)) {
await downloadAzureBlobToFile(url, targetPath);
return;
}
throw new ValidationError("Unsupported cloud storage download URL. Expected s3://bucket/key or an Azure Blob URL.");
}
export async function uploadToStorage(source, destination, auth = {}) {
const keys = Object.keys(destination);
if (keys.length !== 1) {
throw new ValidationError("Provide exactly one upload destination: s3, azure, http, or hf.");
}
if ("s3" in destination) {
return uploadS3File(source, destination.s3, auth.s3);
}
if ("azure" in destination) {
return uploadAzureBlobFile(source, destination.azure);
}
if ("http" in destination) {
if (!isHttpUrl(destination.http.url)) {
throw new ValidationError("http.url must start with http:// or https://.");
}
return uploadHttpFile(source, destination.http);
}
if ("hf" in destination) {
return uploadHfFile(source, destination.hf);
}
throw new ValidationError("Unsupported upload destination. Expected s3, azure, http, or hf.");
}
//# sourceMappingURL=index.js.map