Skip to main content
Glama

vLLM Image MCP Server

An MCP (Model Context Protocol) server that provides AI-powered image generation tools via any vLLM-Omni compatible endpoint. The server is model-aware, GPU-aware, and supports both single and batch image generation with automatic parameter tuning based on the loaded model.

Features

  • 10 MCP tools for image generation, batch processing, progress monitoring, and system status

  • Model-aware defaults — auto-detects the loaded model and applies optimal parameters

  • 5 built-in model profiles: FLUX.2-klein 4B/9B, Qwen-Image variants, Z-Image-Turbo

  • Multi-format output — save as PNG (lossless), JPG (quality=95), or WebP (smallest, ideal for web)

  • Up to 4K resolution — FLUX Klein models support resolutions up to 3840x2160

  • Flexible output paths — the AI model chooses where to save images per-call (e.g. directly into your project's assets/ folder)

  • Batch generation with automatic concurrency control based on estimated VRAM

  • Batch progress monitoring — poll running batches to track completion and prevent timeouts

  • Resolution validation — snaps to valid multiples, clamps to megapixel limits

  • Aspect ratio presets — use shortcuts like 16:9, 16:9_2k, 16:9_4k instead of raw pixels

Related MCP server: ImageGen MCP

Tools

Tool

Description

generate_image

Generate a single image from a text prompt

batch_generate

Generate multiple images concurrently (max 20)

get_model_info

Get current model info and recommended parameters

list_presets

List aspect ratio presets for the current model

estimate_generation

Estimate time and resource usage before generating

gpu_status

Check GPU/VRAM availability for capacity planning

server_health

Check vLLM server connectivity and status

cancel_batch

Cancel a running batch generation

check_batch_progress

Check progress of a running batch generation

list_active_batches

List all currently running batch jobs

Dynamic Output Directory

Both generate_image and batch_generate require an output_dir parameter. The AI model decides where to save images based on your project context — no hardcoded paths needed:

generate_image(prompt="A hero banner", output_dir="./src/assets/images")
batch_generate(prompts=["cat", "dog"], output_dir="./public/img")

This means images land exactly where your project needs them.

Output Formats

Both generate_image and batch_generate support a format parameter:

Format

Use Case

Quality

File Size

png (default)

Lossless quality, transparency support

Lossless

Largest

jpg

General use, photographs

95% quality

~70% smaller

webp

Web projects, optimized delivery

90% quality

~80% smaller

generate_image(prompt="A hero banner", output_dir="./assets", format="webp")
batch_generate(prompts=["cat", "dog"], output_dir="./public", format="jpg")

The AI model chooses the format based on context (e.g. webp for web projects, png for graphic design).

Batch Progress Monitoring

For long-running batch generations, use check_batch_progress to poll every ~50 seconds:

# Start batch
batch_generate(prompts=[...], output_dir="./output")  # returns batch_id

# Poll progress
check_batch_progress(batch_id="batch_abc123def456")

# Discover running batches
list_active_batches()

Prerequisites

  • Python 3.11+

  • A running vLLM-Omni server with an image generation model loaded

  • pip or uv for package installation

Installation

From source

git clone https://github.com/sumitchatterjee13/vllm-image-mcp-server.git
cd vllm-image-mcp-server
pip install -e .

Verify installation

vllm-image-mcp --help

Or run directly:

python -m vllm_image_mcp.server --help

Usage

Standalone

# Default: connects to http://localhost:6655
vllm-image-mcp

# Custom vLLM server URL
vllm-image-mcp --vllm-url http://192.168.1.100:6655

# With custom timeout
vllm-image-mcp --vllm-url http://localhost:6655 --timeout 600

CLI Arguments

Argument

Default

Description

--vllm-url

http://localhost:6655

Base URL of the vLLM-Omni server

--max-concurrent

auto

Max concurrent generations for batch

--timeout

300

Request timeout in seconds

Note: There is no --output-dir flag. The output path is provided by the AI model on every generate_image / batch_generate call, so images are saved wherever the project needs them.


MCP Client Configuration

Claude Code

Option A — CLI command:

claude mcp add vllm-image -- python -m vllm_image_mcp.server --vllm-url http://localhost:6655

Option B — Project config (.mcp.json in project root):

{
  "mcpServers": {
    "vllm-image": {
      "command": "python",
      "args": [
        "-m", "vllm_image_mcp.server",
        "--vllm-url", "http://localhost:6655"
      ]
    }
  }
}

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "vllm-image": {
      "command": "python",
      "args": [
        "-m", "vllm_image_mcp.server",
        "--vllm-url", "http://localhost:6655"
      ]
    }
  }
}

