DALL-E MCP Server

by joshmouch

Integrations

  • Enables image generation capabilities using OpenAI's DALL-E 2 and DALL-E 3 APIs, with support for creating new images from text prompts, editing existing images, and generating variations of images.

DALL-E MCP サーバー

OpenAI の DALL-E API を使用して画像を生成するための MCP (Model Context Protocol) サーバー。

特徴

  • DALL-E 2またはDALL-E 3を使用して画像を生成する
  • 既存の画像を編集する(DALL-E 2のみ)
  • 既存の画像のバリエーションを作成する(DALL-E 2 のみ)
  • OpenAI APIキーを検証する

インストール

# Clone the repository git clone https://github.com/joshmouch/mcp-image-generator.git cd mcp-image-generator # Install dependencies npm install # Build the project npm run build

Clineユーザーへの重要なお知らせ

このDALL-E MCPサーバーをClineで使用する場合は、 saveDirパラメータを現在の作業ディレクトリに設定し、生成された画像を現在のワークスペースディレクトリに保存することをお勧めします。これにより、Clineは会話の中で生成された画像を適切に見つけて表示できるようになります。

Cline での使用例:

{ "prompt": "A tropical beach at sunset", "saveDir": "/path/to/current/workspace" }

使用法

サーバーの実行

# Run the server node build/index.js

Cline の構成

VSCode の設定内の Cline MCP 設定ファイルに dall-e サーバーを追加します (例: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json)。

{ "mcpServers": { "mcp-image-generator": { "command": "node", "args": ["/path/to/mcp-image-generator-server/build/index.js"], "env": { "OPENAI_API_KEY": "your-api-key-here", "SAVE_DIR": "/path/to/save/directory" }, "disabled": false, "autoApprove": [] } } }

必ず次の点に注意してください:

  1. /path/to/mcp-image-generator-server/build/index.jsを、ビルドされた index.js ファイルへの実際のパスに置き換えます。
  2. your-api-key-hereを OpenAI API キーに置き換えます

利用可能なツール

画像を生成する

テキストプロンプトに基づいて DALL-E を使用して画像を生成します。

{ "prompt": "A futuristic city with flying cars and neon lights", "model": "dall-e-3", "size": "1024x1024", "quality": "standard", "style": "vivid", "n": 1, "saveDir": "/path/to/save/directory", "fileName": "futuristic-city" }

パラメータ:

  • prompt (必須): 希望する画像のテキスト説明
  • model (オプション): 使用する DALL-E モデル (「dall-e-2」または「dall-e-3」、デフォルト: 「dall-e-3」)
  • size (オプション): 生成される画像のサイズ (デフォルト: "1024x1024")
    • DALL-E 3: 「1024x1024」、「1792x1024」、または「1024x1792」
    • DALL-E 2: 「256x256」、「512x512」、または「1024x1024」
  • quality (オプション):生成される画像の品質、DALL-E 3のみ(「標準」または「hd」、デフォルト:「標準」)
  • style (オプション):生成される画像のスタイル、DALL-E 3のみ(「鮮明」または「自然」、デフォルト:「鮮明」)
  • n (オプション): 生成する画像の数 (1-10、デフォルト: 1)
  • saveDir (オプション): 生成された画像を保存するディレクトリ (デフォルト: 現在のディレクトリ、または.env の SAVE_DIR)。Cline**ユーザーの場合:**画像を正しく表示するために、現在のワークスペースディレクトリに設定することをお勧めします。
  • fileName (オプション): 拡張子なしの生成された画像の基本ファイル名 (デフォルト: "dalle-{timestamp}")
編集画像

テキスト プロンプトに基づいて DALL-E を使用して既存の画像を編集します。

⚠️ 既知の問題(2025年3月18日): DALL-E 2 画像編集 API には現在、適切な RGBA 形式の画像とマスクを使用しているにもかかわらず、プロンプトを無視して編集されていない元の画像を返すことがあるというバグがあります。この問題はOpenAI コミュニティフォーラムで報告されています。この問題が発生した場合は、代わりにcreate_variationツールをお試しください。こちらの方がより確実に動作するようです。

{ "prompt": "Add a red hat", "imagePath": "/path/to/image.png", "mask": "/path/to/mask.png", "model": "dall-e-2", "size": "1024x1024", "n": 1, "saveDir": "/path/to/save/directory", "fileName": "edited-image" }

