imagine-mcp
Enables image and video understanding and generation using OpenAI's gpt-image model, including image-to-image editing and generation from text prompts.
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., "@imagine-mcpgenerate a photorealistic image of a cat wearing a spacesuit on Mars"
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.
imagine-mcp
mcp-name: io.github.n24q02m/imagine-mcp
Image and video understanding + generation for AI agents -- across Gemini, OpenAI, and Grok.
Project | Tagline | Tag |
Knowledge graph for token-efficient code reviews -- semantic search and call-... | MCP | |
IMAP/SMTP email for AI agents -- read, send, organize folders, and manage att... | MCP | |
Composite MCP server for Godot Engine -- 17 composite tools for AI-assisted g... | MCP | |
Markdown-first Notion for AI agents -- pages, databases, blocks, and comments... | MCP | |
Telegram for AI agents -- messages, chats, media, and contacts across both bo... | MCP | |
Claude Code plugin marketplace for the n24q02m MCP servers -- install web sea... | Marketplace | |
Image and video understanding + generation for AI agents -- across Gemini, Op... | MCP | |
Chrome Extension for bulk operations on Jules tasks via batchexecute API -- a... | Tooling | |
Shared foundation for building MCP servers -- Streamable HTTP transport, OAut... | MCP | |
Persistent AI memory with hybrid search and embedded sync. Open, free, unlimi... | MCP | |
Lightweight Qwen3 text embedding and reranking via ONNX Runtime and GGUF | Library | |
Secrets without the server. | CLI | |
TACET: a self-distilling neuro-symbolic cascade that amortises LLM cost in kn... | Tooling | |
Shared web infrastructure package for search, scraping, HTTP security, and st... | Library | |
Open-source MCP server for AI agents: web search, content extraction, and lib... | MCP |
Table of contents
Related MCP server: mcp-media-engine
Features
Multimodal understanding -- Describe, classify, or reason over images and videos (Gemini handles mixed image + video in one call)
Image generation -- Text-to-image and image-to-image (edit / inpaint) across Gemini Imagen, OpenAI gpt-image, Grok Imagine
Video generation -- Text-to-video and image-to-video (Gemini Veo 3.1, Grok Imagine Video)
3 providers x 2 tiers -- Same interface for
gemini/openai/grokatpoor(cheap/fast) orrich(high quality); swap via parameterLeaderboard-ranked models -- Provider ordering auto-refreshed weekly from Artificial Analysis + LMArena leaderboards
Degraded mode -- Server starts with zero credentials and surfaces remaining providers as you add keys
Response cache -- Disk-based caching of
understandresponses with configurable TTLDual transport -- pure stdio with provider env vars (default) or HTTP multi-user with paste-token relay form
Install
Run with uvx (no install step) or pull the container image:
# uvx -- recommended, runs the published PyPI package
uvx imagine-mcp
# Docker
docker run -it --rm ghcr.io/n24q02m/imagine-mcp:latestAdd it to an MCP client by pointing the client at the uvx imagine-mcp command and
supplying at least one provider key (see Configuration):
{
"mcpServers": {
"imagine": {
"command": "uvx",
"args": ["imagine-mcp"],
"env": { "GEMINI_API_KEY": "AIza..." }
}
}
}For per-client snippets (Claude Code, Codex, Gemini CLI, Cursor, Windsurf) and the browser-based HTTP setup, see the Setup docs.
Install with an AI agent -- paste this to your AI coding agent:
Install MCP server
imagine-mcpfollowing the steps at
https://raw.githubusercontent.com/n24q02m/claude-plugins/main/plugins/imagine-mcp/setup-with-agent.md
Configuration
Two transports (default stdio; opt into http with --http, MCP_TRANSPORT=http,
or TRANSPORT_MODE=http):
stdio (default) -- single-user, reads credentials from env vars only. Exits if none of the three provider keys are set.
http -- HTTP daemon. Local self-host on
127.0.0.1by default, or multi-user remote (per-JWT-sub credential isolation) whenPUBLIC_URL+MCP_DCR_SERVER_SECRETare set. In HTTP mode credentials are entered through a browser form at/authorize.
Provider keys
All optional -- the server starts in degraded mode and surfaces whichever providers have a key. Set at least one.
Env var | Provider | Get a key at |
| Gemini (image + video) | aistudio.google.com/apikey |
| OpenAI (image) | platform.openai.com/api-keys |
| Grok / xAI (image + video) | console.x.ai |
When a tool is called without an explicit provider, the first key present wins in the
order XAI_API_KEY -> OPENAI_API_KEY -> GEMINI_API_KEY.
Model chains (optional)
Override the built-in provider/tier catalog with explicit model chains. Each is a CSV of
litellm provider/model entries; the order is the fallback order.
Env var | Purpose |
| Ordered model chain for |
| Ordered model chain for |
| CSV of provider names reordering generation auto-fallback. Defaults to |
Understanding is routed through litellm (provider/model passthrough), so any litellm
provider works -- supply that provider's <PROVIDER>_API_KEY. Generation stays on the
native provider SDKs (Gemini, OpenAI, Grok). Example:
{
"mcpServers": {
"imagine": {
"command": "uvx",
"args": ["imagine-mcp"],
"env": {
"UNDERSTAND_MODELS": "gemini/gemini-3.1-pro-preview,openai/gpt-5.4",
"GEMINI_API_KEY": "AIza...",
"OPENAI_API_KEY": "sk-..."
}
}
}
}Runtime knobs
config(action="set", key=..., value=...) adjusts log_level, default_provider,
default_tier, and cache_ttl_seconds at runtime.
Documentation
Full docs at mcp.n24q02m.com/servers/imagine-mcp/setup/:
Setup -- install methods for Claude Code, Codex, Gemini CLI, Cursor, Windsurf, mcp.json
Modes overview -- stdio / local-relay / remote-relay / remote-oauth
Multi-user setup -- per-JWT-sub credential model
Tools
Tool | Actions | Description |
| -- | Describe or reason over one or more image/video URLs. |
| -- | Generate an image or video from a text prompt. |
|
| Credential + runtime config: open relay form, check credential state, set runtime knobs (log level, default provider, TTL), clear response cache. |
| -- | Full Markdown documentation for |
| -- | Framework-injected helper (mcp-core) equivalent to |
Model IDs per provider x action x tier are leaderboard-ranked; see docs/models.md (auto-regenerated from src/imagine_mcp/models.py).
Comparison
How imagine-mcp stacks up against direct competitors in each pillar:
Capability | imagine-mcp | EverArt MCP | fal.ai MCP | Replicate Flux MCP |
Image/video understanding | Yes (describe / classify / reason over image + video URLs) | No | No | No |
Image generation | Yes (text-to-image + image-to-image via | Yes (single | Yes (text/image-to-image, edit, inpaint) | Yes (single |
Video generation | Yes (text-to-video + image-to-video, async | No | Yes (text/image-to-video) | No |
Multi-provider backends | Yes (Gemini / OpenAI / Grok, auto-fallback) | No (EverArt only) | No (fal.ai only) | No (Replicate Flux only) |
Quality/cost tiers | Yes ( | No | No | No |
Self-hostable / open source | Yes (MIT, stdio + HTTP self-host) | Yes (MIT, archived) | Yes (MIT) | Yes (MIT, archived) |
Security
SSRF + LFI prevention -- All
media_urlsandreference_image_urlare validated at the dispatch boundary; onlyhttp://andhttps://schemes reach the providers.file://,ftp://,gopher://, and scheme-less URLs are rejected.No credentials in errors -- Provider-side errors are sanitized before being returned.
Degraded start -- Missing credentials do not prevent the server from starting; affected actions surface actionable errors instead of crashing at boot.
Credential storage -- Credentials submitted through the browser credential form are stored encrypted via
mcp-core(AES-GCM, machine-bound key) at~/.imagine-mcp/config.json.
Build from Source
git clone https://github.com/n24q02m/imagine-mcp.git
cd imagine-mcp
mise run setup # or: uv sync --group dev
mise run dev # run the server in stdio mode (add --http for the HTTP daemon)Deploy to Cloudflare
Run your own imagine instance serverless on Cloudflare (Worker + Container + KV). Storage
is KV-only -- the per-user credential vault lives in KV, and generation returns base64 only
because the container filesystem is ephemeral (IMAGINE_OUTPUT_MODE=base64).
Prerequisites: a Cloudflare account on the Workers Paid plan -- required for Containers (the Cloudflare free tier does not include Containers) -- and the wrangler CLI.
git clone https://github.com/n24q02m/imagine-mcp && cd imagine-mcpwrangler loginCreate the KV namespace (imagine is KV-only -- no D1 or Vectorize), then paste the returned id into
wrangler.jsonc(the<imagine-kv-namespace-id>placeholder):wrangler kv namespace create imagine-kvPush the container image to your Cloudflare managed registry (CF Containers cannot pull from external registries directly), then set
<YOUR_ACCOUNT_ID>inwrangler.jsonc:docker pull ghcr.io/n24q02m/imagine-mcp:beta docker tag ghcr.io/n24q02m/imagine-mcp:beta imagine-mcp:beta wrangler containers push imagine-mcp:beta # prints registry.cloudflare.com/<ACCOUNT_ID>/imagine-mcp:betaPoint the remaining
wrangler.jsoncplaceholders at your own domain:<YOUR_PUBLIC_URL>(thevars.PUBLIC_URL, e.g.https://imagine.example.com) and<YOUR_WORKER_DOMAIN>(theroutescustom-domain pattern, e.g.imagine.example.com).Set secrets.
CREDENTIAL_SECRET(stable JWT signing key + per-user vault key) andMCP_DCR_SERVER_SECRET(proof of an intentional multi-user deploy) are required;MCP_RELAY_PASSWORDgates the browser setup form's login. Provider keys are optional server defaults -- users normally paste their own through the setup form instead:wrangler secret put CREDENTIAL_SECRET wrangler secret put MCP_DCR_SERVER_SECRET wrangler secret put MCP_RELAY_PASSWORD wrangler secret put GEMINI_API_KEY # optional provider default wrangler secret put OPENAI_API_KEY # optional provider default wrangler secret put XAI_API_KEY # optional provider defaultwrangler deploy, then open your Worker domain and finish setup in the browser relay form.
The http container image already runs multi-user (MCP_TRANSPORT=http is baked into the
image target). Storage maps to Cloudflare via MCP_STORAGE_BACKEND=cf-kv (encrypted
credential vault) with IMAGINE_OUTPUT_MODE=base64, which forces base64 responses so no
media path is written to the ephemeral container filesystem.
Trust Model
This plugin implements TC-Local (machine-bound, single trust principal). See mcp-core trust model for full classification.
Mode | Storage | Encryption | Who can read your data? |
stdio (default) |
| AES-GCM, machine-bound key | Only your OS user (file perm 0600) |
HTTP self-host | Same as stdio | Same | Only you (admin = user) |
Contributing
See CONTRIBUTING.md for the full development workflow, commit convention, and release process. Issues + Discussions welcome.
License
MIT -- see LICENSE.
Maintenance
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/n24q02m/imagine-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server