Universe Imagine MCP
Sends optional generation notifications to a Discord channel via webhook.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Universe Imagine MCPgenerate an image of a sunset over a peaceful lake"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Universe Imagine MCP
MCP server for AI image generation. Wraps local ComfyUI as a Streamable HTTP MCP server. Works with any MCP-compatible bot client.
Features
Streamable HTTP — MCP
2024-11-05protocol, Bearer authSynchronous generation —
generate_imageblocks and returns the image URL directlyBackground queue — multiple requests accepted, processed one at a time
Idempotency keys — safe retries without duplicates
Player-aware — reads
player_idfrom MCP initialize handshakeGeneration history — SQLite, with
sincefilter for incremental queriesHealth endpoint — reports backend status, queue depth, uptime
Image serving — built-in static file server for generated images
Idle watchdog — stops ComfyUI after 5 minutes of inactivity to free VRAM
Warm start — ComfyUI starts in background when MCP server boots
Discord webhook — optional generation notifications
Related MCP server: ComfyUI MCP
Prerequisites
Python 3.11+
ComfyUI installed locally
At least one model downloaded (e.g. Flux, SDXL, SD3, etc.)
Setup
# 1. Clone the repo
git clone https://github.com/BAWES-Universe/universe-imagine-mcp.git
cd universe-imagine-mcp
# 2. Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure
cp .env.example .env
# Edit .env — at minimum set DESIGNER_MCP_TOKEN and PUBLIC_URL_BASE
# Set MODEL_UNET, MODEL_CLIP, MODEL_VAE to match your ComfyUI models
# 5. Run
python3 designer_mcp.pyConfiguration
All config goes in .env:
Variable | Default | Description |
| — | Bearer token for MCP auth (required) |
| — | Public base URL for image serving (required) |
|
| Listen address |
|
| MCP server port |
|
| ComfyUI API URL |
|
| ComfyUI install directory |
|
| SQLite database path |
|
| ComfyUI output directory |
| — | Discord webhook for generation notifications (optional) |
|
| UNet model filename |
|
| CLIP model filename |
|
| VAE model filename |
Tools
generate_image(prompt, width=512, height=512, idempotency_key="") → JSON
Generate an image from a text prompt. Blocks until complete (typically 3-15 seconds) and returns the image URL directly. The image is auto-sent to the conversation by the bot.
Use idempotency_key to safely retry without duplicates — same key = cached result.
get_generation(generation_id) → JSON
Retrieve a past generation's full record by ID.
list_generations(limit=10, since="") → JSON array
List recent generations for the calling player. Optionally filter by ISO 8601 timestamp.
get_generation_status(generation_id) → JSON (legacy)
Legacy polling tool kept for backwards compatibility. The current generate_image is synchronous and returns the URL directly — polling is not needed.
DNS Rebinding — Monkey Patch
The server includes a monkey-patch for FastMCP's built-in DNS rebinding check (see designer_mcp.py lines 23-33). This is needed when running behind a reverse proxy or Cloudflare tunnel where the incoming Host header (e.g., imagine.yourdomain.com) doesn't match localhost.
If you're running behind a reverse proxy: The patch is safe because auth is handled by the BearerAuthMiddleware. Keep it.
If you're running on localhost only (no tunnel/proxy): Remove the patch entirely — delete lines 23-33 from designer_mcp.py.
The patch:
from mcp.server.transport_security import TransportSecurityMiddleware
_orig_validate = TransportSecurityMiddleware.validate_request
async def _patched_validate(self, request, is_post=False):
return None # Skip Host header validation
TransportSecurityMiddleware.validate_request = _patched_validateConnecting to a Universe Bot
Register the MCP server on a bot via the admin API:
POST /api/bots/{botId}/mcp-servers
{
"serverUrl": "https://your-domain.com/mcp",
"transport": "streamable-http",
"authType": "bearer",
"authConfig": "your-token"
}Player ID is sent automatically in the MCP initialize handshake — no extra config needed.
Architecture
┌─────────────┐ Streamable HTTP ┌──────────────────┐
│ Bot AI │ ◄─────────────────────── │ Imagine MCP │
│ (MCP client)│ /mcp (port 8003) │ (FastMCP) │
└─────────────┘ │ │
│ ┌────────────┐ │
┌─────────────┐ Static files │ │ Queue (1) │──┼──► _run_generation()
│ Browser │ ◄─────────────────────── │ └────────────┘ │
│ /images/* │ /images (port 8004) │ │ │
└─────────────┘ │ ▼ │
│ ┌────────────┐ │
curl /health │ │ ComfyUI │ │
─────────► /health (port 8005) │ │ (port 8188)│ │
│ └────────────┘ │
└──────────────────┘License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BAWES-Universe/universe-imagine-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server