@jany555/mcp-image-gen
v1.0.7
Published
MCP server for AI image generation and editing powered by gpt-image-2
Maintainers
Readme
mcp-image-gen
MCP server for AI image generation and editing powered by gpt-image-2.
Supports two tools:
generate_image— generate an image from a text promptedit_image— edit or composite images using one or more reference images
Requirements
- Node.js >= 18
- An OpenAI API key with access to
gpt-image-2
Usage with Cursor / Claude Desktop
Add the following to your MCP config (e.g. ~/.cursor/mcp.json or claude_desktop_config.json):
macOS / Linux:
{
"mcpServers": {
"image-gen": {
"command": "npx",
"args": ["-y", "@jany555/mcp-image-gen"],
"env": {
"OPENAI_API_KEY": "sk-your-key-here",
"OPENAI_BASE_URL": "https://api.openai.com/v1"
}
}
}
}Windows:
{
"mcpServers": {
"image-gen": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@jany555/mcp-image-gen"],
"env": {
"OPENAI_API_KEY": "sk-your-key-here",
"OPENAI_BASE_URL": "https://api.openai.com/v1"
}
}
}
}
OPENAI_BASE_URLis optional. Omit it to use the default OpenAI endpoint, or set it to a compatible proxy.
Tools
generate_image
Generate an image from a text prompt.
| Parameter | Type | Description |
|-----------|------|-------------|
| prompt | string | Image description (English recommended) |
| width | number | Output width in pixels |
| height | number | Output height in pixels |
| quality | low | medium | high | Generation quality (default: medium) |
Returns a base64-encoded PNG as a data:image/png;base64,... string.
edit_image
Edit or composite images using one or more reference images.
| Parameter | Type | Description |
|-----------|------|-------------|
| images | string[] | Array of base64-encoded reference images (without data:image/... prefix) |
| prompt | string | Edit/composite description (English recommended) |
| mask | string? | Optional mask for single-image inpainting (same-size RGBA PNG, transparent = repaint area) |
| width | number | Output width in pixels |
| height | number | Output height in pixels |
| quality | low | medium | high | Generation quality (default: medium) |
Returns a base64-encoded PNG as a data:image/png;base64,... string.
Local Development
# Install dependencies
pnpm install
# Run in dev mode
pnpm dev
# Build
pnpm buildLicense
MIT
