Skip to main content
Glama
ivanantigravity-lgtm

GPT Image 2 Polza MCP Server

GPT Image 2 Polza MCP Server

mcp-name: io.github.ivanantigravity-lgtm/gpt-image-2-polza-mcp-server

MCP-сервер для генерации и редактирования изображений моделью GPT Image 2 через API-провайдера Polza.

  • Провайдер: Polza

  • Model ID: openai/gpt-5.4-image-2

  • Model tier: gpt-image-2

  • Поддержка генерации, редактирования и референсных изображений

  • Сохранение полноразмерных файлов на диск

  • Возврат превью и структурированных метаданных через MCP

Для работы нужен только POLZA_AI_API_KEY. Отдельный ключ OpenAI не требуется.

Инструменты MCP

  • generate_image — создаёт или редактирует изображения с помощью GPT Image 2.

  • fetch_generation — получает результат уже запущенной генерации по gen_... ID.

  • upload_file — загружает референс в Polza Storage.

  • show_output_stats — показывает статистику локальной папки с результатами.

  • maintenance — обслуживает локальный кэш и базу метаданных.

Related MCP server: openai-gpt-image-1-mcp

Требования

  • Python 3.11+

  • uv

  • Аккаунт Polza и POLZA_AI_API_KEY

  • Любой MCP-клиент: Claude Code, Claude Desktop, Cursor, VS Code или другой

Быстрая установка

Клонируйте репозиторий:

git clone https://github.com/ivanantigravity-lgtm/gpt-image-2-polza-mcp.git
cd gpt-image-2-polza-mcp
uv sync

Создайте .mcp.json:

{
  "mcpServers": {
    "gpt-image-2-polza": {
      "command": "uv",
      "args": [
        "run",
        "gpt-image-2-polza-mcp-server"
      ],
      "cwd": "/absolute/path/to/gpt-image-2-polza-mcp",
      "env": {
        "POLZA_AI_API_KEY": "your-polza-api-key",
        "POLZA_BASE_URL": "https://polza.ai/api",
        "IMAGE_OUTPUT_DIR": "/absolute/path/to/gpt-image-2-output"
      }
    }
  }
}

Перезапустите MCP-клиент после добавления конфигурации.

Использование

Обычная генерация:

Создай рекламный кадр флакона духов на чёрном камне,
кинематографический свет, формат 16:9, разрешение 4K.
Используй gpt-image-2.

Основные параметры generate_image:

Параметр

Описание

prompt

Текстовое описание изображения или инструкция по редактированию

mode

generate, edit или автоматическое определение

model_tier

gpt-image-2; используется по умолчанию

resolution

1k, 2k, 4k или high

aspect_ratio

Например, 1:1, 16:9, 9:16, 4:5

input_image_path_1

Путь к основному референсу или редактируемому изображению

input_image_path_2

Второй референс

input_image_path_3

Третий референс

output_path

Конкретный файл или папка для результата

force_new_generation

Принудительно запустить новую генерацию вместо использования кэша

Восстановление после таймаута

Генерация может продолжаться на стороне Polza после таймаута MCP-клиента. Не запускайте тот же запрос повторно сразу: это может создать и оплатить ещё одну генерацию.

Получите gen_... ID в истории генераций Polza и вызовите:

fetch_generation(
  media_id="gen_2158267363095220225",
  output_path="/absolute/path/to/result.png"
)

Переменные окружения

Переменная

Обязательно

Описание

POLZA_AI_API_KEY

Да

API-ключ аккаунта Polza

POLZA_BASE_URL

Нет

Базовый URL API; по умолчанию https://polza.ai/api

IMAGE_OUTPUT_DIR

Нет

Папка результатов; по умолчанию ~/gpt-image-2-images

GPT_IMAGE_MODEL

Нет

Model tier; по умолчанию gpt-image-2

POLZA_POLL_INTERVAL_SECONDS

Нет

Интервал проверки статуса генерации

POLZA_POLL_TIMEOUT_SECONDS

Нет

Максимальное время ожидания результата

POLZA_EXTERNAL_USER_ID

Нет

Внешний ID пользователя для Polza

RETURN_FULL_IMAGE

