Get the FREE Ultimate OpenClaw Setup Guide →

image-generator

A Model Context Protocol Server To Generate Images

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio sammyl720-image-generator-mcp-server node dist/server.js \
  --env OPENAI_API_KEY="<your-openai-api-key>"

How to use

The image-generator MCP server exposes a tool named generate_image which generates images from textual prompts using OpenAI's DALL-E 3 model. The tool requires a prompt to describe the image you want to create and an imageName which will be used to save the resulting image in a generated-images directory on your desktop. To use it, start the MCP server with your configured environment variable for OPENAI_API_KEY, then invoke the generate_image tool with the required parameters. This server leverages a TypeScript implementation and builds to a Node.js executable, so it runs as a standard Node process that communicates over stdio with the MCP client.

Capabilities include:

  • generate_image: Produces an image based on a textual prompt. Parameters:
    • prompt (required): The description of the image you want to generate.
    • imageName (required): The filename (without path) for saving the image under a generated-images directory on your desktop. The server handles creation of the directory if needed.

To use it from an MCP client, ensure the server is reachable via stdio (as configured in your environment), provide your OPENAI_API_KEY, and call the generate_image tool with the appropriate arguments. You can customize the image generation by adjusting prompt wording and the imageName to organize outputs.

How to install

Prerequisites:

  • Node.js (v14+ recommended) and npm installed on your system.
  • Access to an OpenAI API key with permission to use DALL-E 3.

Installation steps:

  1. Clone or download the MCP server repository for image-generator.

  2. Open a terminal in the project root and install dependencies:

    npm install

  3. Build the server (TypeScript to JavaScript):

    npm run build

  4. (Optional for development) Run in watch mode to auto-rebuild on changes:

    npm run watch

  5. Prepare environment and run:

  • Create or export your OPENAI_API_KEY:

    export OPENAI_API_KEY="<your-openai-api-key>" # macOS/Linux set OPENAI_API_KEY=<your-openai-api-key> # Windows PowerShell $env:OPENAI_API_KEY = "<your-openai-api-key>" # Windows CMD

  • Start the server (as configured in mcp_config):

    node dist/server.js

  1. Verify that the server starts and is ready to accept stdio MCP connections. You can adjust PATHs or the startup command if you’ve packaged the server differently.

Additional notes

Tips and notes:

  • The server saves generated images to a generated-images directory on your desktop. Ensure the process has write permissions to that location.
  • Since MCP servers communicate over stdio, debugging can be challenging. If you run into issues, consider using the MCP Inspector tool mentioned in the project, and start the server with logging enabled to stdout/stderr for easier troubleshooting.
  • Manage your OPENAI_API_KEY securely; do not commit it to version control. Use environment variable management or secret vaults in production.
  • If you modify the build, ensure you rebuild before restarting the server to pick up changes.
  • If the imageName collides with an existing file, the server should handle overwriting or versioning based on its internal logic; consult the code if you need custom behavior.

Related MCP Servers

Sponsor this space

Reach thousands of developers