Image Generator MCP Server
画像ジェネレーターMCPサーバー
Replicate を使用してイメージを生成し、ユーザーがそれを保存できるようにする MCP サーバー。
コンポーネント
リソース
サーバーは、次の機能を備えた画像ストレージ システムを実装します。
生成された個々の画像にアクセスするためのカスタム image:// URI スキーム
各画像リソースには、プロンプト、作成日を含む説明、image/png mimetype に基づいた名前が付けられます。
プロンプト
サーバーは単一のプロンプトを提供します:
generate-image: 安定拡散法を使用して画像を生成するためのプロンプトを作成します。
画像のスタイル(リアル/芸術的/抽象)を制御するためのオプションの「スタイル」引数
スタイル固有のガイダンスを含むプロンプトテンプレートを生成します
ツール
サーバーは 3 つのツールを実装します。
generate-image: Replicateの安定拡散モデルを使用して画像を生成します
必須の文字列引数として「prompt」を指定します
オプションパラメータには、「negative_prompt」、「width」、「height」、「num_inference_steps」、「guidance_scale」が含まれます。
生成された画像とそのURLを返します
save-image: 生成された画像をローカルファイルシステムに保存します
必須の文字列引数として「image_url」と「prompt」を取ります
画像の一意のIDを生成し、「generated_images」ディレクトリに保存します。
list-saved-images: 保存されたすべての画像を一覧表示します
保存されたすべての画像のリストをメタデータとサムネイルとともに返します
Related MCP server: gemini-image-mcp
構成
APIトークンを複製する
この画像ジェネレータを使用するには、Replicate API トークンが必要です。
Replicateでアカウントを作成する
https://replicate.com/accountから API トークンを取得します。
提供された
.env.exampleテンプレートに基づいて.envファイルを作成します。
REPLICATE_API_TOKEN=your_replicate_api_token_here重要: APIトークンが誤って公開されるのを防ぐため、
.envファイルは.gitignoreによってバージョン管理から除外されます。機密情報をリポジトリにコミットしないでください。
環境設定
リポジトリをクローンします。
git clone https://github.com/yourusername/image-generator.git
cd image-generator仮想環境を作成してアクティブ化します。
# Using venv
python -m venv .venv
# On Windows
.venv\Scripts\activate
# On macOS/Linux
source .venv/bin/activate依存関係をインストールします:
pip install -r requirements.txt上記のように
.envファイルを設定します
クイックスタート
インストール
クロードデスクトップ
MacOS の場合: ~/Library/Application\ Support/Claude/claude_desktop_config.json Windows の場合: %APPDATA%/Claude/claude_desktop_config.json
使用法
サーバーが起動したら、次の操作を実行できます。
説明プロンプト付きの「generate-image」ツールを使用して画像を生成します
生成された画像を、画像のURLとプロンプトを指定して「save-image」ツールで保存します。
「list-saved-images」ツールを使用して保存したすべての画像を表示します
リソースリストから保存した画像にアクセスする
発達
建築と出版
配布用のパッケージを準備するには:
依存関係を同期し、ロックファイルを更新します。
uv syncパッケージディストリビューションをビルドします。
uv buildこれにより、 dist/ディレクトリにソースとホイールのディストリビューションが作成されます。
PyPI に公開:
uv publish注: 環境変数またはコマンド フラグを使用して PyPI 資格情報を設定する必要があります。
トークン:
--tokenまたはUV_PUBLISH_TOKENまたはユーザー名/パスワード:
--username/UV_PUBLISH_USERNAMEおよび--password/UV_PUBLISH_PASSWORD
デバッグ
MCPサーバーはstdio経由で実行されるため、デバッグが困難になる場合があります。最適なデバッグ環境を実現するには、 MCP Inspectorの使用を強くお勧めします。
次のコマンドを使用して、 npm経由で MCP Inspector を起動できます。
npx @modelcontextprotocol/inspector uv --directory B:\NEWTEST\image-generator run image-generator起動すると、ブラウザでアクセスしてデバッグを開始できる URL がインスペクタに表示されます。
Available Tools
3 toolsgenerate-imageC
Generate an image using Replicate's Stable Diffusion model
| Name | Required | Description | Default |
|---|---|---|---|
| width | No | ||
| height | No | ||
| prompt | Yes | ||
| guidance_scale | No | ||
| negative_prompt | No | ||
| num_inference_steps | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description alone must disclose behavior. It only states image generation, but omits whether the image is returned directly, saved, or streamed. No mention of rate limits, authentication, or potential side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, concise and front-loaded. However, it might be too terse, sacrificing critical details. Every word earns its place, but more information would improve usability.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 6 parameters, no output schema, and no annotations, the description is incomplete. It fails to clarify whether output is a URL, base64, or file path. Critical for an agent to use correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description provides no explanation of parameters beyond their existence. Values like 'guidance_scale', 'num_inference_steps', and 'negative_prompt' are left undefined. The agent must infer their purpose from names or defaults.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Generate an image using Replicate's Stable Diffusion model', which identifies the verb (generate), resource (image), and model. It distinguishes from siblings 'list-saved-images' and 'save-image'. However, it could be more precise by specifying 'from a text prompt'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. No mention of prerequisites, output handling, or when not to use it. The description assumes the agent already knows to use this for generation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list-saved-imagesA
List all saved images
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It only states 'List all saved images' but lacks details on pagination, ordering, or behavior when no images exist.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise with one short sentence, front-loaded with the key action and resource. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters and a simple output (likely an array of saved images), the description fully explains the tool's purpose without needing further elaboration.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
There are no parameters, and schema coverage is 100%. The description implicitly means no arguments are needed, which is sufficient and adds no extra confusion.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'List' and the resource 'all saved images'. It distinguishes this tool from its siblings 'generate-image' and 'save-image' by specifying a different action.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus the sibling tools. It does not state any prerequisites or context for using this list operation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
save-imageC
Save a generated image
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| image_url | Yes | ||
| custom_filename | No | Custom filename for the saved image (without extension). If not provided, a UUID will be used. | |
| target_directory | No | Directory path where the image should be saved. If not provided, defaults to the MCP server's images directory. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description bears full responsibility for behavioral disclosure. It only states 'Save a generated image' without detailing side effects (e.g., whether it overwrites existing files, required permissions, or error handling). This is insufficient for an agent to understand the tool's behavior beyond a basic save operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence, which is concise, but it sacrifices informativeness. It could be restructured to include key details without being verbose. Every sentence should add value, and this one is too vague.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (4 parameters, no output schema, no annotations), the description is extremely incomplete. It does not explain return values, error conditions, or the result of saving. The agent cannot reliably invoke this tool based solely on this description.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 50% (custom_filename and target_directory have descriptions in schema, but required params prompt and image_url do not). The description adds no information about any parameter, failing to compensate for the missing schema descriptions. It does not explain what image_url or prompt mean for this tool.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Save a generated image' clearly identifies the verb (save) and resource (generated image), and it distinguishes from sibling tools 'generate-image' (which creates but does not persist) and 'list-saved-images' (which lists existing saves). However, it could be more specific about the storage location or context.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool vs alternatives. It does not state that this should be used after an image is generated, nor does it mention scenarios where this tool might be inappropriate. With siblings like generate-image and list-saved-images, explicit usage context is missing.
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.
3 tool updates
v1.0.1- First observed
generate-image - First observed
list-saved-images - First observed
save-image
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: generating images, listing saved images, and saving images. No overlap or ambiguity.
All tools follow a consistent verb_noun snake_case pattern (generate-image, list-saved-images, save-image), making them predictable.
3 tools is appropriate for a focused image generator server, covering the core workflow. Slightly minimal but not overly sparse.
Covers generation, listing, and saving. Missing a delete or update tool, but the core lifecycle is intact and agents can work without major gaps.
Maintenance
Related MCP Connectors
MCP server for Flux AI image generation
MCP server for Qwen Image 3 AI image generation
MCP server for Grok Imagine AI video generation
MCP server for Producer/Riffusion AI music generation
Related MCP Servers
- AlicenseAqualityFmaintenanceA MCP server that integrates with Stable Diffusion WebUI to provide text-to-image generation and image upscaling capabilities through simple API calls.544MIT
- AlicenseBqualityCmaintenanceAn MCP server for image generation using the Gemini API.122 npm2MIT
- AlicenseBqualityDmaintenanceAn MCP server that enables image generation using Replicate's Flux 1.1 Pro model. It provides a tool for creating visuals from text prompts with customizable settings for aspect ratio, output format, and quality.1MIT
- AlicenseBqualityDmaintenanceAn MCP server that generates pixel-art PNGs from text prompts, using a free image backend, and saves them directly to your project directory.2MIT