home / mcp / openai image mcp server

OpenAI Image MCP Server

Provides image generation and editing via OpenAI’s image APIs with flexible output options and aspect-ratio mappings.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "199-mcp-mcp-openai-image": {
      "command": "npx",
      "args": [
        "openai-gpt-image-mcp-199bio"
      ],
      "env": {
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

This MCP server lets you generate and edit images using OpenAI’s GPT-4o image models through a simple, MCP-compatible client. It supports generating from prompts, editing with prompts and masks, and flexible output options, all while handling common aspect ratios and file outputs for easy integration into your workflows.

How to use

You connect to the server from any MCP-compatible client (such as Claude Desktop, VSCode, Cursor, Windsurf, or a generic MCP client). You can generate images from prompts, edit images with optional masks, and choose how results are delivered—either as base64 data or saved to disk. When you use aspect ratios, you can specify standard formats like 16:9, 9:16, or 1:1, and the system automatically maps them to supported sizes. For large results, you can rely on file outputs to avoid payload size limits.

How to install

Prerequisites ensure you can run JavaScript-based MCP servers locally. You need Node.js and npm (or yarn) installed on your machine.

Quick setup with NPX (recommended) lets you run the MCP server without a local installation. Use this configuration in your MCP client: you provide an API key and run the server through npx.

{
  "mcpServers": {
    "openai_gpt_image": {
      "command": "npx",
      "args": ["openai-gpt-image-mcp-199bio"],
      "env": { 
        "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY"
      }
    }
  }
}

If you prefer a local installation, you can install the package globally and then run it directly. Follow this flow to install and run the MCP server locally.

npm install -g openai-gpt-image-mcp-199bio
# Then run via your preferred runtime (example):
node dist/index.js

Additional steps and notes

You can also build from source if you want to customize or contribute. After cloning the project, install dependencies and build, then run the built server.

Available tools

create-image

Generate images from prompts with advanced options such as size, quality, and background.

edit-image

Edit or extend images using a prompt and an optional mask, supporting file paths and base64 input.

aspect-ratio

Support for common aspect ratios that map to OpenAI-supported sizes, including 16:9, 9:16, and 1:1.

file-output

Save generated images directly to disk or receive as base64.

ai-filenames

AI can generate descriptive filenames based on image content, with sanitization and indexing for multiple images.

OpenAI Image MCP Server - 199-mcp/mcp-openai-image