Skip to main content
Glama
Garoth
by Garoth

DALL-E MCP 服务器

使用 OpenAI 的 DALL-E API 生成图像的 MCP(模型上下文协议)服务器。

特征

  • 使用 DALL-E 2 或 DALL-E 3 生成图像

  • 编辑现有图像(仅限 DALL-E 2)

  • 创建现有图像的变体(仅限 DALL-E 2)

  • 验证 OpenAI API 密钥

Related MCP server: GPT Image MCP Server

安装

# Clone the repository
git clone https://github.com/Garoth/dalle-mcp.git
cd dalle-mcp

# 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 的配置

将 dall-e 服务器添加到 VSCode 设置中的 Cline MCP 设置文件中(例如 ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):

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

请确保:

  1. 将/path/to/dalle-mcp-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(“标准”或“高清”,默认值:“标准”)

  • 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 密钥。

您可以从OpenAI 的 API 密钥页面获取您的 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目录中创建一个简单的测试图像,可用于测试编辑和变化功能。

执照

麻省理工学院

Available Tools

4 tools
create_variationC

Create variations of an existing image using DALL-E

ParametersJSON Schema
NameRequiredDescriptionDefault
imagePathYesPath to the image to create variations of
modelNoDALL-E model to use (currently only dall-e-2 supports variations)
sizeNoSize of the generated image
nNoNumber of variations to generate (1-10)
saveDirNoDirectory to save the variation images
fileNameNoBase filename for the variation images (without extension)

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'create variations' implies a generative operation, the description doesn't mention important behavioral aspects like whether this is a read-only operation, what permissions are needed, rate limits, cost implications, or what happens to the original image. For a tool with 6 parameters and no annotation coverage, this is a significant gap.

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, efficient sentence that states the core purpose without any wasted words. It's appropriately sized for the tool's complexity and gets straight to the point with no unnecessary elaboration.

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?

For a generative AI tool with 6 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., image paths, URLs, error handling), doesn't mention DALL-E API constraints or costs, and provides no guidance on usage context. The 100% schema coverage helps with parameters, but other critical contextual information is missing.

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?

The description mentions 'variations of an existing image' which provides context for the 'imagePath' parameter, but doesn't add meaningful semantic information beyond what's already in the schema (which has 100% coverage). The schema descriptions comprehensively document each parameter's purpose, constraints, and enums, so the description adds minimal value here.

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

Purpose4/5

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

