Skip to main content
Glama

Image Gen MCP

OpenAI 이미지 모델을 통해 이미지를 생성하고 편집하는 TypeScript MCP 서버입니다.

이 서버는 generate_image 및 edit_image 도구를 등록한 다음 반환된 이미지 바이트를 디스크에 기록합니다. Stdio 모드는 요청한 절대 파일 경로에 기록하며, SSE 및 streamable HTTP 모드는 파일을 자동 저장하고 이미지 URL을 반환합니다.

환경 변수

이름

필수

기본값

설명

BASE_URL

아니요

AI SDK OpenAI 기본값

OpenAI API URL 접두사입니다. 예: https://api.openai.com/v1. 루트 URL에는 /v1이 자동으로 추가됩니다.

API_KEY

예

-

OpenAI API 키입니다.

MODEL

아니요

gpt-image-2

OpenAI 이미지 모델입니다.

FILE_DIR

아니요

./data

SSE/HTTP 모드에서 자동 저장되는 파일의 디렉터리입니다. Docker에서는 기본값이 /data입니다.

Related MCP server: openai-imagegen-mcp

도구

generate_image

인수:

이름

필수

기본값

설명

prompt

예

-

이미지 프롬프트입니다.

filepath

Stdio

-

Stdio 전용. 절대 출력 경로입니다. 상위 디렉터리는 자동으로 생성됩니다.

n

아니요

1

이미지 수입니다. 1부터 3까지.

size

아니요

auto

auto, 256x256, 512x512, 1024x1024, 1536x1024, 1024x1536, 1792x1024 또는 1024x1792.

quality

아니요

medium

low, medium, high 또는 auto.

background

아니요

-

transparent, opaque 또는 auto.

output_format

아니요

png

png, jpeg, jpg 또는 webp. jpg는 jpeg로 전송됩니다.

output_compression

아니요

-

0부터 100까지의 압축 수준입니다.

moderation

아니요

-

auto 또는 low.

overwrite

Stdio

false

Stdio 전용. 기존 출력 파일을 덮어쓸 수 있도록 허용합니다.

알려진 모델 크기 제한은 업스트림 API를 호출하기 전에 검증됩니다. 예를 들어 gpt-image-* 모델은 1024x1024, 1536x1024, 1024x1536을 지원하고 dall-e-2는 256x256, 512x512, 1024x1024를 지원합니다.

n > 1인 경우 /tmp/image.png 같은 파일 경로는 /tmp/image-1.png, /tmp/image-2.png 등이 됩니다.

SSE 및 streamable HTTP 모드에서는 filepath와 overwrite가 노출되지 않습니다. 생성된 파일은 ${FILE_DIR}/YYYY-MM-DD/<uuid>.<ext> 형식으로 저장되며 http://localhost:3000/file/YYYY-MM-DD/<uuid>.png 같은 URL로 반환됩니다.

edit_image

인수:

이름

필수

기본값

설명

prompt

예

-

편집 지시문입니다.

image_path

예

-

편집할 원본 이미지의 절대 경로입니다.

mask_path

아니요

-

선택 사항인 편집 마스크 이미지의 절대 경로입니다.

filepath

Stdio

-

Stdio 전용. 절대 출력 경로입니다. 상위 디렉터리는 자동으로 생성됩니다.

n

아니요

1

편집된 이미지 수입니다. 1부터 3까지.

size

아니요

auto

auto, 256x256, 512x512, 1024x1024, 1536x1024, 1024x1536, 1792x1024 또는 1024x1792.

quality

아니요

medium

low, medium, high 또는 auto.

background

아니요

-

편집된 이미지의 배경 동작입니다.

output_format

아니요

png

png, jpeg, jpg 또는 webp. jpg는 jpeg로 전송됩니다.

output_compression

아니요

-

0부터 100까지의 압축 수준입니다.

moderation

아니요

-

auto 또는 low.

overwrite

Stdio

false

Stdio 전용. 기존 출력 파일을 덮어쓸 수 있도록 허용합니다.

이 도구는 multipart 폼 데이터로 OpenAI 호환 /images/edits 엔드포인트를 호출합니다. 출력 파일은 generate_image와 동일한 파일 경로 및 자동 저장 동작을 따릅니다.

개발

pnpm install
pnpm dev

유용한 확인 명령:

pnpm check
pnpm build

Stdio MCP 구성

{
  "mcpServers": {
    "image-gen-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["image-gen-mcp"],
      "env": {
        "BASE_URL": "https://api.openai.com/v1",
        "API_KEY": "sk-...",
        "MODEL": "gpt-image-2"
      }
    }
  }
}

Streamable HTTP

{
  "mcpServers": {
    "image-gen-mcp": {
      "type": "http",
      "url": "http://localhost:3000/mcp",
      "headers": {
        "openai-base-url": "https://api.openai.com/v1",
        "openai-api-key": "sk-...",
        "openai-model": "gpt-image-2"
      }
    }
  }
}

헤더는 서버 측 env 구성을 재정의합니다. 헤더를 생략하면 env 값으로 대체됩니다. Docker 이미지는 포트 3000에서 streamable HTTP를 실행합니다.

SSE

SSE 전송은 src/sse.ts에 있으며 /mcp에서 PORT(기본값 4000)를 수신하고, 메시지는 /message에 게시됩니다. pnpm start:sse로 직접 실행할 수 있습니다. Docker 이미지에서는 시작되지 않습니다.

