Skip to main content
Glama

Gemini Image MCP

Gemini Image MCP Banner

MCP サーバー。Google の Gemini 画像モデル (Nano Banana, Nano Banana 2, Nano Banana Pro) を使用して画像を生成・編集します。generate_image というツールを公開しており、Claude、Codex、Cline などの AI ツールがあなたの API キーを使って呼び出すことができます。

機能

  • generate_image はテキストから画像への生成を処理し、参照画像(ローカルファイルパスまたは base64)を渡すと編集や合成も行います。

  • 呼び出しごとにすべての生成パラメータを公開:temperature (1)、topP (0.95)、topKmaxOutputTokens (flash/lite は 65536、pro は 32768)、seedstopSequencespresencePenaltyfrequencyPenaltysystemInstructionthinkingLevel (minimal/high)、thinkingBudgetenableGoogleSearch (デフォルト true)、imageSize (512/1K/2K/4K)、aspectRatio ("auto" デフォルト + 標準比率)、personGeneration

  • instructions ブロックとパラメータごとの説明を提供するため、MCP クライアントは追加のプロンプトなしでツールの使用方法を理解できます。

  • 画像をディスクに保存し、ファイルパスを返します。応答に base64 は含まれないため、4K 画像でもクライアントのコンテキストウィンドウを消費しません。

  • エラーは生の API ダンプではなく、ヒント(キー不良、レート制限、セーフティブロック、不明なモデル)とともに返されます。

  • stdio トランスポート。これはローカル MCP サーバーの通常のセットアップです。

必要条件

インストール

bun install

設定

通常は MCP クライアントの設定で指定する 3 つの環境変数:

変数

必須

デフォルト

説明

GEMINI_API_KEY

はい (GOOGLE_API_KEY も可)

Gemini API キー。両方設定されている場合、GEMINI_API_KEY が優先されます。

GEMINI_IMAGE_MODEL

いいえ

gemini-3.1-flash-image

呼び出しで指定がない場合に使用されるモデル。

GEMINI_IMAGE_OUTPUT_DIR

いいえ

<cwd>/generated-images

画像の保存先。存在しない場合は作成されます。

選択可能なモデル:

モデル

最大出力トークン

思考レベル

Google 検索

最大サイズ

備考

gemini-3.1-flash-image

65536

minimal / high

対応

2K

Nano Banana 2。高速、低コスト、汎用。デフォルト。

gemini-3.1-flash-lite-image

65536

minimal / high

対応

2K

軽量で高スループットのモデル。

gemini-3-pro-image

32768

(なし)

対応

4K

Nano Banana Pro。最高品質と画像内テキスト、そして 4K に対応する唯一のモデル。

モデルは models/ プレフィックスで指定することもできます(例:models/gemini-3.1-flash-image)。

クライアント設定

Claude Desktop

これを ~/Library/Application Support/Claude/claude_desktop_config.json に追加します:

{
  "mcpServers": {
    "gemini-image": {
      "command": "bun",
      "args": ["run", "/absolute/path/to/gemini-image-mcp/index.ts"],
      "env": {
        "GEMINI_API_KEY": "YOUR_KEY_HERE"
      }
    }
  }
}

Cline (VS Code)

cline_mcp_settings.json

{
  "mcpServers": {
    "gemini-image": {
      "command": "bun",
      "args": ["run", "/absolute/path/to/gemini-image-mcp/index.ts"],
      "env": {
        "GEMINI_API_KEY": "YOUR_KEY_HERE"
      }
    }
  }
}

Codex

~/.codex/config.toml

[mcp_servers.gemini-image]
command = "bun"
args = ["run", "/absolute/path/to/gemini-image-mcp/index.ts"]
env = { GEMINI_API_KEY = "YOUR_KEY_HERE" }

npm から (bunx/npx)

パッケージが公開されたら、クライアントを bunx に向けてください:

