Labnana MCP

io.github.exoticknight由 GitHub 帳號 exoticknight 發布v2.2.0更新於 Oct 29, 2026

Generate and edit images with Labnana through a local MCP server with MCP Apps previews.

已驗證STDIO僅桌面媒體與設計AI 與機器學習

概覽

AI 產生的概覽

Labnana MCP 讓助理透過 Labnana API 生成與編輯圖片,並可預估點數消耗、查詢訂閱狀態與任務歷史。

可以做什麼
  • 以文字提示或參考圖生成、編輯與改圖,支援多種模型與 1K/2K/4K 尺寸
  • 在實際生成前預估所需點數
  • 查詢 API Key 帳戶的訂閱狀態、點數餘額與免費額度
  • 列出歷史生成任務,並取得任務狀態、預覽圖與原圖連結
適用情境
適合需要助理依需求製作或修改圖片的場合,例如插畫、海報、圖中文字或依參考圖改圖,並希望在消耗點數前先確認成本。也適合在 4K 長任務等待逾時後取回結果。
執行需求
透過 npx 在本機執行,需要 Node.js 20.9 或更新版本。需要 Labnana API Key,透過環境變數 LABNANA_API_KEY(或 --api-key 選項)提供。可選用 LABNANA_OUTPUT_DIR 指定圖片儲存目錄。需要能連線至 Labnana API 的網路。
安裝前請注意
生成圖片會消耗付費點數,建議先用 estimate_credits 確認,且 4K 一律以點數計費。API Key 是可計費的憑證,請優先使用環境變數而非命令列參數,後者可能出現在行程清單中。原圖會寫入本機磁碟(預設 labnana-images/),提示詞與參考圖會傳送至 Labnana 伺服器。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Labnana MCP,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

labnana-mcp

[npm version] [npm downloads] [CI] [node] [License] [MCP Registry] [labnana-mcp MCP server]

An MCP server for the Labnana OpenAPI. It enables Claude, Claude Code, and other MCP clients to generate and edit images with Labnana.

Current OpenAPI models (product names mapped to the model parameter):

Product namemodelProviderResolutionsBest for
Nano Banana Progemini-3-pro-imageGoogle1K / 2K / 4KIn-image text, character consistency, high-fidelity output
Nano Banana 2gemini-3.1-flash-imageGoogle1K / 2K / 4KFast iteration and extreme aspect ratios
GPT-Image-2gpt-image-2OpenAI1K / 2K / 4KSpec-driven generation, layout control, illustration
GPT-Image-2.5 Flaregpt-image-2.5-flareOpenAI1K / 2K / 4KFaster generation
GPT-Image-2.5 Sunburstgpt-image-2.5-sunburstOpenAI1K / 2K / 4KDetail-dense images
Wan2.7 Image Prowan2.7-image-proAlibaba1K / 2K / 4K¹Photoreal and poster-style images
Wan2.7 Imagewan2.7-imageAlibaba1K / 2KLower-cost everyday generation
Seedream 5.0 Proseedream-5-0-proByteDance1K / 2KCoordinate-driven region editing and Chinese instructions

¹ wan2.7-image-pro supports 4K only for text-to-image; generations with reference images are limited to 2K. The OpenAPI reference lists GPT-Image-2.5 Flare and Sunburst; the model directory lists 1K / 2K / 4K and 10 aspect ratios, while the integration guide has not yet added the variants to its model list. Both variants support up to four reference images and cost the same. Check estimate_credits for the current price before generation.

GitHub · npm · MCP Registry · Glama · 中文文档

Installation

Requires Node.js 20.9 or later.

Claude Code

  1. Create an API key in the Labnana API Keys console.
  2. Make LABNANA_API_KEY available in the environment used by Claude Code.
  3. Add the server:
bash
claude mcp add labnana -- npx -y @exoticknight/labnana-mcp

The package can also be started directly with:

bash
npx -y @exoticknight/labnana-mcp

DeepSeek Harness (DSH)

Add the server through DSH's official MCP client plugin. Pin 2.2.0 when you want the version shown by initialize to identify this MCP Apps-capable build:

yaml
- id: mcp-labnana  name: '@deepseek-ai/dsh-mcp-client'  config:    serverName: labnana    transport: stdio    command: npx    args: ['-y', '@exoticknight/[email protected]']    env:      LABNANA_API_KEY: !!js process.env.LABNANA_API_KEY

DSH's MCP bridge can project supported ImageContent into the calling vision model. Version 2.1 also publishes a standard MCP Apps single-file View for generate_image and get_generation_task. An MCP Apps-capable DSH Web host renders the preview inline; a stock generic DSH tool card may still show the JSON fallback even though the model received the image. This is a client presentation limitation, not a lost generation result.

