home / mcp / image generator mcp server
MCP Server for Generating images
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.
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.
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-imagegenTo 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"
}
}
}
}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 installConfigure 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"
}
}
}
}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.
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.
Generates an image based on a prompt with optional width, height, and number of images parameters.