Skip to main content
Glama

glm-image-mcp-server

npm version npm downloads License: MIT Node.js TypeScript MCP

Z.AI の glm-image モデルを使用した画像生成 MCP サーバー

機能

  • MCP サーバー: Claude Desktop やその他の MCP クライアントから画像を生成

  • バッチ CLI: JSON 設定ファイルから複数の画像を一括生成

  • 自動ダウンロード: 生成された画像は自動的にローカルに保存

Related MCP server: nanobanana-mcp

インストール

npm からインストール

npm install @dondonudonjp/glm-image-mcp-server

ソースからビルド

git clone https://github.com/ex-takashima/glm-image-mcp-server.git
cd glm-image-mcp-server
npm install
npm run build

設定

環境変数

変数名

必須

デフォルト値

説明

Z_AI_API_KEY

はい

-

Z.AI の API キー

OUTPUT_DIRECTORY

いいえ

~/Downloads/glm-images

生成画像の保存先ディレクトリ

.env.example を参考に .env ファイルを作成してください:

cp .env.example .env
# .env を編集して API キーを設定

使用方法

MCP サーバー(Claude Desktop)

Claude Desktop の設定ファイル(claude_desktop_config.json)に以下を追加:

{
  "mcpServers": {
    "glm-image": {
      "command": "npx",
      "args": ["@dondonudonjp/glm-image-mcp-server"],
      "env": {
        "Z_AI_API_KEY": "your_api_key"
      }
    }
  }
}

ローカルビルドの場合:

{
  "mcpServers": {
    "glm-image": {
      "command": "node",
      "args": ["/path/to/glm-image-mcp-server/dist/index.js"],
      "env": {
        "Z_AI_API_KEY": "your_api_key"
      }
    }
  }
}

利用可能なツール

generate_image

  • prompt(必須): 生成する画像の説明テキスト

  • quality(任意): "hd"(デフォルト)または "standard"

  • size_preset(任意): アスペクト比プリセット(下記参照)

  • custom_size(任意): カスタムサイズ(例: "1536x1024")※事前検証あり

  • output_filename(任意): 保存するファイル名

サイズ指定方法:

  • size_presetcustom_size のどちらかを指定(両方指定時は size_preset 優先)

  • どちらも未指定の場合は 1:1(1280x1280)がデフォルト

バッチ CLI

# バッチ処理を実行
npx @dondonudonjp/glm-image-mcp-server/dist/cli.js config.json

# または glm-image-batch コマンド(グローバルインストール時)
glm-image-batch config.json

# JSON 形式で出力
glm-image-batch config.json --format json

バッチ設定ファイルの形式

{
  "jobs": [
    {
      "prompt": "海に沈む美しい夕日",
      "quality": "hd",
      "size_preset": "16:9",
      "output_filename": "sunset.png"
    },
    {
      "prompt": "毛糸で遊ぶ猫",
      "custom_size": "1536x1024"
    },
    {
      "prompt": "山の風景"
    }
  ],
  "output_directory": "./output",
  "concurrency": 3
}

終了コード

  • 0: すべてのジョブが正常に完了

  • 1: 1つ以上のジョブが失敗

開発

# ビルド
npm run build

# ウォッチモード
npm run dev

# MCP インスペクターでテスト
npx @anthropic/mcp-inspector dist/index.js

API リファレンス

Z.AI glm-image API

  • エンドポイント: POST https://api.z.ai/api/paas/v4/images/generations

  • モデル: glm-image

  • 品質オプション: hd, standard

画像サイズ

サイズプリセット(size_preset):

プリセット

解像度

用途

1:1

1280x1280

正方形(デフォルト)

3:2

1568x1056

横長写真

2:3

1056x1568

縦長写真

4:3

1472x1088

横長スタンダード

3:4

1088x1472

縦長スタンダード

16:9

1728x960

ワイドスクリーン

9:16

960x1728

スマホ縦画面

カスタムサイズ(custom_size)の制限:

  • 幅・高さ: 1024px〜2048px

  • 32で割り切れる値のみ

  • 総ピクセル数: 最大 2^22 px(約419万ピクセル)

  • 無効な値を指定した場合、API呼び出し前にエラーを返却

ライセンス

MIT

Available Tools

1 tool
generate_imageB

Generate an image from a text prompt using Z.AI glm-image model

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesThe text prompt describing the image to generate
qualityNoImage quality: "hd" (default) or "standard"
custom_sizeNoCustom size (e.g., "1536x1024"). Must be 1024-2048px, divisible by 32, max 2^22 total pixels. Ignored if size_preset is specified
size_presetNoRecommended size preset by aspect ratio. "1:1"=1280x1280 (default), "3:2"=1568x1056, "2:3"=1056x1568, "4:3"=1472x1088, "3:4"=1088x1472, "16:9"=1728x960, "9:16"=960x1728
output_filenameNoOptional output filename (without path)

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the core action and model, with no mention of side effects (e.g., file savings, return format, rate limits, or asynchronous behavior). This leaves significant behavioral ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the essential verb and object. No unnecessary words or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the schema covering all parameters, there is no output schema, and the description does not explain what the tool returns (e.g., file path, URL, base64) or any side effects like file saving. For a tool with 5 parameters and no return specification, the description should clarify the outcome, but it does not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all five parameters. The description itself adds no additional parameter meaning beyond what the schema provides, matching the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Generate'), the resource ('an image'), and the source ('from a text prompt using Z.AI glm-image model'). This is specific and leaves no ambiguity about what the tool does, even without sibling comparisons.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for image generation from text, but provides no explicit guidance on when to use this tool versus alternatives, or any prerequisites. With no siblings listed, the implied usage is acceptable but not enhanced.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.1
    • First observedgenerate_image

TDQS

A3.7/5.0
Disambiguation5/5

There is only one tool, so there is no possibility of ambiguity or misselection among tools.

Naming Consistency5/5

With a single tool named 'generate_image', the naming follows a clear verb_noun pattern and is internally consistent.

Tool Count3/5

A single tool is thin for most servers, though it fully covers the stated purpose of image generation. The count feels minimal but not unreasonable.

Completeness5/5

For the narrow domain of generating an image from a text prompt, the single generate_image tool provides complete coverage without obvious missing operations.

Maintenance

ActivityInactive
ResponsivenessNo issues

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

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    MCP server for generating images and videos using Z.AI models (GLM-Image, CogView-4, CogVideoX-3, Vidu Q1, etc.) with support for synchronous and asynchronous generation, downloads, and multiple input modes.
    10
    37
    2
    MIT
  • F
    license
    A
    quality
    C
    maintenance
    Standalone MCP server and CLI for generating images via ChatGPT backend, with reliable exact file paths and multi-account login support.
    2
    5
    -

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/ex-takashima/glm-image-mcp-server'

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