For a local source checkout, use the same row with command: node, an absolute args path to dist/index.js, and cwd set to this repository. Current stock DSH builds bridge MCP tools but do not consume MCP resources in the generic tool card. Without an MCP Apps host, model vision still works and the card falls back to JSON.

Cursor and VS Code

One-click install (replace the placeholder API key after installing):

[Install in Cursor] [Install in VS Code]

Claude Desktop and other MCP clients

Use an equivalent mcpServers configuration:

json
{  "mcpServers": {    "labnana": {      "command": "npx",      "args": ["-y", "@exoticknight/labnana-mcp"],      "env": {        "LABNANA_API_KEY": "lh_xxxxxxxxx"      }    }  }}

Local source checkout

bash
npm installnpm run build

Then configure the server with the generated dist/index.js:

bash
claude mcp add labnana -- node <path-to-repo>/dist/index.js

On Windows, use an absolute path such as:

powershell
claude mcp add labnana -- node C:/path/to/labnana-mcp/dist/index.js

Configuration

The server reads the following environment variable:

VariableRequiredDescription
LABNANA_API_KEYYesLabnana API key.
LABNANA_OUTPUT_DIRNoDefault directory for saved images. Falls back to labnana-images/ under the working directory.

The command-line options below are also supported:

OptionDescription
--api-key <key>Provide the API key for a local process.
--base-url <url>Override the default API endpoint, https://api.labnana.com.
--output-dir <dir>Default directory for saved images.

Environment variables are recommended because command-line arguments may be visible in the local process list.

Tools

ToolDescription
generate_imageOne-stop text-to-image / image-to-image / editing. Saves the original and returns a bounded MCP image preview, structured metadata, and JSON fallback by default; 4K requests poll internally.
estimate_creditsEstimate the credits required for a generation without generating an image.
get_subscriptionGet subscription status, credit balances, and free usage information.
list_generation_tasksList generation task history with pagination and optional status filtering.
get_generation_taskGet task details and public image URLs (useful after a generate_image timeout).

Usage

Generate an image

json
{  "name": "generate_image",  "arguments": {    "model": "gemini-3-pro-image",    "prompt": "Change the background of the image to the grasslands of Inner Mongolia",    "referenceImages": [      {        "fileData": {          "fileUri": "https://cdn.labnana.com/xxx.png",          "mimeType": "image/png"        }      }    ],    "imageConfig": {      "imageSize": "2K",      "aspectRatio": "16:9"    }  }}

The default is outputMode=hybrid: the full original is saved to disk while a bounded MCP image preview, structuredContent, and equivalent JSON text are returned together. This provides progressive compatibility across Codex, Claude Code, Claude Desktop, and other MCP clients. Use saveDir to choose the target directory.

All 1K, 2K, 4K, and get_generation_task results use the same envelope:

json
{  "schemaVersion": 1,  "status": "succeeded",  "taskId": "task-123",  "images": [    {      "index": 0,      "mimeType": "image/png",      "width": 4096,      "height": 4096,      "byteLength": 18442231,      "sha256": "...",      "url": "https://.../original.png",      "filePath": "C:\\...\\labnana.png",      "preview": { "included": true, "mimeType": "image/jpeg", "width": 1600, "height": 1600 }    }  ]}

Image base64 appears only in standard MCP ImageContent, never duplicated into text or structured metadata. Full 4K originals are not inlined; previews have a maximum 1600-pixel edge and target a 2 MiB byte ceiling, while filePath/url locate the original.

Use referenceImages for image-to-image generation and editing. fileData.fileUri supports gs:// and https://; small images can be passed as base64 through inlineData.data.

4K requests automatically run as asynchronous tasks: the server creates the task, polls with rate-limit backoff, downloads and saves originals, and creates previews. If the wait exceeds timeoutSeconds (default 300), the result has status=pending and a taskId; this is not treated as generation failure. Fetch the final preview and original URL later with get_generation_task.

Credit estimation

json
{  "name": "estimate_credits",  "arguments": {    "prompt": "A Shiba Inu running through a snowy landscape",    "imageConfig": {      "imageSize": "4K"    }  }}