Нет

Возвращать полное изображение вместо превью

Локальный запуск

cp .env.example .env
uv sync
uv run gpt-image-2-polza-mcp-server

Минимальный .env:

POLZA_AI_API_KEY=your-polza-api-key
POLZA_BASE_URL=https://polza.ai/api
GPT_IMAGE_MODEL=gpt-image-2
IMAGE_OUTPUT_DIR=/absolute/path/to/gpt-image-2-output

API Polza

Сервер использует:

  • POST /v1/media — запуск генерации

  • GET /v1/media/{id} — получение статуса и результата

  • POST /v1/storage/upload — загрузка референсов

  • GET /v1/storage/files/{id} — метаданные файла

  • DELETE /v1/storage/files/{id} — удаление файла

Лицензия

MIT. См. LICENSE.

Available Tools

5 tools
fetch_generationFetch a Polza media generation by idD
Read-only
ParametersJSON Schema
NameRequiredDescriptionDefault
waitNoIf true (default), polls until the generation reports 'completed' or 'failed', respecting POLZA_POLL_TIMEOUT_SECONDS. If false, returns the raw status without downloading.
media_idYesPolza generation id (e.g. 'gen_2158264963618050049'). Returned by the Polza API when an `images/generations` or `/v1/media` call switches to async mode or when the MCP client times out waiting for a synchronous response.
output_pathNoWhere to save the downloaded asset(s). If a file path with an extension is provided, saves the first asset there. If a directory is provided, saves using '<media_id>_<index>.<ext>'. If omitted, saves into IMAGE_OUTPUT_DIR.

TDQS

D1/5.0
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

generate_imageGenerate or edit images (Multi-Model: Flash & Pro)A
Read-only

Generate new images or edit existing images using natural language instructions.

Supports multiple input modes:

  1. Pure generation: Just provide a prompt to create new images

  2. Multi-image conditioning: Provide up to 3 input images using input_image_path_1/2/3 parameters

  3. File ID editing: Edit previously uploaded images using Files API ID

  4. File path editing: Edit local images by providing single input image path

Automatically detects mode based on parameters or can be explicitly controlled. Input images are read from the local filesystem to avoid massive token usage. Returns both MCP image content blocks and structured JSON with metadata.

ParametersJSON Schema
NameRequiredDescriptionDefault
nNoRequested image count (model may return fewer).
modeNoOperation mode: 'generate' for new image creation, 'edit' for modifying existing images. Auto-detected based on input parameters if not specified.auto
promptYesClear, detailed image prompt. Include subject, composition, action, location, style, and any text to render. Use the aspect_ratio parameter to pin a specific canvas shape when needed.
file_idNoFiles API file ID to use as input/edit source (e.g., 'files/abc123'). If provided, this takes precedence over input_image_path_* parameters for the primary input.
model_tierNoModel tier. Use 'gpt-image-2' for OpenAI GPT Image 2 through Polza. This is the default model.gpt-image-2
resolutionNoOutput resolution: 'high', '4k', '2k', '1k'. GPT Image 2 supports high-resolution output. Default: '1k'.1k
output_pathNoOutput path for generated image(s). If a file path with extension (e.g., '/path/image.png'), saves directly to that path. If a directory path (e.g., '/path/to/dir/'), uses default filename in that directory. If None, uses IMAGE_OUTPUT_DIR environment variable or ~/gpt-image-2-images.
aspect_ratioNoOptional output aspect ratio (e.g., '16:9'). Polza-supported values: auto, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9.
thinking_levelNoReasoning depth hint: 'low' (faster), 'high' (better quality). Applied to the 'nb2' model; 'high' also biases auto-selection toward Pro. Default: None (auto).
negative_promptNoThings to avoid (style, objects, text).
enable_groundingNoEnable Google Search grounding for factual accuracy (NB2 and Pro models). Useful for real-world subjects. Default: true.
return_full_imageNoReturn full-resolution images in MCP response instead of thumbnails. Warning: full images can be large (3-7MB each for 4K). Default: uses RETURN_FULL_IMAGE env var, or false if not set.
input_image_path_1NoPath to first input image for composition/conditioning
input_image_path_2NoPath to second input image for composition/conditioning
input_image_path_3NoPath to third input image for composition/conditioning
system_instructionNoOptional system tone/style guidance.
force_new_generationNoStart a brand-new upstream generation even if the same request is already pending or recently completed. Use only after the user explicitly confirmed they want a rerun.