パラメータ:

  • prompt (必須): 希望する編集内容のテキスト説明
  • imagePath (必須): 編集する画像へのパス
  • mask (オプション):マスク画像へのパス(白い領域は編集され、黒い領域は保持されます)
  • model (オプション):使用する DALL-E モデル(現在は「dall-e-2」のみが編集をサポートしています。デフォルト:「dall-e-2」)
  • size (オプション): 生成される画像のサイズ (デフォルト: "1024x1024")
  • n (オプション): 生成する画像の数 (1-10、デフォルト: 1)
  • saveDir (オプション): 編集した画像を保存するディレクトリ (デフォルト: 現在のディレクトリ、または.env の SAVE_DIR)。Cline**ユーザーの場合:**画像を正しく表示するために、現在のワークスペースディレクトリに設定することをお勧めします。
  • fileName (オプション): 編集した画像の基本ファイル名(拡張子なし)(デフォルト: "dalle-edit-{timestamp}")
バリエーションを作成する

DALL-E を使用して既存の画像のバリエーションを作成します。

{ "imagePath": "/path/to/image.png", "model": "dall-e-2", "size": "1024x1024", "n": 4, "saveDir": "/path/to/save/directory", "fileName": "image-variation" }

パラメータ:

  • imagePath (必須): バリエーションを作成するための画像へのパス
  • model (オプション): 使用する DALL-E モデル (現在は「dall-e-2」のみがバリエーションをサポートしています。デフォルト: 「dall-e-2」)
  • size (オプション): 生成される画像のサイズ (デフォルト: "1024x1024")
  • n (オプション): 生成するバリエーションの数 (1-10、デフォルト: 1)
  • saveDir (オプション): バリエーション画像を保存するディレクトリ (デフォルト: 現在のディレクトリ、または.env の SAVE_DIR)。Cline**ユーザーの場合:**画像を正しく表示するために、現在のワークスペースディレクトリに設定することをお勧めします。
  • fileName (オプション): 拡張子なしのバリエーション画像の基本ファイル名 (デフォルト: "dalle-variation-{timestamp}")
検証キー

OpenAI API キーを検証します。

{}

パラメータは必要ありません。

発達

テスト構成

注意: 次の .env 構成は、通常の操作ではなく、テストの実行にのみ必要です。

このプロジェクトのテストを開発または実行している場合は、ルート ディレクトリに OpenAI API キーを使用して.envファイルを作成します。

# Required for TESTS ONLY: OpenAI API Key OPENAI_API_KEY=your-api-key-here # Optional: Default save directory for test images # If not specified, images will be saved to the current directory # SAVE_DIR=/path/to/save/directory

Cline で通常の操作を行うには、上記の「MCP 設定への追加」セクションで説明されているように、MCP 設定 JSON で API キーを構成します。

API キーはOpenAI の API キー ページから取得できます。

テストの実行

# Run basic tests npm test # Run all tests including edit and variation tests npm run test:all # Run tests in watch mode npm run test:watch # Run specific test by name npm run test:name "should validate API key"

注: テストでは実際の API 呼び出しが使用されるため、OpenAI アカウントに料金が発生する可能性があります。

テスト画像の生成

このプロジェクトには、開発とテスト用のテスト イメージを生成するスクリプトが含まれています。

# Generate a test image in the assets directory npm run generate-test-image

これにより、編集機能とバリエーション機能をテストするために使用できる単純なテスト イメージがassetsディレクトリに作成されます。

ライセンス

マサチューセッツ工科大学

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

OpenAI の DALL-E API を使用して画像のバリエーションを生成、編集、作成できる MCP (モデル コンテキスト プロトコル) サーバー。

  1. Features
    1. Installation
      1. Important Note for Cline Users
        1. Usage
          1. Running the Server
          2. Configuration for Cline
          3. Available Tools
        2. Development
          1. Testing Configuration
            1. Running Tests
            2. Generating Test Images
          2. License

            Related MCP Servers

            • A
              security
              F
              license
              A
              quality
              A Model Context Protocol server that provides image generation capabilities using the Ideogram API, allowing users to create images from text prompts with customizable parameters.
              Last updated -
              1
              1
              3
              JavaScript
            • A
              security
              F
              license
              A
              quality
              A TypeScript-based MCP server that generates images using OpenAI's dall-e-3 model based on text prompts and saves them to a specified directory.
              Last updated -
              1
              6
              JavaScript
              • Apple
            • -
              security
              F
              license
              -
              quality
              An MCP server that allows users to generate, edit, and create variations of images through OpenAI's DALL-E API, supporting both DALL-E 2 and DALL-E 3 models.
              Last updated -
              2
              TypeScript
            • -
              security
              -
              license
              -
              quality
              A Model Context Protocol server enabling AI assistants to generate images through OpenAI's DALL-E API with full support for all available options and fine-grained control.
              Last updated -
              JavaScript
              MIT License

            View all related MCP servers

            ID: i8392k7u6c