Skip to main content
Glama

OpenAI Image Generation MCP Server

Servidor MCP de generación de imágenes OpenAI

Este proyecto implementa un servidor MCP (Protocolo de contexto de modelo) que proporciona herramientas para generar y editar imágenes utilizando el modelo gpt-image-1 de OpenAI a través del SDK oficial de Python.

Características

Este servidor MCP proporciona las siguientes herramientas:

  • generate_image : genera una imagen utilizando el modelo gpt-image-1 de OpenAI basado en un mensaje de texto y la guarda.
    • Esquema de entrada:
      { "type": "object", "properties": { "prompt": { "type": "string", "description": "The text description of the desired image(s)." }, "model": { "type": "string", "default": "gpt-image-1", "description": "The model to use (currently 'gpt-image-1')." }, "n": { "type": ["integer", "null"], "default": 1, "description": "The number of images to generate (Default: 1)." }, "size": { "type": ["string", "null"], "enum": ["1024x1024", "1536x1024", "1024x1536", "auto"], "default": "auto", "description": "Image dimensions ('1024x1024', '1536x1024', '1024x1536', 'auto'). Default: 'auto'." }, "quality": { "type": ["string", "null"], "enum": ["low", "medium", "high", "auto"], "default": "auto", "description": "Rendering quality ('low', 'medium', 'high', 'auto'). Default: 'auto'." }, "user": { "type": ["string", "null"], "default": null, "description": "An optional unique identifier representing your end-user." }, "save_filename": { "type": ["string", "null"], "default": null, "description": "Optional filename (without extension). If None, a default name based on the prompt and timestamp is used." } }, "required": ["prompt"] }
    • Salida: {"status": "success", "saved_path": "path/to/image.png"} o diccionario de errores.
  • edit_image : Edita una imagen o crea variaciones usando el modelo gpt-image-1 de OpenAI y la guarda. Permite usar varias imágenes de entrada como referencia o aplicar una máscara para retocar la imagen.
    • Esquema de entrada:
      { "type": "object", "properties": { "prompt": { "type": "string", "description": "The text description of the desired final image or edit." }, "image_paths": { "type": "array", "items": { "type": "string" }, "description": "A list of file paths to the input image(s). Must be PNG. < 25MB." }, "mask_path": { "type": ["string", "null"], "default": null, "description": "Optional file path to the mask image (PNG with alpha channel) for inpainting. Must be same size as input image(s). < 25MB." }, "model": { "type": "string", "default": "gpt-image-1", "description": "The model to use (currently 'gpt-image-1')." }, "n": { "type": ["integer", "null"], "default": 1, "description": "The number of images to generate (Default: 1)." }, "size": { "type": ["string", "null"], "enum": ["1024x1024", "1536x1024", "1024x1536", "auto"], "default": "auto", "description": "Image dimensions ('1024x1024', '1536x1024', '1024x1536', 'auto'). Default: 'auto'." }, "quality": { "type": ["string", "null"], "enum": ["low", "medium", "high", "auto"], "default": "auto", "description": "Rendering quality ('low', 'medium', 'high', 'auto'). Default: 'auto'." }, "user": { "type": ["string", "null"], "default": null, "description": "An optional unique identifier representing your end-user." }, "save_filename": { "type": ["string", "null"], "default": null, "description": "Optional filename (without extension). If None, a default name based on the prompt and timestamp is used." } }, "required": ["prompt", "image_paths"] }
    • Salida: {"status": "success", "saved_path": "path/to/image.png"} o diccionario de errores.

Prerrequisitos

  • Python (se recomienda 3.8 o posterior)
  • pip (instalador de paquetes de Python)
  • Una clave API de OpenAI (configurada directamente en el script o a través de la variable de entorno OPENAI_API_KEY ; se recomienda enfáticamente utilizar variables de entorno por razones de seguridad ).
  • Un entorno de cliente MCP (como el utilizado por Cline) capaz de gestionar y lanzar servidores MCP.

