UNPKG

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),

29 lines • 1.15 kB
// Helper for lazy-loading optional dependencies. // // Heavy or feature-gated packages (cloud SDKs, AI SDKs, cloudflared) live in // `optionalDependencies` so a `npm install --no-optional comfyui-mcp` install // still yields a working server. The features that need those deps surface a // clear "install <pkg>" error instead of crashing on import. import { ModelError } from "./errors.js"; const cache = new Map(); export async function requireOptionalDep(spec, options) { const cached = cache.get(spec); if (cached !== undefined) return cached; try { const mod = (await import(spec)); cache.set(spec, mod); return mod; } catch (err) { const feature = options?.feature ?? spec; const installHint = options?.installHint ?? `npm install ${spec}`; throw new ModelError(`Optional dependency for ${feature} is not installed. ` + `To enable it, run: ${installHint}`, { code: "OPTIONAL_DEP_MISSING", package: spec, cause: err instanceof Error ? err.message : String(err), }); } } //# sourceMappingURL=optional-dep.js.map