Cursor

Create .cursor/mcp.json in your project root (or ~/.cursor/mcp.json for global):

{
  "mcpServers": {
    "vllm-image": {
      "command": "python",
      "args": [
        "-m", "vllm_image_mcp.server",
        "--vllm-url", "http://localhost:6655"
      ]
    }
  }
}

Kilo Code

Create .kilocode/mcp.json in your project root:

{
  "mcpServers": {
    "vllm-image": {
      "command": "python",
      "args": [
        "-m", "vllm_image_mcp.server",
        "--vllm-url", "http://localhost:6655"
      ],
      "alwaysAllow": [],
      "disabled": false
    }
  }
}

Windows Note

On native Windows (not WSL/Git Bash), if you get "Connection closed" errors, wrap the command with cmd:

{
  "mcpServers": {
    "vllm-image": {
      "command": "cmd",
      "args": [
        "/c", "python", "-m", "vllm_image_mcp.server",
        "--vllm-url", "http://localhost:6655"
      ]
    }
  }
}

Remote vLLM Server

To connect to a vLLM server on another machine, change the --vllm-url argument:

"args": [
  "-m", "vllm_image_mcp.server",
  "--vllm-url", "http://192.168.1.100:6655"
]

Supported Models

The server includes built-in profiles with optimal defaults for these models:

Model

Type

Steps

Guidance

Neg. Prompt

Est. VRAM

Max Resolution

black-forest-labs/FLUX.2-klein-4B

Distilled

4

1.0

No

13 GB

4K (9.0 MP)

black-forest-labs/FLUX.2-klein-9B

Distilled

4

1.0

No

29 GB

4K (9.0 MP)

Qwen/Qwen-Image-2512

Standard

28

5.0

Yes

40 GB

2K (4.0 MP)

Qwen/Qwen-Image

Standard

50

5.0

Yes

40 GB

2K (4.0 MP)

Tongyi-MAI/Z-Image-Turbo

Distilled

8

1.0

No

16 GB

2K (4.0 MP)

Unknown models automatically use fallback defaults (steps=28, guidance=5.0, 1024x1024).

FLUX Klein Resolution Presets

FLUX Klein models support resolutions from standard to 4K:

Preset

Resolution

Megapixels

Use Case

1:1

1024x1024

1.0 MP

Default, fast

16:9

1024x576

0.6 MP

Widescreen, fast

9:16

576x1024

0.6 MP

Portrait, fast

1:1_2k

2048x2048

4.2 MP

High detail square

16:9_2k

2560x1440

3.7 MP

2K widescreen

4:3_2k

2048x1536

3.1 MP

2K standard

16:9_4k

3840x2160

8.3 MP

4K, maximum detail

9:16_4k

2160x3840

8.3 MP

4K portrait

4K resolutions take significantly longer and use more VRAM. Use only when the user needs high-resolution output (wallpapers, print-quality, posters).


Prompt Writing Guide

The server includes model-specific prompt guidance that is returned by the get_model_info tool. The AI model should call get_model_info before its first generation to learn the loaded model's prompting rules. Below is a summary.

General Rules (All Models)

  • Write prompts as natural language prose, never comma-separated tags

  • Put the subject first — the first 10-20 words carry the most weight

  • Always specify lighting — it has the single greatest impact on quality

  • Ideal length: 30-80 words

  • Do NOT use quality tags like 8k, masterpiece, best quality, ultra HD — they waste tokens

  • Do NOT describe sequential actions — images are a single moment

  • Do NOT mix conflicting styles (e.g. "photorealistic oil painting")

  • For photorealism, reference real cameras: Shot on Sony A7IV, 85mm lens at f/2.0

  • For text in images, use quotation marks: The sign reads "OPEN"

