MCP server for Stable Diffusion image generation

MCP server for Stable Diffusion image generation

image_gen_mcp•byaymec

A Model Context Protocol server that bundles a Stable Diffusion image generation service and exposes it to AI agents as an MCP tool.

License: Not specified•Runtime: Awaiting documentation review•Category: media design

WHAT IT DOES

  • •Exposes a generate_image tool that agents can call with their own prompts through the MCP interface.
  • •Forwards MCP requests to an integrated image generation service and returns a formatted MCP image object with URL and metadata.
  • •Generates images with Stable Diffusion and serves them from a configurable output folder, returning URL, dimensions, and metadata.

BEST FOR

  • •AI agents that need to generate images on demand from text prompts.
  • •Users who want a single process serving both the image generation backend and the MCP interface.

ABOUT IMAGE_GEN_MCP

MCP server for Stable Diffusion image generation is cataloged as an MCP server attributed to aymec. A Model Context Protocol server that bundles a Stable Diffusion image generation service and exposes it to AI agents as an MCP tool. It is categorized under media design. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for Stable Diffusion image generation are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the image generation service run on a custom port?

Yes, the image generation service runs on port 5000 by default and can be customized with the --port option.

Does the image generation service run in the same process as the MCP server?

Yes, it runs in a separate thread within the same process as the MCP server.

Upstream README

View this exact version on GitHub

README.md · 7dd57bc23d37 · Fetched 2026-11-13 10:46:23 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

AI Image Generation Server with MCP Interface

This project provides a Model Context Protocol (MCP) server with integrated Stable Diffusion image generation capabilities, enabling AI agents to request and receive generated images.
This project is based on the example provided by Block's Goose Custom Extension tutorial.

Setup

  1. Create a virtual environment, use .venv mandatorily:

    virtualenv .venv
    
  2. Activate the virtual environment:

    source .venv/bin/activate
    
  3. Install the MCP package (for Goose integration):

    pip install -e .
    

Running the Service

The MCP server includes the integrated image generation service. You can start both with a single command:

Standard mode:

source .venv/bin/activate  # Activate your virtualenv
export IMAGE_GEN_DIR=/absolute/path/to/folder # Set generated images target folder
image-gen-mcp

Development mode with FastMCP Inspector: Open two terminals:

Terminal 1

source .venv/bin/activate  # Activate your virtualenv
export IMAGE_GEN_DIR=/absolute/path/to/folder # Set generated images target folder
image-gen-mcp # Start image generation service (and a MCP server we won't use)

Terminal 2

source .venv/bin/activate  # Activate your virtualenv
export IMAGE_GEN_DIR=/absolute/path/to/folder # Set generated images target folder
mcp dev src/image_gen_mcp/server.py # Start MCP server with Inspector

Note: Only when using development mode, the image generation service must be started separately.

This will start the MCP server with the FastMCP Inspector, which provides:

  1. A web interface at http://127.0.0.1:6274 for testing and debugging
  2. A proxy server on port 6277 for forwarding MCP requests

Using the FastMCP Inspector:

  1. Open http://127.0.0.1:6274 in your browser
  2. Use the interactive interface to:
    • Explore available tools and their documentation
    • Test the generate_image tool with your own prompts
    • View request/response history
    • Debug any issues with the MCP server

Custom port for image generation service:

source .venv/bin/activate  # Activate your virtualenv
export IMAGE_GEN_DIR=/absolute/path/to/folder # Set generated images target folder
image-gen-mcp --port 5001

Direct API Access

Generate an image by sending a POST request to the image generation service:

curl -X POST http://localhost:5000/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A futuristic cityscape at sunset"}'

The response will include the URL to access the generated image along with metadata:

{
  "type": "image",
  "format": "png",
  "url": "http://localhost:5000/images/123e4567-e89b-12d3-a456-426614174000.png",
  "width": 512,
  "height": 512,
  "filename": "123e4567-e89b-12d3-a456-426614174000.png",
  "filepath": "generated_images/123e4567-e89b-12d3-a456-426614174000.png",
  "mime_type": "image/png",
  "prompt": "A futuristic cityscape at sunset",
  "alt_text": "AI-generated image of: A futuristic cityscape at sunset"
}

You can access the generated image directly via the returned image_url.

File Organization

  • src/image_gen_mcp/ - Package directory containing the implementation
    • server.py - The MCP server implementation
    • generator.py - The image generation service
    • __init__.py - Package initialization and CLI entry point
    • __main__.py - Enables running the package as a module

Integration with Goose

To add this MCP server as an extension in Goose:

  1. Go to Settings > Extensions > Add.
  2. Set the Type to StandardIO.
  3. Provide ID "image_generator", name "Image Generator", and an appropriate description.
  4. In the Command field, provide the absolute path to your executable:
    uv run /full/path/to/your/project/.venv/bin/image-gen-mcp
    
  5. Add an environment variable IMAGE_GEN_DIR and pick a folder where generated images will be stored

Once integrated, you can use the image generation tool in Goose by asking it to generate an image with a specific prompt.

It works immediately when using OpenAI GPT-4o.
It is possible to run everytthing locally with Ollama, After trying a few models, the only one that worked is mistral-small3.1.
Even on a high-end MacBookPro, the response from mistral-small3.1 is much slower than with OpenAI GPT-4o.

Service Architecture

Both services are integrated into a single application:

  1. Image Generation Service (src/image_gen_mcp/generator.py)

    • Handles the actual image generation using Stable Diffusion
    • Provides a simple HTTP API for image generation
    • Returns image URL, dimensions, and metadata
    • Includes a direct endpoint to serve the generated images
    • Runs on port 5000 by default (customizable with --port)
    • Runs in a separate thread within the same process as the MCP server
  2. MCP Server (src/image_gen_mcp/server.py)

    • Provides a standardized MCP interface for AI agents
    • Forwards requests to the integrated Image Generation Service
    • Returns a properly formatted MCP image object with URL and metadata

Stopping the Service

Use Ctrl+C to stop both services, as they now run within the same process.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for Stable Diffusion image generation from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/image_gen_mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related media design MCP Servers

Alternative and complementary servers in the same category

View all in media design →

A Rust CAD application with an MCP server for creating, inspecting and rendering drawings, either headlessly or through a connection to the desktop app.

8K
Media & Design
Liquid Composer
liquid-composer•frontedu

Liquid Composer is a browser-based Liquid Glass icon design tool that offers a local MCP server for agent-driven icon workflows.

69
Media & Design

agent-media makes short drama series and other short vertical videos from Claude, ChatGPT or Codex through one MCP connection, with OAuth sign-in and no API keys.

1
Media & Design