TDQS

A4.3/5.0
Behavior4/5

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

Beyond the readOnlyHint annotation, the description discloses that input images are read from the local filesystem to reduce token usage, that mode detection is automatic, and that the return payload includes both MCP image blocks and structured JSON. This is meaningful behavioral context; it does not contradict the annotations.

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

Conciseness4/5

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

The description is well-structured with a clear opening and numbered modes, making it scannable. It is slightly longer than strictly necessary because modes 2 and 4 overlap conceptually, but the layout earns its place for a tool with 17 parameters.

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

Completeness4/5

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

For a complex tool with 17 parameters and no output schema, the description adequately covers generation versus editing modes, input handling, and the return format. It relies on the schema for detailed parameter semantics, which is appropriate given 100% schema coverage. Nothing critical for invoking the tool correctly is missing.

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 value by mapping input modes to specific parameters (e.g., up to 3 input images via input_image_path_1/2/3, file_id for Files API editing), which helps an agent choose the right parameter combination for the intended mode.

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

Purpose5/5

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

The description opens with a specific verb and resource: 'Generate new images or edit existing images.' It then enumerates four concrete input modes, making the tool's full scope unambiguous. The title and description together clearly distinguish this from siblings like upload_file or fetch_generation.

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

Usage Guidelines4/5

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

The description explains when to use each input mode and states that mode selection is auto-detected or explicitly controlled. It does not explicitly name alternative tools for when-not-to-use cases, but the mode guidance is clear enough for parameter selection.

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

maintenanceMaintenance and cleanup operationsB
Read-only

Perform maintenance operations following workflows.md patterns.

Available operations:

  • cleanup_expired: Remove expired Files API entries from database

  • cleanup_local: Clean old local files based on age/LRU

  • check_quota: Check Files API storage usage vs. ~20GB budget

  • database_hygiene: Clean up database inconsistencies

  • full_cleanup: Run all cleanup operations in sequence

ParametersJSON Schema
NameRequiredDescriptionDefault
dry_runNoIf true, only report what would be done without making changes
operationYesMaintenance operation to perform: 'cleanup_expired', 'cleanup_local', 'check_quota', 'database_hygiene', 'full_cleanup'
keep_countNoFor local cleanup: minimum number of recent files to keep
max_age_hoursNoFor local cleanup: maximum age in hours (default: 168 = 1 week)

TDQS

B3.2/5.0
Behavior1/5

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

Annotations declare readOnlyHint=true, but the description explicitly describes destructive actions like 'Remove expired Files API entries from database' and 'Clean old local files'. This is a direct annotation contradiction, which the rubric requires scoring as 1, and the description also fails to disclose irreversibility or safety implications beyond the dry_run parameter in the schema.

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

Conciseness4/5

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

The description is compact and front-loaded with a clear purpose, followed by a well-structured bullet list of operations. The phrase 'following workflows.md patterns' is somewhat ambiguous and could be clearer, but overall every line adds useful information without unnecessary verbosity.

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?

Given the tool has four parameters, multiple operation modes, and no output schema, the description covers the operation choices reasonably well. However, it relies on a vague external reference, does not describe return values or success/failure behavior, and the readOnlyHint contradiction makes the safety profile incomplete for an agent deciding whether to invoke it.

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 input schema already fully documents operation, dry_run, keep_count, and max_age_hours. The description adds a helpful mapping of operation names to behaviors, but does not provide extra parameter semantics beyond what the schema already gives, so it stays at the baseline.

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

Purpose5/5

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

The description names a specific resource ('maintenance operations') and enumerates each concrete sub-operation with a verb and object, such as 'Remove expired Files API entries from database' and 'Check Files API storage usage'. It is clearly distinguishable from sibling tools like generate_image and upload_file, so an agent can tell what this tool does without opening the schema.

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 this tool is for maintenance and cleanup tasks, but it does not explicitly state when to use it versus sibling tools or when to prefer one operation over another. The reference to 'following workflows.md patterns' gives some context but is vague and does not provide concrete selection criteria or exclusions.

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