FLUX.2 Klein (Distilled Models)

  • Negative prompts are ignored at CFG 1.0 — do not send them

  • Be extra explicit and descriptive — no auto-enhancement available

  • Every word must contribute visual information; filler text hurts quality

  • Use emphasis phrases: "prominently featuring", "the focal point is"

Good prompt:

Professional studio product shot on polished concrete. A minimalist ceramic
coffee mug with matte black finish, steam rising from hot coffee, centered
in frame. Ultra-realistic commercial photography. Three-point softbox
lighting, diffused highlights, no harsh shadows. Shot with 85mm lens at f/5.6.

Bad prompt:

coffee mug, black, steam, studio, professional, 8k, masterpiece, best quality,
ultra detailed, sharp focus

Qwen-Image / Z-Image (Standard Models)

  • Use negative prompts — they improve results significantly

  • Good default negative: blurry, low quality, distorted, watermark, oversaturated, artificial

  • For portraits add: extra fingers, deformed hands, unnatural proportions

  • The model interprets prompts very literally — be precise

  • For text-heavy images, raise guidance_scale to 7.0

  • Wrap desired text in double quotes and specify font style

  • Use photograph instead of photorealistic or 3d render

Good prompt:

A futuristic sports car parked under neon city lights, photorealistic style.
Reflections shimmer on wet asphalt streets. Dramatic side lighting with deep
shadows and vibrant highlights. "Night Racer" in metallic chrome text on the hood.

Negative prompt:

blurry, low quality, distorted, watermark, oversaturated

Running Tests

pip install pytest pytest-asyncio
pytest tests/ -v

License

MIT

Available Tools

10 tools
batch_generateA

Start a batch image generation (returns immediately, does NOT block).

Returns a batch_id immediately. Images generate in the background.

IMPORTANT WORKFLOW:

  1. Call batch_generate → returns batch_id

  2. WAIT 50 SECONDS before calling check_batch_progress (images need time to generate)

  3. Call check_batch_progress(batch_id) — if still in_progress, WAIT another 50 seconds and repeat

  4. When status is "completed", the response contains all results and file paths

Do NOT call check_batch_progress immediately — always wait 50 seconds between calls.

Each prompt should follow the same rules as generate_image: natural language prose, subject first, explicit lighting, 30-80 words each, no quality tags.

Args: prompts: List of natural language text prompts (max 20). Each prompt should be descriptive prose, not comma-separated tags. output_dir: Directory to save all images. Provide a path appropriate for the user's project. width: Width for all images in pixels. height: Height for all images in pixels. aspect_ratio: Aspect ratio shortcut for all images. FLUX Klein supports up to 4K (e.g. "16:9_4k"). num_inference_steps: Steps for all images. guidance_scale: CFG scale for all images. seeds: List of seeds (must match prompts length if provided). max_concurrent: Override concurrent limit (auto-detected if omitted). format: Output image format for all images. Options: "png" (default), "jpg", "webp". Choose based on context.

Inputs: prompts (required), output_dir (required), seeds, width, +6 more. Returns: result

cancel_batchB
Destructive

Cancel a running batch generation.

Args: batch_id: The batch ID returned by batch_generate.

Inputs: batch_id (required). Returns: result

check_batch_progressA
Read-only

Check progress of a batch generation.

TIMING: Wait 50 seconds after batch_generate before calling this. If status is still "in_progress", wait another 50 seconds before calling again.

While in progress: returns completion counts and per-image statuses. When finished: returns full results with all file paths, then cleans up the batch.

Args: batch_id: The batch ID returned by batch_generate.

Inputs: batch_id (required). Returns: result

estimate_generationB
Read-only

Estimate generation time and resource usage without actually generating.

Args: num_images: Number of images to estimate for. width: Image width in pixels. height: Image height in pixels. num_inference_steps: Steps per image.

Inputs: width, height, num_images, num_inference_steps. Returns: result

generate_imageA
Idempotent

Generate a single image from a text prompt.

PROMPT WRITING RULES (call get_model_info first for model-specific guidance):

  • Write as natural language prose, NOT comma-separated tags.

  • Put the subject first (first 10-20 words carry the most weight).

  • Always describe lighting explicitly.

  • 30-80 words ideal. Do NOT use quality tags like '8k, masterpiece'.

  • For photorealism: reference real cameras/lenses ('Shot on Sony A7IV, 85mm f/2.0').

  • For text in images: use quotation marks ('The sign reads "OPEN"').

