Agent skill & CLI
A skill directory and a zero-dependency Node CLI that emits structured JSON, so a terminal or coding agent can generate, edit and process images by shelling out to one command.
Install
The skill ships as a directory containing SKILL.md, a reference guide and the CLI script. Add it with the skills installer:
npx skills add imagemcp/skillSource lives in the skill repository if you would rather vendor it into your own agent setup.
Connect your account
The CLI resolves credentials in two ways. An environment variable is simplest for CI and scripted agents:
export IMAGEMCP_API_KEY="sk-img-gen-…"
export IMAGEMCP_API_URL="https://api.imagemcpserver.com" # optionalInteractively, run the login flow instead — it opens a browser, lets you pick or create a key, and stores it under your home directory:
npx imagemcp loginUnauthenticated calls fail loudly
Command reference
Every command prints JSON on stdout. The names line up one-to-one with the MCP tools and REST endpoints:
| Command | MCP tool | Credits | Does |
|---|---|---|---|
user:info | get_user_info | Free | Read the authenticated account's profile, plan and remaining credit balance. |
models:list | list_models | Free | List every live image model you can pass as the `model` parameter, with its credit cost. |
generate | generate_image | Model cost | Turn a text prompt — optionally guided by reference images — into a hosted image. |
generate_transparent | generate_transparent_image | Model cost + 8 | Generate an image from a prompt and return it as a cut-out PNG with a transparent background. |
edit | edit_image | Model cost | Change an existing image with natural-language instructions. |
remove_bg | remove_background | 8 credits | Strip the background from an image and return a transparent PNG. |
upscale | upscale_image | 15 credits | Increase an image's resolution while sharpening detail. |
text_to_svg | text_to_svg | 5 credits | Generate real vector SVG markup — icons, logos and marks — from a prompt. |
compress | compress_image | 1 credit | Shrink an image's file size with quality control, and report exactly how much was saved. |
convert | convert_format | 1 credit | Convert an image between PNG, JPEG, WebP and other common formats. |
multicall | multicall | Sum of the batch | Run several image tools concurrently in a single request. |
./scripts/imagemcp.js user:info
./scripts/imagemcp.js generate \
--prompt "Paper-craft fox in tall grass, soft morning light" \
--aspect-ratio "16:9" \
--out ./fox.png
./scripts/imagemcp.js edit \
--image ./fox.png \
--prompt "Make it dusk, add fireflies" \
--out ./fox-dusk.pngCommon flags
--prompt— the instruction. Required by every generation command.--image— input image foredit,remove_bg,upscale,compressandconvert.--ref— a reference image forgenerate; repeat the flag for several.--out— write the result to a local file instead of printing the URL.--modeland--aspect-ratio— override the generation defaults.--response-format b64_json— return base64 instead of a hosted URL.--scale,--quality,--format— options forupscale,compressandconvert.
Batching with multicall
When an agent needs several images in one turn, one multicall beats a loop of generate calls: the requests run concurrently and the credit total is settled once.
[
{ "tool": "generate_image", "args": { "prompt": "App hero image, 16:9", "aspectRatio": "16:9" } },
{ "tool": "generate_transparent_image", "args": { "prompt": "Mascot fox, isolated subject" } },
{ "tool": "text_to_svg", "args": { "prompt": "Minimalist lightning bolt icon" } }
]./scripts/imagemcp.js multicall ./batch_requests.jsonHow agents should use it
The skill file ships with instructions for the agent itself. Two are worth knowing about because they change what a run costs:
- Check
user:infofirst. A run that starts without enough credits fails partway through, having already spent what it had. - Expand thin prompts before generating. "a logo" produces a generic result and a retry; a described logo usually lands first time.
- Batch independent requests with
multicallinstead of issuing sequentialgeneratecalls.
Retries cost credits
FAQ
What is the difference between the skill and the MCP server?
They expose the same tools through different channels. The MCP server is for clients that speak the Model Context Protocol; the skill is for agents that can run shell commands — the CLI prints JSON they can parse directly.
Does the CLI need any dependencies?
No. It runs on Node.js 18 or newer with no packages to install.
Where is the API key stored?
Either in the IMAGEMCP_API_KEY environment variable, or in ~/.imagemcp/config.json after you run the login flow. The CLI resolves the environment variable first.