image-router-mcp 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,12 +21,20 @@ Run it directly from npm with `npx`. You only need an API key for the provider y
21
21
 
22
22
  | Tool | Provider | Built-in default model | Supports |
23
23
  | --- | --- | --- | --- |
24
- | `openai_generate_image` | OpenAI | `gpt-image-2` | Text-to-image and local reference/edit images |
24
+ | `openai_generate_image` | OpenAI | `gpt-image-2.5-sunburst` | Text-to-image and local reference/edit images, including `xhigh`/`max` quality |
25
25
  | `google_generate_image` | Google Gemini/Nano Banana | `gemini-3.1-flash-image` | Text-to-image and local reference/edit images through the Interactions API |
26
- | `xai_generate_image` | xAI/Grok | `grok-imagine-image-quality` | Text-to-image and edits with up to 3 local input images |
26
+ | `xai_generate_image` | xAI/Grok | `grok-imagine-image-2.0` | Text-to-image and edits with up to 5 local input images |
27
27
 
28
28
  Model IDs are examples and defaults, not an allowlist. Other compatible model IDs can be supplied through the `model` argument.
29
29
 
30
+ ### Model update notes (2026-09-09)
31
+
32
+ - OpenAI: Sunburst is the default for editing precision. Choose `gpt-image-2.5-flare` for everyday generation, or explicitly set `gpt-image-2` to retain the previous model. `xhigh` and `max` require GPT Image 2.5 or a compatible newer model. [Official guide](https://developers.openai.com/api/docs/guides/image-generation)
33
+ - Google: `gemini-3.1-flash-lite-image` (Nano Banana 2 Lite) is an optional faster, lower-cost model, limited to `1K` output. The default remains `gemini-3.1-flash-image`. [Official guide](https://ai.google.dev/gemini-api/docs/image-generation)
34
+ - xAI: Imagine Image 2.0 replaces the previous built-in default. The old `grok-imagine-image-quality` slug is scheduled to redirect to 2.0 at `low` quality on November 2, 2026. With 2.0, omitted `quality` uses provider `auto`, currently `low` for generation and `medium` for edits. Pin `quality` to control this cost/quality choice. Environment model pins still take precedence. [Migration guide](https://docs.x.ai/developers/migration/imagine-image-quality-nov-2)
35
+
36
+ Model access depends on your provider account. No automatic fallback to another paid model is performed.
37
+
30
38
  ## Prerequisites
31
39
 
32
40
  - Node.js 20 or later, including `npm` and `npx`.
@@ -121,7 +129,7 @@ Use absolute paths in prompts and tool calls. Relative paths depend on the worki
121
129
  - When `output_path` is omitted, files are saved under `DEFAULT_OUTPUT_DIR`, or `./generated-images` relative to the MCP server working directory.
122
130
  - Use absolute input and output paths for predictable behavior across clients.
123
131
  - For portable local-image use across providers, use PNG, JPG/JPEG, or WebP files. The Google and xAI loaders accept these extensions.
124
- - xAI accepts at most 3 `input_images`.
132
+ - xAI Imagine Image 2.0 accepts at most 5 `input_images`. Older model IDs retain the 3-image limit.
125
133
 
126
134
  ### Return modes
127
135
 
@@ -153,9 +161,10 @@ Use `file` for large images. Use `inline` or `both` only when the MCP client can
153
161
  | Parameter | Values or examples | Default |
154
162
  | --- | --- | --- |
155
163
  | `size` | `auto`, `1024x1024`, `1536x1024`, or another supported `WIDTHxHEIGHT` | Provider default |
156
- | `quality` | `auto`, `low`, `medium`, `high`, `standard`, `hd` | Provider default |
164
+ | `quality` | `auto`, `low`, `medium`, `high`, `xhigh`, `max`, `standard`, `hd` (model-dependent) | Provider default |
157
165
  | `background` | `transparent`, `opaque`, `auto` | Provider default |
158
166
  | `output_format` | `png`, `jpeg`, `webp` | `png` |
167
+ | `output_compression` | Integer `0`–`100`, GPT Image JPEG/WebP output only | Provider default |
159
168
  | `moderation` | `low`, `auto` | Provider default |
160
169
  | `style` | `vivid`, `natural`; used with DALL-E 3 | Provider default |
161
170
 
@@ -165,15 +174,23 @@ Use `file` for large images. Use `inline` or `both` only when the MCP client can
165
174
  | --- | --- | --- |
166
175
  | `aspect_ratio` | For example `1:1`, `16:9`, `9:16`, `4:3`, or `3:2` | Provider default |
167
176
  | `image_size` | `512`, `0.5K`, `1K`, `2K`, `4K`; availability depends on the model | Provider default |
177
+ | `output_format` | `png`, `jpeg` | Provider default |
178
+ | `thinking_level` | `minimal`, `high`, for Gemini 3.1 Flash Image / Flash Lite Image | Provider default |
179
+ | `previous_interaction_id` | `metadata.interactionId` from a previous Google result | None |
168
180
 
169
181
  `0.5K` is accepted as a legacy alias and normalized to `512`.
170
182
 
183
+ For a follow-up edit, pass the previous result's `metadata.interactionId` as `previous_interaction_id` with the new prompt. The previous interaction must still be available in the same Google account. This uses provider-stored conversation context and follows Google's retention policy. A stale or unavailable ID returns an error without silently starting a new generation. Lite is not optimized for sequential editing. Higher thinking levels can increase cost and latency.
184
+
171
185
  ### xAI parameters
172
186
 
173
187
  | Parameter | Values or examples | Default |
174
188
  | --- | --- | --- |
175
189
  | `aspect_ratio` | For example `1:1`, `16:9`, `9:16`, `3:2`, or `auto` | Provider default |
176
190
  | `resolution` | `1k`, `2k` | Provider default |
191
+ | `quality` | `low`, `medium`, `auto`, for Imagine Image 2.0 or compatible newer models | Provider `auto` |
192
+
193
+ Aspect ratios also accept `21:9` and `5:2`. When xAI returns its serving model ID, it is included as `metadata.servedModel`. The top-level `model` continues to identify the requested model.
177
194
 
178
195
  ## Configuration
179
196
 
@@ -198,7 +215,7 @@ Most users can ask their MCP client in natural language. If your client supports
198
215
  "tool": "openai_generate_image",
199
216
  "arguments": {
200
217
  "prompt": "A cinematic product photo of a transparent mechanical keyboard on a marble desk",
201
- "model": "gpt-image-2",
218
+ "model": "gpt-image-2.5-sunburst",
202
219
  "size": "1024x1024",
203
220
  "return_mode": "file",
204
221
  "output_path": "/absolute/path/to/generated-images"
package/README.zh-TW.md CHANGED
@@ -21,12 +21,20 @@
21
21
 
22
22
  | 工具 | 供應商 | 內建預設模型 | 支援內容 |
23
23
  | --- | --- | --- | --- |
24
- | `openai_generate_image` | OpenAI | `gpt-image-2` | 文字生成圖片及本機參考圖/編輯圖 |
24
+ | `openai_generate_image` | OpenAI | `gpt-image-2.5-sunburst` | 文字生成圖片及本機參考圖/編輯圖,支援 `xhigh`/`max` 品質 |
25
25
  | `google_generate_image` | Google Gemini/Nano Banana | `gemini-3.1-flash-image` | 透過 Interactions API 進行文字生成圖片及本機參考圖/編輯圖 |
26
- | `xai_generate_image` | xAI/Grok | `grok-imagine-image-quality` | 文字生成圖片,以及最多 3 張本機輸入圖的編輯 |
26
+ | `xai_generate_image` | xAI/Grok | `grok-imagine-image-2.0` | 文字生成圖片,以及最多 5 張本機輸入圖的編輯 |
27
27
 
28
28
  以上模型是範例與預設值,不是允許清單。可透過 `model` 參數傳入其他相容的模型 ID。
29
29
 
30
+ ### 模型更新說明(2026-09-09)
31
+
32
+ - OpenAI:預設使用偏重精準編輯的 Sunburst,日常生成可選 `gpt-image-2.5-flare`。若要維持先前模型,可明確指定 `gpt-image-2`。`xhigh`、`max` 需使用 GPT Image 2.5 或相容的新模型。[官方指南](https://developers.openai.com/api/docs/guides/image-generation)
33
+ - Google:可選速度更快、成本較低的 `gemini-3.1-flash-lite-image`(Nano Banana 2 Lite),僅支援 `1K` 輸出。預設仍為 `gemini-3.1-flash-image`。[官方指南](https://ai.google.dev/gemini-api/docs/image-generation)
34
+ - xAI:內建預設改為 Imagine Image 2.0。舊 `grok-imagine-image-quality` 預計於 2026 年 11 月 2 日轉向 2.0 的 `low` 品質。2.0 未指定 `quality` 時採供應商的 `auto`,目前生成使用 `low`、編輯使用 `medium`,費用隨實際品質而異。可明確指定品質,環境變數固定模型的行為仍保留。[遷移指南](https://docs.x.ai/developers/migration/imagine-image-quality-nov-2)
35
+
36
+ 模型存取權依供應商帳戶而定。無法使用時,不會自動改呼叫其他付費模型。
37
+
30
38
  ## 前置需求
31
39
 
32
40
  - Node.js 20 以上版本,並包含 `npm` 與 `npx`。
@@ -121,7 +129,7 @@ OPENAI_API_KEY = "your_openai_key"
121
129
  - 未傳入 `output_path` 時,圖片會儲存在 `DEFAULT_OUTPUT_DIR`;若未設定該變數,則使用 MCP server 工作目錄下的 `./generated-images`。
122
130
  - 建議輸入與輸出都使用絕對路徑,確保不同客戶端有一致結果。
123
131
  - 若要跨供應商使用本機圖片,建議採用 PNG、JPG/JPEG 或 WebP。Google 與 xAI 的載入器接受這些副檔名。
124
- - xAI 最多接受 3 張 `input_images`。
132
+ - xAI Imagine Image 2.0 最多接受 5 張 `input_images`,舊模型維持 3 張限制。
125
133
 
126
134
  ### 回傳模式
127
135
 
@@ -153,9 +161,10 @@ OPENAI_API_KEY = "your_openai_key"
153
161
  | 參數 | 值或範例 | 預設值 |
154
162
  | --- | --- | --- |
155
163
  | `size` | `auto`、`1024x1024`、`1536x1024` 或其他支援的 `WIDTHxHEIGHT` | 供應商預設值 |
156
- | `quality` | `auto`、`low`、`medium`、`high`、`standard`、`hd` | 供應商預設值 |
164
+ | `quality` | `auto`、`low`、`medium`、`high`、`xhigh`、`max`、`standard`、`hd`,依模型支援 | 供應商預設值 |
157
165
  | `background` | `transparent`、`opaque`、`auto` | 供應商預設值 |
158
166
  | `output_format` | `png`、`jpeg`、`webp` | `png` |
167
+ | `output_compression` | 整數 `0`–`100`,僅供 GPT Image 的 JPEG/WebP 輸出使用 | 供應商預設值 |
159
168
  | `moderation` | `low`、`auto` | 供應商預設值 |
160
169
  | `style` | `vivid`、`natural`;供 DALL-E 3 使用 | 供應商預設值 |
161
170
 
@@ -165,15 +174,23 @@ OPENAI_API_KEY = "your_openai_key"
165
174
  | --- | --- | --- |
166
175
  | `aspect_ratio` | 例如 `1:1`、`16:9`、`9:16`、`4:3` 或 `3:2` | 供應商預設值 |
167
176
  | `image_size` | `512`、`0.5K`、`1K`、`2K`、`4K`;實際可用值依模型而定 | 供應商預設值 |
177
+ | `output_format` | `png`、`jpeg` | 供應商預設值 |
178
+ | `thinking_level` | `minimal`、`high`,供 Gemini 3.1 Flash Image/Flash Lite Image 使用 | 供應商預設值 |
179
+ | `previous_interaction_id` | 前次 Google 結果的 `metadata.interactionId` | 無 |
168
180
 
169
181
  `0.5K` 是相容舊版的別名,送出前會正規化為 `512`。
170
182
 
183
+ 連續編輯時,將前次結果的 `metadata.interactionId` 放入 `previous_interaction_id`,並提供新的提示詞。前次互動必須仍可由同一 Google 帳戶存取。此功能使用供應商儲存的對話脈絡,適用 Google 的資料保留政策。ID 過期或無法使用時會回報錯誤,不會悄悄重新生成。Lite 不以連續編輯為主要用途,提高思考等級可能增加費用與等待時間。
184
+
171
185
  ### xAI 參數
172
186
 
173
187
  | 參數 | 值或範例 | 預設值 |
174
188
  | --- | --- | --- |
175
189
  | `aspect_ratio` | 例如 `1:1`、`16:9`、`9:16`、`3:2` 或 `auto` | 供應商預設值 |
176
190
  | `resolution` | `1k`、`2k` | 供應商預設值 |
191
+ | `quality` | `low`、`medium`、`auto`,供 Imagine Image 2.0 或相容新模型使用 | 供應商 `auto` |
192
+
193
+ 長寬比亦可指定 `21:9`、`5:2`。xAI 回傳實際服務模型時,會記錄於 `metadata.servedModel`。最外層的 `model` 仍表示請求指定的模型。
177
194
 
178
195
  ## 環境設定
179
196
 
@@ -198,7 +215,7 @@ Key 只會在呼叫對應工具時檢查,因此只設定一個供應商 Key
198
215
  "tool": "openai_generate_image",
199
216
  "arguments": {
200
217
  "prompt": "A cinematic product photo of a transparent mechanical keyboard on a marble desk",
201
- "model": "gpt-image-2",
218
+ "model": "gpt-image-2.5-sunburst",
202
219
  "size": "1024x1024",
203
220
  "return_mode": "file",
204
221
  "output_path": "/absolute/path/to/generated-images"
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { pathToFileURL } from "node:url";
3
+ import { readFileSync } from "node:fs";
3
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
6
  import { formatError } from "./errors.js";
@@ -30,11 +31,11 @@ function errorResult(error) {
30
31
  export function createServer() {
31
32
  const server = new McpServer({
32
33
  name: "image-router-mcp",
33
- version: "0.1.0",
34
+ version: JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version,
34
35
  });
35
36
  server.registerTool("openai_generate_image", {
36
37
  title: "OpenAI image generation and editing",
37
- description: "Generate or edit images with OpenAI image models. Model is a flexible string so newly released image models are not blocked.",
38
+ description: "Generate or edit images with OpenAI GPT Image 2.5 Sunburst and Flare, including xhigh/max quality and JPEG/WebP compression. Compatible model IDs remain flexible.",
38
39
  inputSchema: openAIInputShape,
39
40
  }, async (rawParams) => {
40
41
  try {
@@ -48,7 +49,7 @@ export function createServer() {
48
49
  });
49
50
  server.registerTool("google_generate_image", {
50
51
  title: "Google Gemini/Nano Banana image generation and editing",
51
- description: "Generate or edit images with Google Gemini image models, including Nano Banana, Nano Banana 2, and Nano Banana Pro model IDs.",
52
+ description: "Generate or edit images with Google Gemini image models, including Nano Banana 2, Nano Banana 2 Lite, and Nano Banana Pro. Continue edits with previous_interaction_id and choose PNG/JPEG output.",
52
53
  inputSchema: googleInputShape,
53
54
  }, async (rawParams) => {
54
55
  try {
@@ -62,7 +63,7 @@ export function createServer() {
62
63
  });
63
64
  server.registerTool("xai_generate_image", {
64
65
  title: "xAI/Grok image generation and editing",
65
- description: "Generate or edit images with xAI Grok Imagine models. Local input_images are sent as data URIs for the xAI JSON image edit endpoint.",
66
+ description: "Generate or edit images with xAI Imagine Image 2.0, with low/medium/auto quality and up to five local reference images sent as data URIs. Older model IDs remain available.",
66
67
  inputSchema: xaiInputShape,
67
68
  }, async (rawParams) => {
68
69
  try {
@@ -1,6 +1,6 @@
1
1
  import { GoogleGenAI } from "@google/genai";
2
2
  import { base64FromUrl, bytesFromBase64, loadInputImages } from "../files.js";
3
- import { requireEnv } from "../errors.js";
3
+ import { requireEnv, UserInputError } from "../errors.js";
4
4
  let googleClient;
5
5
  function getGoogleClient() {
6
6
  if (!googleClient) {
@@ -13,6 +13,9 @@ export function setGoogleClientForTests(client) {
13
13
  }
14
14
  export async function generateGoogleImage(params, client = getGoogleClient()) {
15
15
  const model = process.env.DEFAULT_GOOGLE_IMAGE_MODEL ?? params.model;
16
+ if (/^gemini-3\.1-flash-lite-image(?:-|$)/.test(model) && params.image_size && params.image_size !== "1K") {
17
+ throw new UserInputError("Gemini 3.1 Flash Lite Image supports only image_size 1K.");
18
+ }
16
19
  const inputImages = await loadInputImages(params.input_images);
17
20
  const input = [
18
21
  ...inputImages.map((image) => ({
@@ -25,9 +28,12 @@ export async function generateGoogleImage(params, client = getGoogleClient()) {
25
28
  const response = await client.interactions.create({
26
29
  model,
27
30
  input,
31
+ ...(params.previous_interaction_id ? { previous_interaction_id: params.previous_interaction_id } : {}),
32
+ ...(params.thinking_level ? { generation_config: { thinking_level: params.thinking_level } } : {}),
28
33
  response_format: {
29
34
  type: "image",
30
35
  delivery: "inline",
36
+ ...(params.output_format ? { mime_type: `image/${params.output_format}` } : {}),
31
37
  ...(params.aspect_ratio ? { aspect_ratio: params.aspect_ratio } : {}),
32
38
  ...(params.image_size ? { image_size: params.image_size === "0.5K" ? "512" : params.image_size } : {}),
33
39
  },
@@ -37,7 +43,7 @@ export async function generateGoogleImage(params, client = getGoogleClient()) {
37
43
  if (outputImage?.data) {
38
44
  image = {
39
45
  data: outputImage.data,
40
- mimeType: outputImage.mime_type ?? "image/png",
46
+ mimeType: outputImage.mime_type ?? `image/${params.output_format ?? "png"}`,
41
47
  bytes: bytesFromBase64(outputImage.data),
42
48
  };
43
49
  }
@@ -30,10 +30,20 @@ async function imageFromOpenAIItem(item, mimeType) {
30
30
  throw new Error("OpenAI response did not include b64_json or url image data.");
31
31
  }
32
32
  export async function generateOpenAIImage(params, client = getOpenAIClient()) {
33
- const model = params.model ?? process.env.DEFAULT_OPENAI_IMAGE_MODEL ?? "gpt-image-2";
33
+ const model = params.model ?? process.env.DEFAULT_OPENAI_IMAGE_MODEL ?? "gpt-image-2.5-sunburst";
34
34
  const outputFormat = params.output_format ?? "png";
35
35
  const inputImages = params.input_images ?? [];
36
36
  const dallEModel = isDallEModel(model);
37
+ if (params.output_compression !== undefined && (dallEModel || outputFormat === "png")) {
38
+ throw new UserInputError("output_compression requires a GPT Image model with output_format jpeg or webp.");
39
+ }
40
+ if ((params.quality === "xhigh" || params.quality === "max") &&
41
+ (dallEModel || /^gpt-image-(?:1(?:[.-]|$)|2(?:-|$))/.test(model))) {
42
+ throw new UserInputError("Quality xhigh and max require GPT Image 2.5 or a compatible newer model.");
43
+ }
44
+ // SDK 6 keeps Node.js 20 support. It forwards the API's new quality values unchanged,
45
+ // but its type declarations predate GPT Image 2.5. Wire-format tests cover both endpoints.
46
+ const quality = params.quality;
37
47
  const common = {
38
48
  model,
39
49
  prompt: params.prompt,
@@ -45,6 +55,7 @@ export async function generateOpenAIImage(params, client = getOpenAIClient()) {
45
55
  : {
46
56
  background: params.background,
47
57
  output_format: outputFormat,
58
+ output_compression: params.output_compression,
48
59
  }),
49
60
  };
50
61
  const response = inputImages.length > 0
@@ -54,7 +65,7 @@ export async function generateOpenAIImage(params, client = getOpenAIClient()) {
54
65
  }
55
66
  return client.images.edit({
56
67
  ...common,
57
- quality: params.quality,
68
+ quality: quality,
58
69
  image: inputImages.length === 1
59
70
  ? createReadStream(inputImages[0])
60
71
  : inputImages.map((imagePath) => createReadStream(imagePath)),
@@ -62,7 +73,7 @@ export async function generateOpenAIImage(params, client = getOpenAIClient()) {
62
73
  })()
63
74
  : await client.images.generate({
64
75
  ...common,
65
- quality: params.quality,
76
+ quality,
66
77
  ...(dallEModel ? { style: params.style } : { moderation: params.moderation }),
67
78
  });
68
79
  const data = "data" in response ? response.data ?? [] : [];
@@ -1,5 +1,5 @@
1
1
  import { base64FromUrl, bytesFromBase64, loadInputImages, toDataUri } from "../files.js";
2
- import { requireEnv } from "../errors.js";
2
+ import { requireEnv, UserInputError } from "../errors.js";
3
3
  const XAI_BASE_URL = "https://api.x.ai/v1";
4
4
  async function imageFromXAIItem(item) {
5
5
  if (item.b64_json) {
@@ -17,6 +17,13 @@ async function imageFromXAIItem(item) {
17
17
  }
18
18
  export async function generateXAIImage(params, fetchImpl = fetch) {
19
19
  const model = process.env.DEFAULT_XAI_IMAGE_MODEL ?? params.model;
20
+ const legacyModel = /^grok-imagine-image(?:-quality|-pro)?(?:-latest|-\d{8})?$/.test(model);
21
+ if (legacyModel && (params.input_images?.length ?? 0) > 3) {
22
+ throw new UserInputError("This older xAI model supports up to 3 input images. Use grok-imagine-image-2.0 for up to 5.");
23
+ }
24
+ if (legacyModel && params.quality !== undefined) {
25
+ throw new UserInputError("The quality parameter requires grok-imagine-image-2.0 or a compatible newer model.");
26
+ }
20
27
  const inputImages = await loadInputImages(params.input_images);
21
28
  const isEdit = inputImages.length > 0;
22
29
  const body = {
@@ -25,6 +32,7 @@ export async function generateXAIImage(params, fetchImpl = fetch) {
25
32
  n: params.n,
26
33
  aspect_ratio: params.aspect_ratio,
27
34
  resolution: params.resolution,
35
+ quality: params.quality,
28
36
  response_format: "b64_json",
29
37
  user: params.user,
30
38
  };
@@ -58,6 +66,7 @@ export async function generateXAIImage(params, fetchImpl = fetch) {
58
66
  images: await Promise.all(data.map(imageFromXAIItem)),
59
67
  metadata: {
60
68
  usage: "usage" in responseBody ? responseBody.usage : undefined,
69
+ servedModel: "model" in responseBody ? responseBody.model : undefined,
61
70
  },
62
71
  };
63
72
  }
package/dist/schemas.d.ts CHANGED
@@ -13,6 +13,8 @@ export declare const openAIInputShape: {
13
13
  low: "low";
14
14
  medium: "medium";
15
15
  high: "high";
16
+ xhigh: "xhigh";
17
+ max: "max";
16
18
  standard: "standard";
17
19
  hd: "hd";
18
20
  }>>;
@@ -26,6 +28,7 @@ export declare const openAIInputShape: {
26
28
  jpeg: "jpeg";
27
29
  webp: "webp";
28
30
  }>>;
31
+ readonly output_compression: z.ZodOptional<z.ZodNumber>;
29
32
  readonly moderation: z.ZodOptional<z.ZodEnum<{
30
33
  auto: "auto";
31
34
  low: "low";
@@ -48,6 +51,15 @@ export declare const openAIInputShape: {
48
51
  };
49
52
  export declare const googleInputShape: {
50
53
  readonly model: z.ZodDefault<z.ZodString>;
54
+ readonly output_format: z.ZodOptional<z.ZodEnum<{
55
+ png: "png";
56
+ jpeg: "jpeg";
57
+ }>>;
58
+ readonly previous_interaction_id: z.ZodOptional<z.ZodString>;
59
+ readonly thinking_level: z.ZodOptional<z.ZodEnum<{
60
+ high: "high";
61
+ minimal: "minimal";
62
+ }>>;
51
63
  readonly aspect_ratio: z.ZodOptional<z.ZodString>;
52
64
  readonly image_size: z.ZodOptional<z.ZodEnum<{
53
65
  512: "512";
@@ -71,6 +83,11 @@ export declare const googleInputShape: {
71
83
  export declare const xaiInputShape: {
72
84
  readonly input_images: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
85
  readonly model: z.ZodDefault<z.ZodString>;
86
+ readonly quality: z.ZodOptional<z.ZodEnum<{
87
+ auto: "auto";
88
+ low: "low";
89
+ medium: "medium";
90
+ }>>;
74
91
  readonly aspect_ratio: z.ZodOptional<z.ZodString>;
75
92
  readonly resolution: z.ZodOptional<z.ZodEnum<{
76
93
  "1k": "1k";
@@ -95,6 +112,8 @@ export declare const openAIParamsSchema: z.ZodObject<{
95
112
  low: "low";
96
113
  medium: "medium";
97
114
  high: "high";
115
+ xhigh: "xhigh";
116
+ max: "max";
98
117
  standard: "standard";
99
118
  hd: "hd";
100
119
  }>>;
@@ -108,6 +127,7 @@ export declare const openAIParamsSchema: z.ZodObject<{
108
127
  jpeg: "jpeg";
109
128
  webp: "webp";
110
129
  }>>;
130
+ output_compression: z.ZodOptional<z.ZodNumber>;
111
131
  moderation: z.ZodOptional<z.ZodEnum<{
112
132
  auto: "auto";
113
133
  low: "low";
@@ -130,6 +150,15 @@ export declare const openAIParamsSchema: z.ZodObject<{
130
150
  }, z.core.$strict>;
131
151
  export declare const googleParamsSchema: z.ZodObject<{
132
152
  model: z.ZodDefault<z.ZodString>;
153
+ output_format: z.ZodOptional<z.ZodEnum<{
154
+ png: "png";
155
+ jpeg: "jpeg";
156
+ }>>;
157
+ previous_interaction_id: z.ZodOptional<z.ZodString>;
158
+ thinking_level: z.ZodOptional<z.ZodEnum<{
159
+ high: "high";
160
+ minimal: "minimal";
161
+ }>>;
133
162
  aspect_ratio: z.ZodOptional<z.ZodString>;
134
163
  image_size: z.ZodOptional<z.ZodEnum<{
135
164
  512: "512";
@@ -153,6 +182,11 @@ export declare const googleParamsSchema: z.ZodObject<{
153
182
  export declare const xaiParamsSchema: z.ZodObject<{
154
183
  input_images: z.ZodOptional<z.ZodArray<z.ZodString>>;
155
184
  model: z.ZodDefault<z.ZodString>;
185
+ quality: z.ZodOptional<z.ZodEnum<{
186
+ auto: "auto";
187
+ low: "low";
188
+ medium: "medium";
189
+ }>>;
156
190
  aspect_ratio: z.ZodOptional<z.ZodString>;
157
191
  resolution: z.ZodOptional<z.ZodEnum<{
158
192
  "1k": "1k";
package/dist/schemas.js CHANGED
@@ -5,7 +5,7 @@ export const returnModeSchema = z
5
5
  .default("file")
6
6
  .describe("How generated images are returned. Use file for large images; inline embeds base64 image content in the MCP response.");
7
7
  const nonEmptyString = z.string().trim().min(1);
8
- const defaultOpenAIImageModel = process.env.DEFAULT_OPENAI_IMAGE_MODEL ?? "gpt-image-2";
8
+ const defaultOpenAIImageModel = process.env.DEFAULT_OPENAI_IMAGE_MODEL ?? "gpt-image-2.5-sunburst";
9
9
  const commonImageShape = {
10
10
  prompt: nonEmptyString.describe("Image generation or editing instructions."),
11
11
  model: nonEmptyString.optional().describe("Provider model ID. Any string is allowed so newly released models are not blocked."),
@@ -23,17 +23,21 @@ const commonImageShape = {
23
23
  };
24
24
  export const openAIInputShape = {
25
25
  ...commonImageShape,
26
- model: nonEmptyString.default(defaultOpenAIImageModel).describe("OpenAI image model ID. Defaults to DEFAULT_OPENAI_IMAGE_MODEL or gpt-image-2."),
26
+ model: nonEmptyString.default(defaultOpenAIImageModel).describe("OpenAI image model ID. Defaults to DEFAULT_OPENAI_IMAGE_MODEL or gpt-image-2.5-sunburst. Use gpt-image-2.5-flare for everyday generation."),
27
27
  size: nonEmptyString.optional().describe("OpenAI size, such as auto, 1024x1024, 1536x1024, or any supported WIDTHxHEIGHT."),
28
- quality: z.enum(["auto", "low", "medium", "high", "standard", "hd"]).optional().describe("OpenAI quality."),
28
+ quality: z.enum(["auto", "low", "medium", "high", "xhigh", "max", "standard", "hd"]).optional().describe("OpenAI quality. xhigh and max require GPT Image 2.5 or a compatible newer model. Higher quality can increase cost and latency."),
29
29
  background: z.enum(["transparent", "opaque", "auto"]).optional().describe("OpenAI background option."),
30
30
  output_format: z.enum(["png", "jpeg", "webp"]).default("png").describe("Output image format."),
31
+ output_compression: z.number().int().min(0).max(100).optional().describe("Output compression from 0 to 100 for JPEG or WebP GPT Image output."),
31
32
  moderation: z.enum(["low", "auto"]).optional().describe("OpenAI moderation setting for supported models."),
32
33
  style: z.enum(["vivid", "natural"]).optional().describe("DALL-E 3 style option."),
33
34
  };
34
35
  export const googleInputShape = {
35
36
  ...commonImageShape,
36
37
  model: nonEmptyString.default("gemini-3.1-flash-image").describe("Google image model ID. Defaults to Nano Banana 2."),
38
+ output_format: z.enum(["png", "jpeg"]).optional().describe("Requested Google image output format. Omit to use the provider default."),
39
+ previous_interaction_id: nonEmptyString.optional().describe("Continue a Google image editing conversation using metadata.interactionId from a previous result. Requires that interaction to remain available in the same provider account."),
40
+ thinking_level: z.enum(["minimal", "high"]).optional().describe("Thinking level for Gemini 3.1 Flash Image and Flash Lite Image. Higher thinking can increase cost and latency."),
37
41
  aspect_ratio: nonEmptyString.optional().describe("Aspect ratio, for example 1:1, 16:9, 9:16, 4:3, or 3:2."),
38
42
  image_size: z
39
43
  .enum(["512", "0.5K", "1K", "2K", "4K"])
@@ -42,8 +46,9 @@ export const googleInputShape = {
42
46
  };
43
47
  export const xaiInputShape = {
44
48
  ...commonImageShape,
45
- input_images: z.array(nonEmptyString).max(3).optional().describe("Local image paths used as edit/reference inputs. xAI supports up to 3 input images."),
46
- model: nonEmptyString.default("grok-imagine-image-quality").describe("xAI/Grok image model ID."),
49
+ input_images: z.array(nonEmptyString).max(5).optional().describe("Local image paths used as edit/reference inputs. Imagine Image 2.0 supports up to 5 input images, older models up to 3."),
50
+ model: nonEmptyString.default("grok-imagine-image-2.0").describe("xAI/Grok image model ID. Defaults to Imagine Image 2.0."),
51
+ quality: z.enum(["low", "medium", "auto"]).optional().describe("Imagine Image 2.0 quality. Provider auto currently uses low for generation and medium for editing, with different costs. Set low or medium to pin quality."),
47
52
  aspect_ratio: nonEmptyString.optional().describe("Aspect ratio, for example 1:1, 16:9, 9:16, 3:2, or auto."),
48
53
  resolution: z.enum(["1k", "2k"]).optional().describe("xAI image resolution."),
49
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "image-router-mcp",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server for routing image generation and editing across xAI, Google Gemini/Nano Banana, and OpenAI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,8 +37,8 @@
37
37
  "author": "",
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@google/genai": "2.13.0",
41
- "@modelcontextprotocol/sdk": "1.29.0",
40
+ "@google/genai": "2.21.0",
41
+ "@modelcontextprotocol/sdk": "1.30.0",
42
42
  "openai": "6.49.0",
43
43
  "zod": "4.4.3"
44
44
  },
@@ -46,7 +46,7 @@
46
46
  "@types/node": "25.9.1",
47
47
  "tsx": "4.23.1",
48
48
  "typescript": "6.0.3",
49
- "vitest": "4.1.10"
49
+ "vitest": "4.1.11"
50
50
  },
51
51
  "repository": {
52
52
  "type": "git",