Parameters

  • model (default: gemini-3-pro-image): gemini-3-pro-image, gemini-3.1-flash-image, gpt-image-2, gpt-image-2.5-flare, gpt-image-2.5-sunburst, wan2.7-image-pro, wan2.7-image, or seedream-5-0-pro. The provider is derived from the model automatically. Use estimate_credits to confirm a GPT-Image-2.5 size and cost before generation.
  • imageConfig.imageSize: 1K, 2K, or 4K. wan2.7-image and seedream-5-0-pro do not support 4K; wan2.7-image-pro also disallows 4K when reference images are present.
  • imageConfig.aspectRatio: 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, or 8:1. GPT-Image-2 may omit this field and let the service choose; GPT-Image-2.5 supports the ten ratios from 1:1 through 21:9; Wan2.7 supports only 1:1, 16:9, 9:16, 4:3, and 3:4.
  • referenceImages: OpenAPI allows up to 14 for Gemini, 4 for GPT-Image-2 / GPT-Image-2.5, 9 for Wan2.7, and 10 for Seedream. These are API limits, not the separate upload limits of the web generator.
  • Seedream precise editing: put the source image in referenceImages and describe the target region and change in prompt using absolute coordinates from the top-left origin. OpenAPI has no separate mask or region parameter.
  • outputMode (generate_image only): hybrid (default, save originals and inline bounded previews), file (save originals and return metadata only), or inline (do not save to saveDir; return a bounded preview, and persist the original to the default recovery directory only when the upstream response has no original URL).
  • saveDir / timeoutSeconds (generate_image only): target directory for hybrid/file mode, and the maximum wait for async (4K) generations.

Credit summary

Model1K2K4K
gemini-3-pro-image151530
gemini-3.1-flash-image101020
gpt-image-24610
wan2.7-image-pro6812 (text-to-image only)
wan2.7-image46Not supported
seedream-5-0-pro615Not supported

GPT-Image-2.5 Flare and Sunburst have the same price, but the integration guide does not list their size-specific credit values. Call estimate_credits with the intended model and imageConfig for the current cost and supported configuration.

Free usage

get_subscription returns freeUsages. This quota is shared with the Labnana website and ListenHub app. Nano Banana Pro free usage applies to 1K / 2K only; 4K is always charged in credits. When using that free quota, a never-paid account may receive a retryable busy error on the low-priority lane; retries do not consume the free quota or credits.

Errors

API errors are returned as { code, message } and exposed as MCP results with isError: true.

CodeMeaningRecommendation
21007Invalid API keyCheck LABNANA_API_KEY.
26004Insufficient creditsCheck the subscription or upgrade the plan.
29003Invalid parametersCheck required fields and model-specific limits.
29998Too many requestsRetry with a 20–30 second backoff.

Development

bash
npm installnpm run typechecknpm test

To inspect the real single-file MCP App without calling Labnana or spending credits, run npm run test:ui and open http://127.0.0.1:4173/test/mcp-app-host.html. The local host sends a generated 640×360 PNG fixture through the official AppBridge so the image, status, and metadata can be checked visually.

For optional live API checks, put LABNANA_API_KEY in the repository-root .env and run npm run test:real. It checks the subscription and estimates both GPT-Image-2.5 variants without generating images or spending credits; the tests skip when the key is not configured.

To verify actual image generation, first run npm run build, then run node test/e2e-generate.mjs. This spends credits. Set LABNANA_TEST_MODEL, LABNANA_TEST_IMAGE_SIZE, LABNANA_TEST_ASPECT_RATIO, LABNANA_TEST_PROMPT, and LABNANA_OUTPUT_DIR to choose the model, output, and save location. Generated originals go under labnana-images/ by default and are ignored by Git.

Links

License

Apache-2.0

Community

來源:README.md,提交 3f878eb

工具

5

get_subscription

获取订阅信息与积分余额

获取当前 API Key 账户的订阅状态、可用积分(月度/永久/限时)、免费额度(freeUsages)与重置时间。

無需輸入參數。

estimate_credits

预估图片生成所需积分

根据模型、尺寸、宽高比等参数预估生成图片所需的积分。同步返回,不实际生成图片、不扣除积分。适合在批量生成或使用 4K 前先确认成本。

輸入參數modelprompt必填imageConfigreferenceImages

generate_image

生成图片

文生图 / 图生图 / 改图的一站式工具:默认保存完整原图,同时返回有大小上限的 MCP 图片预览、结构化元数据和 JSON 文本兜底。大图(4K)会自动走异步任务并在内部等待完成,无需手动轮询。支持 Gemini 系列、GPT-Image-2 / 2.5、Wan2.7、Seedream 5.0 Pro,模型由 model 参数选择,无需指定提供商。

輸入參數modelprompt必填saveDiroutputModeimageConfigtimeoutSecondsreferenceImages

list_generation_tasks

获取图片生成任务列表

按创建时间倒序返回当前 API Key 用户的图片生成任务历史,可按状态过滤。

輸入參數pagestatuspageSize

get_generation_task

获取图片生成任务详情

查询图片生成任务状态与结果。任务成功时返回统一结构化 envelope、有界 MCP 图片预览和原图 URL。generate_image 等待超时后可用返回的 taskId 在这里取回结果。

輸入參數taskId必填

版本歷史

2
  1. v2.2.0最新Oct 22, 2026
  2. v2.1.1Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分