loading…
Search for a command to run...
loading…
A TypeScript-based MCP server for generating custom images and icons using AI (GPT Image 1), supporting .png, .svg, and .ico formats, and designed for seamless
A TypeScript-based MCP server for generating custom images and icons using AI (GPT Image 1), supporting .png, .svg, and .ico formats, and designed for seamless integration with Vibe Coding.

A TypeScript-based MCP server for generating custom images and icons using AI (GPT Image 1). It supports output formats including .png, .svg, .ico, and others. Designed for seamless integration with Vibe Coding, enabling on-demand visual asset creation for your projects. Cross-platform, executable via npx.
.png, .svg (embedded base64 image), and .ico (real conversion)npxsrc/index.ts: Main implementation of the MCP server, tools, and resourcespackage.json: Project configuration, dependencies, and cross-platform scriptsREADME.md: This documenttest-mcp-client.js: MCP Client integration test scripttsconfig.json: TypeScript configurationsample_config.json: Example MCP Client configurationAdd the following configuration to your MCP servers file (example for sample_config.json):
{
"servers": {
"mcp-image-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@ricardopera/mcp-image-server@latest"
],
"env": {
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY_HERE"
}
}
}
}
This allows you to run the image server directly via npx, with no prior installation, and sets the required environment variable for OpenAI authentication.
Install dependencies:
npm install
Build the project:
npm run build
Set the OPENAI_API_KEY environment variable with your OpenAI key:
On Windows (PowerShell):
$env:OPENAI_API_KEY="your-key-here"
On Linux/Mac:
export OPENAI_API_KEY="your-key-here"
Run via npx:
npx mcp-image-server
.png, .svg, .ico formatsresource://tool-examples)formats://supported)Below are real examples of images generated by the MCP Image Server tools. All images were automatically saved in the examples/ folder using the fileName and directory parameters of the tools.
Prompt used:
{
"prompt": "minimalist rocket icon transparent background",
"format": "png",
"size": "1024x1024",
"background": "transparent",
"fileName": "rocket-icon",
"directory": "examples"
}
Result:
![]()
Prompt used:
{
"prompt": "blue circular logo with letter A",
"format": "svg",
"size": "1536x1024",
"background": "transparent",
"fileName": "blue-logo-letter-a",
"directory": "examples"
}
Result:
Prompt used:
{
"prompt": "golden star icon",
"format": "ico",
"size": "1024x1024",
"background": "opaque",
"fileName": "golden-star",
"directory": "examples"
}
Result:
Prompt used:
{
"prompt": "yellow star favicon transparent background",
"size": "1024x1024",
"background": "transparent",
"fileName": "yellow-star-favicon",
"directory": "examples"
}
Result:
Prompt used:
{
"prompt": "red heart icon",
"size": "1024x1536",
"background": "opaque",
"fileName": "red-heart-icon",
"directory": "examples"
}
Result:
These examples demonstrate the server's flexibility to generate and save custom images in different formats and directories, facilitating integration into web projects, applications, and various systems.
generate-imageGenerates a custom image using AI (GPT Image 1) and delivers it in the requested format.
Parameters:
prompt (string): textual description of the desired imageformat ("png" | "svg" | "ico"): output format (default: "png")size ("1024x1024" | "1536x1024" | "1024x1536"): image size (default: "1024x1024")background ("transparent" | "opaque"): background type (default: "transparent")Example:
{
"prompt": "minimalist rocket icon transparent background",
"format": "png",
"size": "1024x1024",
"background": "transparent"
}
{
"prompt": "blue circular logo with letter A",
"format": "svg",
"size": "1536x1024",
"background": "transparent"
}
{
"prompt": "golden star icon",
"format": "ico",
"size": "1024x1024",
"background": "opaque"
}
generate-faviconGenerates a custom favicon.ico from a textual prompt.
Parameters:
prompt (string): textual description of the faviconsize ("1024x1024" | "1536x1024" | "1024x1536"): image size (default: "1024x1024")background ("transparent" | "opaque"): background type (default: "transparent")Example:
{
"prompt": "yellow star favicon transparent background",
"size": "1024x1024",
"background": "transparent"
}
generate-svg (temporariamente indisponível)⚠️ A ferramenta de geração de SVG está temporariamente desabilitada devido a questões técnicas relacionadas ao processamento do conteúdo SVG como texto. O recurso será reativado em uma versão futura, assim que for possível garantir que SVGs sejam tratados apenas como arquivos de imagem.
Enquanto isso, utilize os formatos PNG ou ICO para geração de imagens.
resource://tool-examples: usage examples of the tools in JSONformats://supported: list of supported formats (["png", "svg", "ico"])OPENAI_API_KEY: OpenAI API key (required for image generation)Developed following best practices for MCP agents, ready for integration and publication on MCP.so.
Below are additional examples demonstrating the flexibility and power of the tools in this project. All images are generated and automatically saved in the examples/ folder.
Prompt used:
{
"prompt": "friendly robot avatar, white background, cartoon style, soft colors",
"format": "png",
"size": "1024x1024",
"background": "opaque",
"fileName": "friendly-robot-avatar",
"directory": "examples"
}
Result:
![]()
Prompt used:
{
"prompt": "futuristic landscape with mountains and starry sky, digital art, transparent background",
"format": "png",
"size": "1536x1024",
"background": "transparent",
"fileName": "futuristic-landscape",
"directory": "examples"
}
Result:

These advanced examples show how the MCP Image Server can be used to generate everything from minimalist icons to complex illustrations, ready for use in web, mobile, or desktop applications.
Generates a custom image using AI (GPT Image 1) and saves it in the requested format.
Required Parameters:
prompt (string): textual description of the desired imageformat ("png" | "svg" | "ico"): output format (default: "png")size ("1024x1024" | "1536x1024" | "1024x1536"): image size (default: "1024x1024")background ("transparent" | "opaque"): background type (default: "transparent")fileName (string): name of the file to be saved (without extension)directory (string): full path of the directory where the file will be saved (must be formatted according to the operating system, e.g., C:\Users\user\project\folder on Windows or /home/user/project/folder on Linux/Mac)Important: Always provide the full path in the
directoryparameter to ensure the file is saved correctly. The path must be in the format of the operating system where the server is running.
Usage Example (Windows):
{
"prompt": "minimalist rocket icon transparent background",
"format": "png",
"size": "1024x1024",
"background": "transparent",
"fileName": "rocket-icon",
"directory": "c:\\Users\\ricar\\Desktop\\projetos\\mcp-image-server\\examples"
}
Usage Example (Linux/Mac):
{
"prompt": "minimalist rocket icon transparent background",
"format": "png",
"size": "1024x1024",
"background": "transparent",
"fileName": "rocket-icon",
"directory": "/home/user/projects/mcp-image-server/examples"
}
Generates a custom favicon.ico from a textual prompt.
Required Parameters:
prompt (string): textual description of the faviconsize ("1024x1024" | "1536x1024" | "1024x1536"): image size (default: "1024x1024")background ("transparent" | "opaque"): background type (default: "transparent")fileName (string): name of the file to be saved (without extension)directory (string): full path of the directory where the file will be saved (operating system format)Usage Example (Windows):
{
"prompt": "yellow star favicon transparent background",
"size": "1024x1024",
"background": "transparent",
"fileName": "yellow-star-favicon",
"directory": "c:\\Users\\ricar\\Desktop\\projetos\\mcp-image-server\\examples"
}
Generates an SVG file with the embedded AI image (base64).
Required Parameters:
prompt (string): textual description of the desired imagesize ("1024x1024" | "1536x1024" | "1024x1536"): image size (default: "1024x1024")background ("transparent" | "opaque"): background type (default: "transparent")fileName (string): name of the file to be saved (without extension)directory (string): full path of the directory where the file will be saved (operating system format)Usage Example (Linux/Mac):
{
"prompt": "red heart icon",
"size": "1024x1536",
"background": "opaque",
"fileName": "red-heart-icon",
"directory": "/home/user/projects/mcp-image-server/examples"
}
Refer to the resource
resource://tool-examplesfor more practical JSON examples.
MCP (Model Context Protocol) tools must follow the international standard for definition and documentation, allowing models and agents to discover, understand, and use them correctly. See below for best practices and real examples:
{
name: string; // Unique identifier of the tool
description?: string; // Human-readable description
inputSchema: { // JSON Schema of the tool parameters
type: "object",
properties: { ... } // Specific tool parameters
}
}
server.registerTool(
"generate-image",
{
title: "Generate Image with GPT Image 1",
description: "Generates a custom image using AI (GPT Image 1) and delivers it in the requested format (.png, .svg, .ico).",
inputSchema: {
prompt: z.string().describe("Textual prompt describing the desired image"),
format: z.enum(["png", "svg", "ico"]).default("png").describe("Output format of the image"),
size: z.enum(["1024x1024", "1536x1024", "1024x1536"]).default("1024x1024").describe("Image size"),
background: z.enum(["transparent", "opaque"]).default("transparent").describe("Background type"),
fileName: z.string().default("image").describe("Name of the file to be saved (without extension)"),
directory: z.string().default("./output").describe("Directory where the file will be saved")
},
annotations: {
usage: "Use this tool to generate custom images and icons for your project. The prompt should be detailed for better results. The format defines the extension of the generated file."
}
},
async ({ prompt, format, size, background, fileName, directory }) => { /* ... */ }
);
annotations.usage field for usage tips and contextisError field when necessarytry {
// Tool operation
const result = performOperation();
return {
content: [
{ type: "text", text: `Operation successful: ${result}` }
]
};
} catch (error) {
return {
isError: true,
content: [
{ type: "text", text: `Error: ${error.message}` }
]
};
}
By following this standard, any MCP model or agent can list the available tools, read their schemas and descriptions, and invoke them correctly, including automatic parameter validation.
Refer to the official MCP documentation for more examples and details.
Run in your terminal:
claude mcp add mcp-image-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.