- Home
- MCP servers
- MCP OpenAI Image Generation Server
MCP OpenAI Image Generation Server
- typescript
0
GitHub Stars
typescript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"lupinlin1-imagegen-mcp": {
"command": "npx",
"args": [
"@lupinlin1/imagegen-mcp",
"--models",
"dall-e-3"
],
"env": {
"OPENAI_API_KEY": "YOUR_API_KEY"
}
}
}
}You can run the MCP OpenAI Image Generation Server to generate and edit images via OpenAI models directly from your MCP client. It wraps image generation and editing APIs behind MCP tools, enabling text-to-image and image-to-image workflows with configurable options and automatic temporary file handling.
How to use
Set up an MCP client to connect to the image generation server, then use the provided MCP tools to generate or edit images. The server exposes two core tools: text-to-image for creating images from prompts, and image-to-image for editing existing images with a prompt and optional mask. You can choose models like gpt-image-1, dall-e-2, or dall-e-3 depending on what each tool supports in your environment. All results include a path to the saved image and the base64 data as part of the response.
How to install
Prerequisites: make sure you have Node.js (v18 or later recommended) and npm or yarn installed. You also need an OpenAI API key to access the image generation and editing endpoints.
{
"mcpServers": {
"imagegen-mcp": {
"command": "npx",
"args": ["@lupinlin1/imagegen-mcp", "--models", "dall-e-3"],
"env": { "OPENAI_API_KEY": "your_api_key" }
}
}
}
Additional setup notes
The server is designed to be configured via environment variables and command-line arguments. For a quick start, configure your MCP client to pass the OpenAI API key as an environment variable named OPENAI_API_KEY. You can enable specific models with the --models option if your client supports it.
Notes on usage patterns
- Use text-to-image to generate new visuals from descriptive prompts. Adjust size, style, and format to fit your needs. - Use image-to-image to edit existing images by providing the source image paths and a descriptive prompt, with optional masks to constrain edits. - The server stores generated images in temporary files and returns both the file path and the base64 content for easy transport.
Security and keys
Keep your OpenAI API key secure. Do not commit keys to version control. When using MCP in shared environments, limit access to trusted clients and consider rotating keys periodically.
Available tools
text-to-image
Generates an image from a text prompt with configurable model, size, style, format, and quality. Returns a path to the saved image and the base64 data.
image-to-image
Edits an existing image based on a text prompt and optional mask. Supports model selection, size, output format, and quality. Returns a path to the saved image and the base64 data.