{
  "mcpServers": {
    "image-gen-mcp": {
      "type": "sse",
      "url": "http://localhost:4000/mcp",
      "headers": {
        "openai-api-key": "sk-..."
      }
    }
  }
}

Docker

docker build -t image-gen-mcp .
docker run --rm -p 3000:3000 \
  # 也可忽略apiKey,让使用方 headers 中传递
  -e BASE_URL=https://api.openai.com/v1 \
  -e API_KEY=sk-... \
  -e MODEL=gpt-image-2 \
  -v image-gen-data:/data \
  image-gen-mcp

Available Tools

2 tools
edit_imageA

Edit image(s) with the OpenAI Images Edit API. SSE/HTTP transports auto-save files and return image URLs; stdio requires filepath.

ParametersJSON Schema
NameRequiredDescriptionDefault
nNoNumber of images to generate.
sizeNoImage size. Supported values: auto, 256x256, 512x512, 1024x1024, 1536x1024, 1024x1536, 1792x1024, 1024x1792. Some models only support a subset.
promptYesImage generation prompt.
qualityNoImage generation quality.
filepathYesAbsolute path where the generated image should be saved.
mask_pathNoOptional absolute path to the edit mask image.
overwriteNoAllow replacing existing output files.
backgroundNoGenerated image background behavior.
image_pathYesAbsolute path to the source image to edit.
moderationNoImage moderation strictness.
output_formatNoOutput image format. jpg is normalized to jpeg for the API request.
output_compressionNoCompression level for jpeg or webp outputs, from 0 to 100.

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations present, the description carries the burden of behavioral disclosure. It usefully discloses transport-dependent behavior: SSE/HTTP auto-save files and return URLs, while stdio requires a filepath. However, it omits external API dependencies, authentication, network failure behavior, and whether output files may be overwritten, which is important for an editing tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact, front-loaded with the primary purpose, and contains no filler. The second sentence efficiently packs transport-specific behavior into one clause, making it easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 12 parameters, no annotations, and no output schema, this description is incomplete. It covers the core purpose and one transport distinction, but it does not address return-value behavior for stdio, authentication, or error handling. Still, it provides essential context and is not misleading.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds meaning by clarifying that filepath is required for stdio and that SSE/HTTP transports auto-save files, which helps the agent understand the filepath parameter's role beyond its schema entry. Other parameters remain schema-documented, which is sufficient.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb and resource: 'Edit image(s)' via the 'OpenAI Images Edit API.' The name and wording imply a distinction from the sibling generate_image, but it never explicitly names that alternative, so it falls just short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when editing existing images rather than generating new ones, and the sibling name generate_image hints at the alternative. However, there is no explicit when-to-use vs. when-not-to-use guidance, and it does not mention generate_image or other alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

generate_imageA

Generate image(s) with the OpenAI Images API. SSE/HTTP transports auto-save files and return image URLs; stdio requires filepath.

ParametersJSON Schema
NameRequiredDescriptionDefault
nNoNumber of images to generate.
sizeNoImage size. Supported values: auto, 256x256, 512x512, 1024x1024, 1536x1024, 1024x1536, 1792x1024, 1024x1792. Some models only support a subset.
promptYesImage generation prompt.
qualityNoImage generation quality.
filepathYesAbsolute path where the generated image should be saved.
overwriteNoAllow replacing existing output files.
backgroundNoGenerated image background behavior.
moderationNoImage moderation strictness.
output_formatNoOutput image format. jpg is normalized to jpeg for the API request.
output_compressionNoCompression level for jpeg or webp outputs, from 0 to 100.

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of disclosing behavior. It usefully reveals that SSE/HTTP transports auto-save files and return URLs, which is behavioral context beyond the schema. Still, it does not mention other notable behaviors such as default overwrite behavior, moderation handling, or exactly what happens in stdio mode after generation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences with no filler. The primary purpose is front-loaded, and the transport nuance is stated efficiently. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the tool's purpose and a key transport difference, and the schema fully documents the parameters. However, with 10 parameters, no annotations, and no output schema, an agent might still be unsure what to expect as a result in stdio mode or how this tool relates to edit_image. The description is adequate but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds almost no parameter-level detail beyond the schema; the only minor addition is the contextual note that stdio requires filepath, but that is already captured by the required field.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific action ('Generate image(s)') and resource ('with the OpenAI Images API'). It is easy to understand that this tool creates new images, and the sibling 'edit_image' suggests the complementary operation, though the description does not explicitly compare itself to that sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives transport-specific guidance: SSE/HTTP auto-save files and return image URLs, while stdio requires filepath. However, it does not explicitly explain when to choose this tool over edit_image; the use case is only implied by the tool name and the generate-vs-edit distinction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.1
    • First observededit_image
    • First observedgenerate_image

TDQS

A3.8/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: one generates new images from scratch, the other edits existing images. There is no ambiguity between them.

Naming Consistency5/5

Both tool names follow the same verb_noun pattern: generate_image and edit_image. The naming is consistent and predictable.

Tool Count3/5

With only 2 tools, the server is on the thin side. While adequate for basic image generation and editing, it feels minimal and could reasonably include additional related operations.

Completeness4/5

The server covers the two primary actions for an image API service. Missing common operations like image variations or model listing, but the core generation and editing workflows are fully represented.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers