home / mcp / ai image mcp server

AI Image MCP Server

Provides AI-powered image analysis and generation via MCP clients using OpenAI Vision and image models.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "kareemaly-ai-image-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/ai-image-mcp",
        "run",
        "main.py"
      ],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here"
      }
    }
  }
}

You operate an MCP server that delivers AI-powered image analysis and generation capabilities, enabling you to analyze images, compare visuals, extract metadata, and generate or edit images through a unified command protocol. This guide helps you install, run, and integrate the AI Image MCP Server with MCP clients so you can build workflows that analyze assets and produce new visuals automatically.

How to use

Connect your MCP client to the AI Image MCP Server to access its analysis and generation tools. You can perform tasks such as describe_image, analyze_image_content, compare_images, get_image_metadata, generate_image, edit_image, create_image_variations, and more. Use the client’s MCP integration to load the server, then invoke the tool endpoints with appropriate parameters. Results can be cached for efficiency and saved to your local file system as configured by the server.

Typical usage patterns include: batch analyze a folder of images to generate descriptions and color palettes, compare two assets to spot stylistic differences, or generate new images from text prompts and then edit them using prompts. Generated assets are saved in organized directories with timestamped filenames to prevent conflicts.

How to install

Prerequisites you need before installing the server: Python 3.13 or newer, a working OpenAI API key with Vision API and Image Generation access, and the uv runtime installed.

Install the uv runtime and MCP client dependencies, then install the server’s Python package set. Run the following commands in sequence to set up and start the server.

curl -LsSf https://astral.sh/uv/install.sh | sh
uv add mcp[cli] openai pillow requests
`

Run the server locally

After dependencies are installed, set your API key and start the server so MCP clients can connect.

export OPENAI_API_KEY="your-api-key-here"
uv run main.py

Available tools

describe_image

Get detailed image descriptions for a given image path with an optional prompt. Returns a rich description and can leverage caching for performance.

analyze_image_content

Perform targeted analysis on specific aspects such as general description, objects, text, colors, composition, or emotions.

compare_images

Compare two images and highlight similarities and differences based on a chosen focus.

get_image_metadata

Extract technical metadata from an image, including size, dimensions, format, color mode, and aspect ratio.

get_cache_info

Provide statistics about the analysis cache, including file counts and storage usage.

clear_image_cache

Clear all cached image analysis results to free up space and reset cached data.

generate_image

Create images from text prompts using DALL-E 2, DALL-E 3, or GPT-Image-1 with configurable size, quality, and output directory.

edit_image

Edit an existing image using a text prompt and optional mask, choosing between GPT-Image-1 and DALL-E 2 as the model.

create_image_variations

Generate multiple variations of a source image using DALL-E 2 with configurable size and output.

list_generated_images

List all generated images in a directory with metadata such as size and modification date.