Instalación

  1. Clonar el repositorio:
    git clone https://github.com/IncomeStreamSurfer/chatgpt-native-image-gen-mcp.git cd chatgpt-native-image-gen-mcp
  2. Configurar un entorno virtual (recomendado):
    python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
  3. Instalar dependencias:
    pip install -r requirements.txt
  4. (Opcional, pero recomendado) Configurar la variable de entorno: Establezca la variable de entorno OPENAI_API_KEY con su clave de OpenAI en lugar de codificarla en el script. La configuración depende de su sistema operativo.

Configuración (para el cliente Cline MCP)

Para que este servidor esté disponible para su asistente de IA (como Cline), agregue su configuración a su archivo de configuración de MCP (por ejemplo, cline_mcp_settings.json ).

Busque el objeto mcpServers en su archivo de configuración y agregue la siguiente entrada:

{ "mcpServers": { // ... other server configurations ... "openai-image-gen-mcp": { "autoApprove": [ "generate_image", "edit_image" ], "disabled": false, "timeout": 180, // Increased timeout for potentially long image generation "command": "python", // Or path to python executable if not in PATH "args": [ // IMPORTANT: Replace this path with the actual absolute path // to the openai_image_mcp.py file on your system "C:/path/to/your/cloned/repo/chatgpt-native-image-gen-mcp/openai_image_mcp.py" ], "env": { // If using environment variables for the API key: // "OPENAI_API_KEY": "YOUR_API_KEY_HERE" }, "transportType": "stdio" } // ... other server configurations ... } }

Importante: Reemplace C:/path/to/your/cloned/repo/ con la ruta absoluta correcta a la ubicación donde clonó este repositorio en su equipo. Asegúrese de que el separador de ruta sea el correcto para su sistema operativo (por ejemplo, use barras invertidas \ en Windows). Si configura la clave API mediante una variable de entorno, puede eliminarla del script y posiblemente añadirla a la sección env si su cliente MCP lo admite.

Ejecución del servidor

Normalmente no es necesario ejecutar el servidor manualmente. El cliente MCP (como Cline) iniciará automáticamente el servidor usando el command y args especificados en el archivo de configuración al llamar a una de sus herramientas por primera vez.

Si desea probarlo manualmente (asegúrese de que las dependencias estén instaladas y la clave API esté disponible):

python openai_image_mcp.py

Uso

El asistente de IA interactúa con el servidor mediante las herramientas generate_image y edit_image . Las imágenes se guardan en un subdirectorio ai-images creado donde se encuentra el script openai_image_mcp.py . Las herramientas devuelven la ruta absoluta de la imagen guardada si se completa correctamente.

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Proporciona herramientas para generar y editar imágenes utilizando el modelo gpt-image-1 de OpenAI a través de una interfaz MCP, lo que permite a los asistentes de IA crear y modificar imágenes según indicaciones de texto.

  1. Características
    1. Prerrequisitos
      1. Instalación
        1. Configuración (para el cliente Cline MCP)
          1. Ejecución del servidor
            1. Uso

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                Enables the generation of images using Together AI's models through an MCP server, supporting customizable parameters such as model selection, image dimensions, and output directory.
                Last updated -
                1
                4
                JavaScript
                MIT License
                • Apple
                • Linux
              • A
                security
                A
                license
                A
                quality
                A MCP server that enables Claude and other MCP-compatible assistants to generate images from text prompts using Together AI's image generation models.
                Last updated -
                1
                2
                TypeScript
                MIT License
                • Apple
                • Linux
              • -
                security
                A
                license
                -
                quality
                A MCP server that integrates with Cursor IDE to generate images based on text descriptions using JiMeng AI, allowing users to create and save custom images directly within their development environment.
                Last updated -
                160
                Python
                MIT License
                • Apple
                • Linux
              • -
                security
                F
                license
                -
                quality
                An MCP server that allows users to generate, edit, and create variations of images through OpenAI's DALL-E API, supporting both DALL-E 2 and DALL-E 3 models.
                Last updated -
                2
                TypeScript

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/IncomeStreamSurfer/chatgpt-native-image-gen-mcp'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server