home / mcp / image generator mcp server

Image Generator MCP Server

MCP Server for Generating images

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "gmkr-mcp-imagegen": {
      "url": "http://localhost:3000/sse",
      "headers": {
        "PROVIDER": "replicate",
        "MODEL_NAME": "black-forest-labs/flux-schnell",
        "TOGETHER_API_KEY": "YOUR_TOGETHER_API_KEY",
        "REPLICATE_API_TOKEN": "YOUR_REPLICATE_API_TOKEN"
      }
    }
  }
}

You can run the MCP Image Generator server to create images from text prompts using Together AI or Replicate. It supports running locally via stdio or as an SSE endpoint, letting you integrate image generation into your workflows and applications with flexible configuration.

How to use

You can connect to the MCP Image Generator in two ways: as a remote SSE endpoint or as a local stdio server. When using SSE, you run the server somewhere accessible and point your MCP client to its /sse endpoint. When using stdio, you run the server locally and provide the necessary command to your MCP client. In both cases you supply a provider and API token to authorize image generation with the chosen service.

How to install

Prerequisites you need before starting include Node tooling if you run locally and a valid API key for your chosen provider. You will also install the required dependencies and set up configuration for your MCP client.

Step by step commands to run the SSE endpoint in Docker:

git clone https://github.com/gmkr/mcp-imagegen.git
cd mcp-imagegen
```
```
docker build -f Dockerfile.server -t mcp-imagegen .
docker run -p 3000:3000 mcp-imagegen

To configure your MCP client for the SSE endpoint, use a configuration block that points to the server and provides the necessary environment variables like the provider and API token.

{
  "mcpServers": {
    "imagegenerator": {
      "url": "http://localhost:3000/sse",
      "env": {
        "PROVIDER": "replicate",
        "REPLICATE_API_TOKEN": "your-replicate-api-token"
      }
    }
  }
}

How to install (continued)

If you prefer running locally with stdio, you will install dependencies and run the server command as shown.

git clone https://github.com/gmkr/mcp-imagegen.git
cd mcp-imagegen
```
```
pnpm install

Configure your MCP client with the stdio command and required environment variables. The example below shows how the client can start the MCP image generator using a local path to the source.

{
  "mcpServers": {
    "imagegenerator": {
      "command": "pnpx",
      "args": [
        "-y",
        "tsx",
        "/path/to/mcp-imagegen/src/index.ts"
      ],
      "env": {
        "PROVIDER": "replicate",
        "REPLICATE_API_TOKEN": "your-replicate-api-token"
      }
    }
  }
}

Configuration notes and security

Set the API keys securely in your environment. For the Replicate provider, you will typically set REPLICATE_API_TOKEN. For Together you would provide TOGETHER_API_KEY in a similar manner. You can also set PROVIDER to switch between providers. The default model can be customized with MODEL_NAME if your setup supports it.

If you run the SSE endpoint in a Docker environment, ensure your network access allows connections to port 3000 and that you protect the API token from exposure in logs or shared configurations.

Usage details

The MCP Image Generator exposes a tool named generate_image that accepts a text prompt and optional parameters to produce one or more images. Use this tool within your MCP client to request image generations based on prompts such as scene descriptions, art styles, or specific attributes. The tool supports parameters like width, height, and the number of images to generate.

Tools

  • Generates an image based on a textual prompt with optional width, height, and number of images parameters.

Available tools

generate_image

Generates an image based on a prompt with optional width, height, and number of images parameters.