The description clearly states the action ('create variations') and resource ('existing image using DALL-E'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'edit_image' or 'generate_image', but the focus on variations of existing images provides some implicit distinction.

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

Usage Guidelines2/5

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 alternatives like 'edit_image' or 'generate_image'. There's no mention of prerequisites, constraints, or typical use cases, leaving the agent with no contextual usage information beyond the basic purpose.

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

edit_imageC

Edit an existing image using DALL-E based on a text prompt

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesText description of the desired edits
imagePathYesPath to the image to edit
maskNoPath to the mask image (white areas will be edited, black areas preserved)
modelNoDALL-E model to use (currently only dall-e-2 supports editing)
sizeNoSize of the generated image
nNoNumber of images to generate (1-10)
saveDirNoDirectory to save the edited images
fileNameNoBase filename for the edited images (without extension)

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool edits images using DALL-E but omits critical details: whether this is a read/write operation (implied mutation from 'edit'), authentication needs, rate limits, file format requirements, or what happens to the original image. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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, efficient sentence that front-loads the core action ('Edit an existing image') and includes essential details (technology and input). There is zero waste or redundancy, making it appropriately sized and well-structured for quick comprehension.

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?

Given the tool's complexity (8 parameters, mutation operation, no output schema, and no annotations), the description is incomplete. It lacks information on behavioral traits (e.g., file handling, error cases), output format (what is returned?), and usage context. For a DALL-E editing tool with multiple parameters, this minimal description fails to provide sufficient context for effective agent use.

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 fully documents all 8 parameters. The description adds no parameter-specific information beyond implying 'prompt' is used for editing. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate with additional semantic context for parameters.

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

Purpose4/5

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

The description clearly states the verb ('Edit') and resource ('an existing image'), specifying the technology ('using DALL-E') and input mechanism ('based on a text prompt'). It distinguishes from sibling 'create_variation' and 'generate_image' by focusing on editing existing images rather than creating new ones or variations, though it doesn't explicitly contrast with these alternatives.

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

Usage Guidelines2/5

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 alternatives like 'create_variation' or 'generate_image'. It doesn't mention prerequisites (e.g., needing an existing image file), exclusions, or specific contexts where editing is preferred over generation. Usage is implied through the action 'edit an existing image' but lacks explicit direction.

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

generate_imageC

Generate an image using DALL-E based on a text prompt

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesText description of the desired image
modelNoDALL-E model to use (dall-e-2 or dall-e-3)
sizeNoSize of the generated image
qualityNoQuality of the generated image (dall-e-3 only)
styleNoStyle of the generated image (dall-e-3 only)
nNoNumber of images to generate (1-10)
saveDirNoDirectory to save the generated images
fileNameNoBase filename for the generated images (without extension)

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the basic function but omits critical behavioral details: whether this is a read-only or mutation operation, rate limits, authentication requirements, cost implications, or what happens when images are saved to 'saveDir'. For a complex 8-parameter tool with no annotation coverage, this is insufficient.

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, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for the tool's complexity and front-loads the essential information.

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?

For a complex image generation tool with 8 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the tool returns (image URLs? file paths? metadata?), error conditions, or behavioral constraints. The agent would need to guess about the output format and operational characteristics.

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 fully documents all 8 parameters. The description adds no additional parameter information beyond what's in the schema, meeting the baseline expectation but not providing extra value. The description doesn't explain relationships between parameters (e.g., 'quality' and 'style' only apply to 'dall-e-3').

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

Purpose4/5

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

The description clearly states the action ('generate') and resource ('image using DALL-E based on a text prompt'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'create_variation' or 'edit_image', which likely also involve image generation/manipulation.

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

Usage Guidelines2/5

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 alternatives like 'create_variation' or 'edit_image'. It doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to infer usage from the tool name alone.

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

validate_keyB

Validate the OpenAI API key

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but provides no information about what validation entails, what happens during validation, whether it makes external API calls, what the response format might be, or any error conditions. This leaves significant behavioral gaps.

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, efficient sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple validation tool and front-loads the core functionality immediately.

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?

For a validation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what validation means in this context, what constitutes success/failure, what information is returned, or how the validation is performed. The agent lacks crucial context to understand the tool's behavior and output.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description doesn't need to compensate for any parameter gaps, and it correctly doesn't mention any parameters. Baseline for 0 parameters with full coverage is 4.

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

Purpose4/5

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

The description clearly states the action ('validate') and the resource ('OpenAI API key'), providing specific verb+resource pairing. However, it doesn't differentiate from sibling tools (which are image-related operations), though this isn't necessary since they serve completely different domains.

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

Usage Guidelines2/5

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 alternatives. There's no mention of prerequisites, context for validation, or what constitutes appropriate usage scenarios. The agent must infer usage from the tool name alone.

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.

  1. 4 tool updates
    • First observedcreate_variation
    • First observededit_image
    • First observedgenerate_image
    • First observedvalidate_key

TDQS

A3.5/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: create_variation modifies an existing image, edit_image alters an image with a prompt, generate_image creates from scratch, and validate_key handles API authentication. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (e.g., create_variation, edit_image, generate_image, validate_key) using snake_case throughout. This predictability enhances readability and usability for agents.

Tool Count5/5

With 4 tools, this server is well-scoped for DALL-E image generation and management. Each tool serves a specific, essential function without bloat, making the set efficient and focused on core operations.

Completeness4/5

The tools cover key DALL-E operations: generation, editing, and variation creation, plus API key validation. A minor gap is the lack of tools for listing or managing generated images, but core workflows are fully supported without dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    An MCP tool server that enables generating and editing images through OpenAI's image models, supporting text-to-image generation and advanced image editing (inpainting, outpainting) across various MCP-compatible clients.
    115
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables image generation and editing using OpenAI's DALL-E models with support for text prompts, inpainting, and outpainting. It includes advanced features like automatic aspect ratio mapping and intelligent file management to handle large image payloads.
    29 npm
    1
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server for generating and editing images using OpenAI's GPT Image and DALL·E models. It provides tools for image generation, editing, variation creation, and model listing with support for multiple AI models.
    2
    4
    -