Args: prompt: Natural language description of the image. Describe the subject first, then environment, style, and lighting. Be specific and descriptive. output_dir: Directory to save the image. Provide a path appropriate for the user's project (e.g. "./assets/images", "./public/img", "./output"). negative_prompt: What to avoid (only works with Qwen-Image models, ignored by FLUX). For Qwen, good defaults: 'blurry, low quality, distorted, watermark, oversaturated'. width: Image width in pixels (must be multiple of 16). height: Image height in pixels (must be multiple of 16). aspect_ratio: Shortcut for resolution, e.g. "16:9", "1:1", "9:16", "16:9_2k", "16:9_4k" (overrides width/height). FLUX Klein supports up to 4K. num_inference_steps: Number of diffusion steps (fewer = faster, more = higher quality). guidance_scale: CFG scale. For Qwen-Image: raise to 7.0 for text-heavy images. seed: Random seed for reproducibility. filename: Output filename (auto-generated if omitted). format: Output image format. Options: "png" (lossless, default), "jpg" (lossy, quality=95, good for general use), "webp" (lossy, quality=90, smallest files, ideal for web projects). Choose based on context.

Inputs: prompt (required), output_dir (required), seed, width, +7 more. Returns: result

get_model_infoA
Read-only

Get information about the currently loaded model, its recommended parameters, and prompt writing guidance.

IMPORTANT: Call this before your first image generation to get model-specific prompt_guidance. Different models (FLUX vs Qwen) require very different prompting strategies.

Returns the model name, type, default parameters, supported aspect ratios, VRAM estimate, and detailed prompt_guidance with rules and examples.

Inputs: no named parameters. Returns: result

gpu_statusA
Read-only

Check GPU memory usage and availability for generation capacity planning.

Returns estimated VRAM usage, free memory, and recommended max concurrent generations.

Inputs: no named parameters. Returns: result

list_active_batchesA
Read-only

List all currently running batch generations and their IDs.

Use this to find batch IDs for progress monitoring with check_batch_progress.

Inputs: no named parameters. Returns: result

list_presetsA
Read-only

List available resolution presets and aspect ratios for the current model.

Returns all supported aspect ratios with their pixel dimensions, resolution constraints, and max megapixels.

Inputs: no named parameters. Returns: result

server_healthA
Read-only

Check if the vLLM-Omni server is running, ready, and responsive.

Returns server status, loaded model, response latency, and version.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have clearly distinct roles: single vs batch generation, and the batch lifecycle (start/progress/cancel/list) is well-separated. A few pairs overlap mildly — get_model_info vs list_presets both surface aspect ratios/parameters, and gpu_status vs server_health both report readiness — but descriptions and arg differences make the intended pick clear.

    Naming Consistency3/5

    The dominant pattern is verb_noun (generate_image, get_model_info, list_presets, estimate_generation, cancel_batch, check_batch_progress, list_active_batches), but there are deviations: batch_generate reverses to noun_verb, and gpu_status/server_health are bare noun phrases with no verb. Still readable, but not a single predictable convention.

    Tool Count5/5

    Ten tools is well within a comfortable range and each one earns its place: generation, batch lifecycle, introspection (model info, presets, GPU, health) and estimation all serve real pre/post-generation needs. Nothing looks redundant or like padding.

    Completeness4/5

    The surface covers the full basic lifecycle: inspect model/health/VRAM, estimate, generate single or batch, poll progress, cancel, and discover active batches. Gaps exist for image-to-image/editing/upscaling and for listing previously generated outputs, but core text-to-image workflows have no dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables text-to-image generation and image-to-image editing through the built-in relay or any OpenAI-compatible endpoint, with fast and high-precision models, square and custom-dimension sizes up to true 4K, and quality controls. Generated or edited images are written to local directories and returned as absolute file paths.
      46 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables complete control of the OpenAI Images API for text-to-image generation, image editing, multi-image references, masks, streaming previews, and resumable jobs, with per-request model and parameter selection.
      8
      MIT