mcp-server-openai-image-generator
Generates images from text prompts using the OpenAI Images API, saves them locally, and serves them via HTTP.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-openai-image-generatorgenerate a digital painting of an astronaut riding a horse on Mars"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-openai-image-generator
An MCP (Model Context Protocol) server that exposes an OpenAI image generation tool over HTTP. It generates images from text prompts, saves them locally, and serves them via an integrated static file server.
Stack
Runtime / Language: Bun + TypeScript
MCP Transport: HTTP — standard JSON responses (
POST /mcp)Image generation: OpenAI Images API (
gpt-image-2by default)CORS:
Access-Control-Allow-Origin: *on all routes
Related MCP server: nano-banana
Prerequisites
Bun >= 1.0
An OpenAI API key with access to the Images API
Installation
bun installConfiguration
Edit config.json at the project root:
{
"port": 1980,
"model": "gpt-image-2",
"size": "1024x1536",
"quality": "low",
"imagesDir": "images"
}Field | Description | Default |
| HTTP server listening port |
|
| OpenAI image model |
|
| Generated image dimensions |
|
| Image quality ( |
|
| Directory where generated images are stored |
|
The imagesDir directory is created automatically if it does not exist.
API Key
Provide your OpenAI key via the environment variable:
export OPENAI_API_KEY=sk-...Usage
# production
bun run start
# development (watch mode)
bun run devThe server starts on the configured port (default: http://localhost:1980).
MCP Tool: generate_image
Request
POST /mcp with a JSON-RPC 2.0 body:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate_image",
"arguments": {
"description": "A futuristic city at sunset, digital art"
}
}
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"url": "http://localhost:1980/images/1720000000000.png",
"filename": "1720000000000.png",
"model": "gpt-image-2",
"size": "1024x1536",
"prompt": "A futuristic city at sunset, digital art"
}
}Generated images are saved as <timestamp>.png in imagesDir and immediately accessible at GET /images/:filename.
Project Structure
src/
index.ts # Entry point — loads config, starts server
server.ts # Bun HTTP server, routes requests
mcpHandler.ts # JSON-RPC 2.0 MCP handler
imageGenerator.ts # OpenAI Images API integration
staticHandler.ts # Static file serving for generated images
config.ts # Config loading from config.json
types.ts # Shared TypeScript types
config.json # Server configuration
images/ # Generated images (auto-created)License
Private — all rights reserved.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/jlg-formation/mcp-server-openai-image-generator'
If you have feedback or need assistance with the MCP directory API, please join our Discord server