img-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| IMG_MODEL | No | Default model used for generation/editing when model is not specified. | gpt-image-2.6-sunburst |
| OPENAI_ORG_ID | No | OpenAI Organization ID. | |
| IMG_OUTPUT_DIR | No | Default output directory. | ~/img-output |
| IMG_TIMEOUT_MS | No | Generation/editing request timeout in milliseconds. | 600000 |
| OPENAI_API_KEY | No | OpenAI or compatible gateway API key. Only needed for image generation/editing tools; local image tools can be used without it. | |
| IMG_CHROME_PATH | No | Chrome/Chromium executable path used by html_to_image. Auto-detected if omitted. | |
| IMG_MAX_RETRIES | No | Number of OpenAI SDK retries. | 2 |
| OPENAI_BASE_URL | No | API base URL, including the version path (usually /v1). Defaults to https://api.openai.com/v1. | https://api.openai.com/v1 |
| OPENAI_PROJECT_ID | No | OpenAI Project ID. | |
| IMG_DOWNLOAD_TIMEOUT_MS | No | Timeout in milliseconds for downloading image URLs returned by the API. | 120000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
IMG is a one-stop image toolkit. Generation tools (generate_image, edit_image) call the OpenAI Images API and require OPENAI_API_KEY. Local tools use sharp: crop_image, resize_image, rotate_image, convert_image, compress_image, get_image_info, extract_palette and remove_background. html_to_image renders with headless Chromium; echarts_to_image renders charts without a browser. All tools save to local disk and return absolute paths plus metadata; they never return image bytes. Local input paths must be absolute.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| generate_imageA | Generate one or more images with the OpenAI Images API (POST /v1/images/generations), save them to local disk, and return absolute file paths plus metadata. Image bytes are never returned. Requires OPENAI_API_KEY. The model defaults to IMG_MODEL (gpt-image-2.6-sunburst); set OPENAI_BASE_URL for OpenAI-compatible gateways. |
| edit_imageA | Edit or extend one or more local images with the OpenAI Images API (POST /v1/images/edits), optionally using a mask or markup, then save the results to local disk and return absolute file paths plus metadata. Source images must be local absolute paths (PNG, JPEG or WebP, under 50 MB each, up to 16). Requires OPENAI_API_KEY. Image bytes are never returned. |
| crop_imageA | Crop a local image to a pixel region and save the result. Coordinates are zero-based and apply after EXIF auto-orientation. Returns the source and output paths plus metadata. |
| resize_imageA | Resize a local image with sharp's cover/contain/fill/inside/outside fitting modes and save the result. At least one of width or height is required. |
| rotate_imageB | Rotate a local image by an arbitrary angle (clockwise for positive values), optionally applying EXIF auto-orientation first, and save the result. |
| convert_imageA | Convert a local image to PNG, JPEG, WebP, AVIF, TIFF or GIF. JPEG output is flattened onto the given background color (white by default). |
| compress_imageA | Re-encode a local image with a chosen quality/compression level, or binary-search the highest quality that fits target_size_bytes (JPEG, WebP, AVIF). Returns before/after sizes. |
| get_image_infoA | Read local image metadata and optional pixel statistics: format, dimensions, color space, channels, alpha, density, animation info, dominant/average color, opacity, entropy and sharpness. |
| extract_paletteA | Extract the dominant color palette from a local image using k-means clustering. Returns hex/RGB colors with coverage percentages; transparent pixels are ignored. |
| remove_backgroundA | Remove a solid or near-solid background from a local image using color-distance keying, with optional auto border sampling, tolerance, feathering and despill. Outputs a transparent PNG or WebP. This is not ML/AI segmentation. |
| html_to_imageA | Render an HTML string or HTTP(S) URL with headless Chromium and save a screenshot. Supports viewport size, full-page capture, element selectors, device scale factor and multiple output formats. Requires a local Chrome/Chromium (auto-detected or IMG_CHROME_PATH). |
| echarts_to_imageA | Render an Apache ECharts option object server-side (SVG renderer, no browser) and save it as PNG, JPEG, WebP, AVIF or SVG. Supports themes, background color and raster scale. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 12 tools
Most tools have clearly distinct purposes: crop, resize, rotate, convert, and compress each target a specific operation, and generate vs edit are clearly separated. A few boundaries blur slightly: get_image_info already reports dominant/average color and opacity, which overlaps with extract_palette, and html_to_image vs echarts_to_image both render markup to an image though from different sources.
All twelve tools follow a consistent snake_case verb_noun pattern (crop_image, remove_background, generate_image, convert_image, get_image_info, extract_palette, etc.). The two rendering tools (html_to_image, echarts_to_image) consistently share the same noun_to_image form.
Twelve tools sits comfortably in the well-scoped 3-15 range for an image processing server. Each tool covers a distinct capability (geometry ops, format/quality, AI generation, metadata, rendering) with no redundant entries.
Coverage is strong for a local image pipeline: geometric transforms, format/quality conversion, background removal, AI generate/edit, metadata, palette extraction, and two rendering paths. Minor gaps remain—no flip/mirror, no overlay/watermark/text compositing, and no batch operation across multiple files—but agents can work around these with existing tools.