{
  "mcpServers": {
    "gemini-image": {
      "command": "bunx",
      "args": ["gemini-image-mcp"],
      "env": { "GEMINI_API_KEY": "YOUR_KEY_HERE" }
    }
  }
}

generate_image パラメータ

prompt のみ必須です。その他はすべて画像生成に適切なデフォルト値になります。

パラメータ

デフォルト

説明

prompt

string

(必須)

画像の説明、または referenceImages が指定された場合は編集の説明。

model

string

env / gemini-3.1-flash-image

Gemini 画像モデル(上の表を参照)。models/ プレフィックスを受け付けます。

referenceImages

配列 (≤14)

編集・合成用のソース画像:{ path } または { base64, mimeType }

imageSize

"512" | "1K" | "2K" | "4K"

"1K"

出力解像度:512(最速、軽量)、1K(デフォルト)、2K、4K(gemini-3-pro-image が必要)。

aspectRatio

列挙型

"auto"

"auto"(デフォルト、プロンプトから推測または参照画像に合わせる)または明示的に:1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 4:1, 1:8, 8:1

personGeneration

列挙型

allow_all

allow_all / allow_adult / allow_none

thinkingLevel

列挙型

"minimal" (flash モデル上)

"minimal" / "high"gemini-3.1-flash-imagegemini-3.1-flash-lite-image でサポート。Pro ではサポートされていません。

enableGoogleSearch

boolean

true

Google 検索グラウンディングツールを有効にし、全モデルでリアルタイムのウェブ知識と精度を提供します。

thinkingBudget

int

明示的な思考予算(0 = オフ、-1 = 自動)。

temperature

number 0–2

1

サンプリングのランダム性。

topP

number 0–1

0.95

核サンプリング。

topK

int

Top-k サンプリング。

maxOutputTokens

int 1–65536

65536 (flash) / 32768 (pro)

出力トークン上限。

seed

int

ベストエフォートの再現性。

stopSequences

string[] (≤5)

テキスト部分の停止シーケンス。

presencePenalty / frequencyPenalty

number -2..2

トークンに対するペナルティ。

systemInstruction

string

スタイル/動作の指示。例:"flat vector style"。

outputDir

string

env / <cwd>/generated-images

保存先。

fileName

string

gemini-image-<timestamp>

ベースファイル名(拡張子は MIME タイプから自動)。

ツールは、保存されたファイルパス、モデル、有効な設定、トークン使用量を含むテキストサマリーを返します。画像データをインラインで返すことはありません。結果を見るにはファイルを開いてください。

AI に依頼できること

  • "雨の東京の夜の通りを、シネマティックなネオン照明で撮影した16:9のヒーロー画像を生成してください。"

  • "/tmp/product.png を編集:大理石のテーブルに置き、柔らかな朝の光を当ててください" (これは referenceImages を使用します)。

  • "gemini-3-pro-image を使用して、正確な見出し 'LAUNCH DAY' の4Kポスターを生成してください。"

開発

bun test              # unit tests (config, schema, request/response parsing)
bun run typecheck     # tsc --noEmit
bun run inspector     # interactive MCP inspector (needs GEMINI_API_KEY)
bun run start         # run the server on stdio

トラブルシューティング

  • "Missing Gemini API key"GEMINI_API_KEY をクライアントの MCP 設定の env ブロックに設定してください。Claude Desktop のような GUI アプリではシェル環境を読み取らないため、シェルに設定するだけでは不十分です。

  • セーフティブロック:プロンプトを言い換えてください。人物が含まれる場合は personGeneration を確認してください。

  • 429 / クォータ超過:待って再試行するか、gemini-3.1-flash-image を使用してください(こちらはクォータが高いです)。

  • ログ:サーバーはログを stderr のみに出力します。stdout は MCP プロトコルを運ぶため、どこにも console.log を追加しないでください。

作者

Thomi Jasir dev@venobi.com

ライセンス

MIT

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thomijasir/gemini-image-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server