show_output_statsShow output directory statsA
Read-only

Show statistics about the output directory and recently generated images.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

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

The annotations already declare readOnlyHint=true, and the description's use of 'Show' is consistent with that. It adds useful scoping around output directory and recently generated images, but it does not disclose output format, potential cost, or hidden scanning behavior. Given the read-only annotation, a mid-range score is appropriate.

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 a single, front-loaded sentence with no filler, repetition, or unnecessary detail. It communicates the verb, resource, and scope efficiently.

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

Completeness4/5

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

For a zero-parameter, read-only stats tool, the description adequately states what the tool operates on and what it returns at a high level. No output schema exists, so 'statistics' is somewhat vague, but the tool is simple enough that an agent can select and invoke it correctly without more detail.

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?

The tool has zero parameters, so there is no parameter behavior to explain. The baseline of 4 applies here because the description does not need to compensate for missing parameter documentation.

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 uses a specific verb ('Show') and clearly identifies the resource ('statistics about the output directory and recently generated images'). It is clearly distinct from generate_image and upload_file, but it does not explicitly differentiate itself from fetch_generation or maintenance.

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 a monitoring use case for checking output directory stats, but it provides no explicit when-to-use guidance or exclusions. Sibling tools like fetch_generation are not referenced as alternatives, so an agent must infer when this tool is appropriate.

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

upload_fileUpload file to Polza Storage APIA

Upload a local file through the Polza Storage API and return its URI & metadata. Useful when the image is larger than 20MB or reused across prompts.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesServer-accessible file path to upload to Polza Storage API.
display_nameNoOptional display name for the uploaded file.

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already indicate readOnlyHint=false, so the write behavior is known. The description adds return value details ('URI & metadata') and a practical constraint (20MB/reuse context), but does not disclose side effects like persistence, overwriting, or authentication requirements. Adds moderate value beyond annotations without contradicting them.

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?

Two sentences with no wasted words: the first states the action and outcome, the second gives practical usage guidance. Front-loaded and highly scannable.

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

Completeness5/5

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

For a simple two-parameter upload tool with full schema coverage and no nested objects, the description is complete. It explains what the tool does, what it returns, and when to use it. No output schema exists, but the return format is explicitly mentioned.

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%, and both parameters already have clear descriptions. The tool description adds minimal parameter-level context beyond the schema, so it stays at the baseline.

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

Purpose5/5

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

The description states a specific verb ('Upload'), a clear resource ('a local file through the Polza Storage API'), and the expected outcome ('return its URI & metadata'). This clearly distinguishes it from siblings like generate_image and fetch_generation, which do different things.

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

Usage Guidelines4/5

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

Provides explicit use conditions: 'Useful when the image is larger than 20MB or reused across prompts.' This gives clear context for when to invoke the tool, though it does not name alternative tools or explicitly state when not to use it.

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. 5 tool updatesv0.6.2
    • First observedfetch_generation
    • First observedgenerate_image
    • First observedmaintenance
    • First observedshow_output_stats
    • First observedupload_file

TDQS

B3/5.0

Scored across 5 tools

Disambiguation4/5

generate_image, upload_file, show_output_stats, and maintenance each have clear and separate purposes. fetch_generation is the only ambiguous tool because it lacks a description and may be confused with retrieval or generation workflows.

Naming Consistency4/5

Four tools follow a verb_noun pattern (generate_image, upload_file, show_output_stats, fetch_generation), but maintenance is a bare noun instead of something like perform_maintenance. The pattern is still readable and mostly predictable.

Tool Count5/5

Five tools is well-scoped for an image generation server: one core generation tool, upload support, stats, fetch, and maintenance. Each tool covers a distinct functional area without redundancy.

Completeness4/5

The set covers the primary generation/editing, upload, retrieval, stats, and cleanup workflows. Minor gaps include no explicit per-file delete/list operations and fetch_generation's undocumented behavior, but agents can generally work around them via maintenance and cleanup.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers