gpt-image-1

A Model Context Protocol (MCP) server that uses OpenAI’s gpt-image-1 model for generating and editing images.

Features

  • 🖼️ Generate new images from text prompts
  • ✏️ Edit existing images with text prompts and masks
  • 🎨 Support for various image sizes and quality settings
  • 💾 Automatic saving of generated images to disk
  • 🔧 Configurable output directory for easy management
  • 🔒 Secure API key handling through environment variables
  • 📊 Detailed token usage reporting for each request

Use Cases

  • Rapid prototyping of UI/UX designs by generating concept images from text descriptions
  • Creating custom illustrations for blog posts or marketing materials without relying on stock images
  • Editing product photos to quickly visualize different color schemes or minor design changes
  • Generating multiple variations of an image concept for A/B testing in digital marketing campaigns

How to Use It

Prerequisites:

  • Node.js v14 or higher
  • OpenAI API key with access to gpt-image-1 model

Installation:

npm install -g @cloudwerxlab/gpt-image-1-mcp

Set up environment variables:

export OPENAI_API_KEY=your-api-key-here
export GPT_IMAGE_OUTPUT_DIR=/path/to/save/images

Run the server:

npx @cloudwerxlab/gpt-image-1-mcp

Add the following configuration to your MCP client’s settings file:

{
 "mcpServers": {
   "gpt-image-1": {
     "command": "npx",
     "args": ["-y", "@cloudwerxlab/gpt-image-1-mcp"],
     "env": {
       "OPENAI_API_KEY": "your-api-key-here",
       "GPT_IMAGE_OUTPUT_DIR": "/path/to/save/images"
     }
   }
 }
}

Use the create_image tool to generate images:

    {
     "prompt": "A futuristic city skyline at sunset, digital art",
     "size": "1024x1024",
     "quality": "high",
     "n": 1
    }

    Use the create_image_edit tool to edit images:

      {
       "image": {"filePath": "/path/to/image.png"},
       "prompt": "Add a small robot in the corner",
       "mask": {"filePath": "/path/to/mask.png"},
       "quality": "high"
      }

      FAQs

      Q: Can I use this server with any MCP client?
      A: Yes, this server is designed to work with any MCP-compatible client, including popular ones like Roo, VS Code MCP Extension, Cursor, Augment, and Windsurf.

      Q: How do I handle errors related to image format or MIME types?
      A: Ensure that your image files have the correct file extension (.png, .jpg, etc.) matching their actual format. The server uses file extensions to determine MIME types.

      Q: What should I do if I encounter API key issues?
      A: Verify that your OpenAI API key is correct and has access to the gpt-image-1 model. Double-check for any accidental spaces or special characters in the key.

      Q: How can I customize where the generated images are saved?
      A: Set the GPT_IMAGE_OUTPUT_DIR environment variable to your desired output directory. If not set, images will be saved in a gpt-image-1 subfolder within your system’s Pictures folder.

      Q: Is there a limit to the number of images I can generate?
      A: You can generate up to 10 images per request using the n parameter. However, be mindful of your OpenAI API usage limits and costs.

      Latest MCP Servers

      CVE

      An MCP Server that connects Claude to 27 security tools for CVE triage, EPSS checks, KEV status, exploit lookup, and package scanning.

      WebMCP

      webmcp is an MCP server that connects MCP clients to web search, page fetching, and local LLM-based extraction. It’s ideal…

      Google Meta Ads GA4

      An MCP server that connects AI assistants to Google Ads, Meta Ads, and GA4 for reporting, edits, and cross-platform analysis.

      View More MCP Servers >>

      Featured MCP Servers

      Notion

      Notion's official MCP Server allows you to interact with Notion workspaces through the Notion API.

      Claude Peers

      An MCP server that enables Claude Code instances to discover each other and exchange messages instantly via a local broker daemon with SQLite persistence.

      Excalidraw

      Excalidraw's official MCP server that streams interactive hand-drawn diagrams to Claude, ChatGPT, and VS Code with smooth camera control and fullscreen editing.

      More Featured MCP Servers >>

      FAQs

      Q: What exactly is the Model Context Protocol (MCP)?

      A: MCP is an open standard, like a common language, that lets AI applications (clients) and external data sources or tools (servers) talk to each other. It helps AI models get the context (data, instructions, tools) they need from outside systems to give more accurate and relevant responses. Think of it as a universal adapter for AI connections.

      Q: How is MCP different from OpenAI's function calling or plugins?

      A: While OpenAI's tools allow models to use specific external functions, MCP is a broader, open standard. It covers not just tool use, but also providing structured data (Resources) and instruction templates (Prompts) as context. Being an open standard means it's not tied to one company's models or platform. OpenAI has even started adopting MCP in its Agents SDK.

      Q: Can I use MCP with frameworks like LangChain?

      A: Yes, MCP is designed to complement frameworks like LangChain or LlamaIndex. Instead of relying solely on custom connectors within these frameworks, you can use MCP as a standardized bridge to connect to various tools and data sources. There's potential for interoperability, like converting MCP tools into LangChain tools.

      Q: Why was MCP created? What problem does it solve?

      A: It was created because large language models often lack real-time information and connecting them to external data/tools required custom, complex integrations for each pair. MCP solves this by providing a standard way to connect, reducing development time, complexity, and cost, and enabling better interoperability between different AI models and tools.

      Q: Is MCP secure? What are the main risks?

      A: Security is a major consideration. While MCP includes principles like user consent and control, risks exist. These include potential server compromises leading to token theft, indirect prompt injection attacks, excessive permissions, context data leakage, session hijacking, and vulnerabilities in server implementations. Implementing robust security measures like OAuth 2.1, TLS, strict permissions, and monitoring is crucial.

      Q: Who is behind MCP?

      A: MCP was initially developed and open-sourced by Anthropic. However, it's an open standard with active contributions from the community, including companies like Microsoft and VMware Tanzu who maintain official SDKs.

      Get the latest & top AI tools sent directly to your email.

      Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!