Skip to main content
Glama
README.md
# kie-image-mcp

[KIE.ai](https://kie.ai) の画像生成 MCP。KIE.ai 上の任意の画像生成モデル(`google/nano-banana` 系、GPT Image 2 系など)を `model` 引数または環境変数で指定できる。省略時の既定値のみ `gpt-image-2-text-to-image` / `gpt-image-2-image-to-image`。

## Features

- **kie_create_task** / **kie_check_task** - 非同期の単体画像生成
- **kie_create_tasks** / **kie_check_tasks** - 非同期の並列画像生成
- **kie_upload_file** - ローカル参照画像を KIE.ai にアップロードし、`image_input` 用の URL を取得

## Setup

```bash
npm install
cp .env.example .env
# Set KIE_AI_API_KEY in .env
npm run build
```

## Usage with Claude Code

Add to `.mcp.json`:

```json
{
  "mcpServers": {
    "kie-image": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/kie-image-mcp/dist/index.js"]
    }
  }
}
```

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `KIE_AI_API_KEY` | Yes | KIE.ai API key |
| `KIE_IMAGE_TEXT_TO_IMAGE_MODEL` | No | `image_input` なしの既定モデル。未指定時は `gpt-image-2-text-to-image` |
| `KIE_IMAGE_IMAGE_TO_IMAGE_MODEL` | No | `image_input` ありの既定モデル。未指定時は `gpt-image-2-image-to-image` |
| `KIE_IMAGE_MODEL` | No | text-to-image 側の一括上書き。`KIE_IMAGE_TEXT_TO_IMAGE_MODEL` がある場合はそちらを優先 |
| `KIE_IMAGE_RESOLUTION` | No | 既定解像度。`1K` / `2K` / `4K`、未指定時は `1K` |
| `IMAGE_OUTPUT_DIR` | No | Output directory (default: `./output`) |

## モデル切替

`kie_create_task` / `kie_create_tasks` は `model` 引数に KIE.ai の任意のモデル ID(例: `google/nano-banana`)を受け取る。省略時は以下で自動選択する。

| 入力 | 既定モデル |
|---|---|
| `image_input` なし | `gpt-image-2-text-to-image` |
| `image_input` あり | `gpt-image-2-image-to-image` |

モデルによって送信ペイロードを切り替える:

- **GPT Image 2 系**(モデル ID が `gpt-image-2` で始まる): `image_input` を KIE.ai API の `input_urls` に変換して送る。text-to-image 系モデルに `image_input` を渡すとエラーにする。
- **それ以外(nano-banana 等)**: `image_input` + `output_format: png` の形状で送る。

TDQS

A4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: creating single/multiple tasks, checking single/multiple tasks, and uploading files. No overlap or ambiguity.

Naming Consistency5/5

All tools follow the consistent pattern 'kie_verb_noun' with singular/plural variants (check_task vs check_tasks, create_task vs create_tasks) and one upload_file.

Tool Count5/5

Five tools cover the core workflow of image generation (create, check, upload) without being excessive or minimal. The count is well-scoped for the domain.

Completeness4/5

Covers creation, status checking, and file upload. Missing potential delete or cancel operations, but the set is functional for typical image generation tasks.