npm package: @pigbun-ai/pigbun-media-generation-mcp
Description: PigBun Media Generation MCP server for text-to-image and image editing workflows with PigBun auth and pluggable media providers
Author: PigBun-AI
Latest version: 1.0.0

# @pigbun-ai/pigbun-media-generation-mcp

PigBun Media Generation MCP is a production-ready Model Context Protocol server for image generation workflows. It provides a simple MCP interface for:

- `text_to_image` — generate images from prompts
- `image_edit` — generate images from prompts plus reference images

Built for PigBun-style authentication and flexible vendor integration, it supports both native Gemini image endpoints and OpenAI-compatible image APIs. The package is bundled for distribution, publishes without source files, and can save generated images directly to local paths.

## Highlights

- PigBun auth gateway verification with cache, signature, and timestamp validation
- Configurable media provider, base URL, API key, and model
- Supports both `gemini-native` and `openai-compatible` provider modes
- Optional local file output via `outputPath`
- Bundled npm package with `dist`-only publish output

## Quick Start

Install and build:

```bash
npm install
npm run build
```

Run with PigBun auth plus a media vendor key:

```bash
PIGBUN_API_KEY=your_pb_live_key \
MEDIA_API_KEY=your_vendor_key \
MEDIA_PROVIDER=gemini-native \
MEDIA_BASE_URL=https://api.midsummer.work \
MEDIA_MODEL=gemini-3.1-flash-image-preview \
node dist/index.js
```

Claude Desktop example:

```json
{
  "mcpServers": {
    "pigbun-media-generation": {
      "command": "npx",
      "args": ["-y", "@pigbun-ai/pigbun-media-generation-mcp"],
      "env": {
        "PIGBUN_API_KEY": "your_pb_live_key",
        "MEDIA_API_KEY": "your_vendor_key",
        "MEDIA_PROVIDER": "gemini-native",
        "MEDIA_BASE_URL": "https://api.midsummer.work",
        "MEDIA_MODEL": "gemini-3.1-flash-image-preview"
      }
    }
  }
}
```

## Environment variables

- `PIGBUN_API_KEY`: required PigBun auth key, used with `https://pigbunai.com`
- `PIGBUN_GATEWAY_URL`: optional auth gateway, defaults to `https://pigbunai.com`
- `PIGBUN_SIGNATURE_SECRET`: optional signature secret for verify response validation
- `MEDIA_API_KEY`: required media vendor key; if omitted, code falls back to `PIGBUN_API_KEY`
- `MEDIA_BASE_URL`: optional media API base URL, defaults to `https://api.midsummer.work`
- `MEDIA_MODEL`: optional model override, defaults to `gemini-3.1-flash-image-preview`
- `MEDIA_PROVIDER`: optional provider, supports `gemini-native` and `openai-compatible`, default is `gemini-native`

## Run

Gemini-native supplier example:

```bash
PIGBUN_API_KEY=your_pb_live_key \
MEDIA_API_KEY=your_vendor_key \
MEDIA_PROVIDER=gemini-native \
MEDIA_BASE_URL=https://api.midsummer.work \
MEDIA_MODEL=gemini-3.1-flash-image-preview \
node dist/index.js
```

OpenAI-compatible supplier example:

```bash
PIGBUN_API_KEY=your_pb_live_key \
MEDIA_API_KEY=your_vendor_key \
MEDIA_PROVIDER=openai-compatible \
MEDIA_BASE_URL=https://your-vendor.example.com \
MEDIA_MODEL=gpt-image-1 \
node dist/index.js
```

## Tool parameters

### `text_to_image`

- `prompt`: string, required
- `outputPath`: string, optional
- `model`: string, optional
- `aspectRatio`: optional enum
- `imageSize`: optional enum

### `image_edit`

- `prompt`: string, required
- `imageInputs`: string array, required, supports URLs and local file paths
- `outputPath`: string, optional
- `model`: string, optional
- `aspectRatio`: optional enum
- `imageSize`: optional enum