mcp-ai-image-generator
This server provides AI media generation capabilities through MCP, letting you create and edit images and videos using Gemini (free personal account or API key) and OpenAI DALL-E, with local history and dynamic configuration.
Generate images from text descriptions using Gemini AI (Imagen), with optional model quality (high/fast) and model overrides.
Edit images by providing a file path and text instructions, continue editing the last image, and optionally supply reference images for style/content guidance.
Generate videos using Gemini Veo: text-to-video, image-to-video (first frame), first+last frame interpolation, with controls for resolution, aspect ratio, duration, number of variants, and negative prompts.
Generate OpenAI images via DALL-E models, and dynamically set/update the OpenAI API key.
Configure authentication for Gemini: switch between free cookie-based gemini-web login (configure_google_login) or official API key (configure_api_key), stored locally and persisting across sessions.
Set default model/tier for Gemini image generation and editing, with "high" or "fast" quality presets.
Check status and history: view current auth mode, active model, recent images/videos, and list past generations.
Extend to ChatGPT Web via the included HTTP bridge and OpenAPI schema for Custom GPT Actions.
Provides tools for generating and editing images with Google's Gemini/Imagen models and creating videos with Veo, supporting API-based or free Google account authentication.
Enables image generation using OpenAI's DALL-E 3 models, with tools for generating images and configuring an OpenAI API key.
Click on "Deploy 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., "@mcp-ai-image-generator Generate an image of a cyberpunk cat riding a motorcycle in neon-lit Tokyo at night"
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.
π MCP AI Image & Video Studio (Free Personal Gemini & DALL-E 3)
The Ultimate MCP Server for AI Media Generation - No Gemini API Key Required!
Seamlessly integrate the world's most powerful AI generators directly into your Model Context Protocol (MCP) clients (like Claude Desktop, Codex, etc.) or connect it directly to ChatGPT on the Web.
Generate breathtaking images using Google's Gemini (Imagen 3) using your free, personal Google account! You don't need to pay for or configure a Google Cloud API keyβthis project uses your browser session to generate images for free. You can also generate images using OpenAI's DALL-E 3 right from your chat interface!
β¨ Features
π Free Personal Account Mode: Generate and edit images using your free, personal Google account (via
gemini.google.com). No API key, credit card, or Google Cloud setup needed!π€ ChatGPT Web Support: Includes an HTTP REST bridge and OpenAPI schema so you can use this directly in ChatGPT Custom GPTs!
π¨ Multi-Model Image Support: Access Google Gemini for free, plus optional support for OpenAI's
dall-e-3.πΎ Auto-Save & History: All generated masterpieces are automatically saved locally with full history tracking.
π οΈ Dynamic Configuration: Configure your cookies or API keys on the fly directly from the chat.
Related MCP server: Gemini Image Gen MCP Server
π Quick Start (Local MCP Clients)
1. Install
git clone https://github.com/MohamedCHAMI/mcp-ai-image-generator.git
cd mcp-ai-image-generator
npm install
npm run build2. Configure your MCP Client (Claude, Codex, etc.)
Add this to your MCP client configuration (e.g., claude_desktop_config.json). Notice there are no API keys required for Gemini!
{
"mcpServers": {
"mcp-ai-image-generator": {
"command": "node",
"args": ["/absolute/path/to/mcp-ai-image-generator/dist/index.js"]
}
}
}π How to Connect Your Free Personal Google Account
Because official Gemini APIs can be used with generic MCPs, the magic of this project is that it uses your personal email and browser session. Here is how to connect it in 3 easy steps:
Go to gemini.google.com in your regular web browser (Chrome, Safari, etc.) and log in to your personal account.
Open your browser's Developer Tools (Press
F12orCmd+Option+I) -> Application tab -> Cookies section -> click onhttps://gemini.google.com.Find the cookie named
__Secure-1PSIDand copy its value.Inside your AI client, just tell the AI:
"Run the
configure_google_logintool and useYOUR_COOKIE_VALUEas the secure1psid."
That's it! You can now generate images for free.
(Note: If you also want to use OpenAI DALL-E 3, you can dynamically provide your API key by asking the AI to run the configure_openai_api_key tool).
π Refreshing cookies / switching to the official API (CLI)
The free gemini-web cookies expire periodically (Google rotates the session). Two ways to deal with it, both via the bundled CLI (no editing ~/.nano-banana/config.json by hand, no secrets typed into chat):
(Run these from the project folder; node dist/cli.js is prompt2pic if you npm link it globally.)
Refresh cookies (stays free):
node dist/cli.js cookiesPrompts for __Secure-1PSID / __Secure-1PSIDTS with hidden input (not echoed, not saved to shell history). Grab the values the same way as above (DevTools β Application β Cookies β gemini.google.com). Restart the MCP server afterward to pick up the change.
Switch to the official API key (never expires, billed):
node dist/cli.js apikeyPrompts for a GEMINI_API_KEY (get one at aistudio.google.com/apikey), hidden input, no expiry to manage.
Toggle between modes once both are configured:
node dist/cli.js mode gemini-web # free, cookie-based
node dist/cli.js mode apiKey # official, no expiryNon-interactive variants (--psid, --psidts, --key) exist for scripting but land the secret in shell history β prefer the interactive prompts.
π How to Use with ChatGPT Web (Custom GPTs)
Want to use your free Gemini image generation directly inside ChatGPT on the web? This repo includes a built-in Express server and an openapi.json schema precisely for Custom GPT Actions.
1. Start the HTTP Bridge
Open your terminal in the project folder and start the REST server:
npm run serve-httpIn a new terminal tab, expose the server to the internet using Ngrok (or Cloudflare):
ngrok http 3333Copy the https://... URL that Ngrok generates.
2. Create the Custom GPT in ChatGPT
Go to ChatGPT -> Click your profile -> My GPTs -> Create a GPT.
Click the Configure tab.
Scroll down to the bottom and click "Create new action".
In the Schema box, paste the entire contents of the
openapi.jsonfile from this repository.In the Schema you pasted, find
https://YOUR_NGROK_URL_HEREand replace it with your actual Ngrok URL.Save and publish your Custom GPT!
3. Authenticate & Generate
In your new Custom GPT chat, simply tell ChatGPT:
"Configure my Google login using this cookie: [PASTE YOUR __Secure-1PSID COOKIE HERE]"
ChatGPT will securely send the cookie to your local server. Once configured, you can just ask it naturally:
"Generate an image of a futuristic cyberpunk city."
ChatGPT will route the request through your machine directly to Gemini using your personal account, completely free!
π οΈ Available Tools
πΌοΈ Free Gemini Images (Personal Account Mode)
generate_image: Generate a new image using Gemini AI (Imagen 3).edit_image: Edit an existing image based on text instructions and a local file path.continue_editing: Automatically continue editing the last generated or edited image.configure_google_login: Set your__Secure-1PSIDcookie for free personal account access.
πΌοΈ OpenAI Images (Requires API Key)
generate_openai_image: Generate an image using DALL-E models. Parameters:prompt,model,size.configure_openai_api_key: Dynamically set your OpenAI API key.
βοΈ Utilities & Configuration
get_status: Check current configuration, auth mode, and recent generations.list_history: View recently generated/edited images.
π Storage
Images are automatically saved to your home directory:
~/nano-banana-images/
β€οΈ Contributing
Contributions, issues, and feature requests are welcome! If you like this project, please consider giving it a β!
Available Tools
12 toolsconfigure_api_keyA
Set or update the Gemini API key for image generation. The key is stored locally and persists across sessions.
Inputs: apiKey (required).
configure_google_loginA
Switch to the free, unofficial "gemini-web" auth mode that uses your logged-in consumer Gemini (gemini.google.com) session instead of an API key. Supports image generation and editing (no video). Extract the cookies from your browser DevTools (Application > Cookies > gemini.google.com). Cookies are stored locally and may need re-extraction when they expire.
Inputs: secure1psid (required), secure1psidts.
configure_modelA
Set the default Gemini model for image generation and editing. Persists across sessions. Use "quality" param to set either "high" (default) or "fast" model tier. High-quality: gemini-3.1-flash-image-preview (default). Fast/cheap: gemini-2.5-flash-image (default fast).
Inputs: model (required), quality.
configure_openai_api_keyA
Set or update the OpenAI API key for image generation. The key is stored locally.
Inputs: apiKey (required).
continue_editingA
Continue editing the last generated or edited image. Automatically uses the most recent image from the session.
Inputs: prompt (required), model, quality, referenceImages.
edit_imageB
Edit an existing image based on text instructions. Provide the file path of the image to modify.
Inputs: prompt (required), imagePath (required), model, quality, +1 more.
generate_imageA
Generate a new image from a text description using Gemini AI. Returns the generated image and saves it to disk.
Inputs: prompt (required), model, quality.
generate_openai_imageB
Generate a new image from a text description using OpenAI DALL-E models.
Inputs: prompt (required), size, model.
generate_videoA
Generate a video from a text prompt using Gemini Veo. Supports text-to-video, image-to-video (first frame), and first+last frame interpolation. Video generation takes 1-6 minutes. Available models: veo-3.1-generate-preview (latest), veo-3-generate-preview, veo-2-generate-preview.
Inputs: prompt (required), model, imagePath, resolution, +5 more.
get_statusA
Check the current configuration status, active model, and last image/video information.
Inputs: no named parameters.
list_historyA
List recently generated and edited images with their prompts and timestamps.
Inputs: count.
list_video_historyA
List recently generated videos with their prompts, models, and timestamps.
Inputs: count.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 12 tools
Most tools target a distinct action or provider, but pairs like generate_image/generate_openai_image and edit_image/continue_editing could be confused without reading descriptions closely. The configure_* tools are also similar in name though their purposes differ clearly.
The set mostly follows an imperative verb_noun pattern in lowercase snake_case. Minor inconsistencies exist: list_history vs list_video_history is asymmetric, generate_image omits the provider while generate_openai_image includes it, and continue_editing uses a gerund instead of a noun object.
12 tools is a well-scoped count for a media generation server covering Gemini and OpenAI image/video generation, editing, history, configuration, and status. Each tool has a reasonable purpose and the count is not bloated or too thin.
Core workflows are covered: image generation/editing, video generation, history listing, configuration, authentication, and status. Minor gaps include no explicit OpenAI image editing, no per-provider model selection beyond the Gemini default, and no retrieval of past media by ID.
Maintenance
Related MCP Connectors
Generate AI video, images and audio, and browse your history, from any MCP client.
Generate images, video, audio and short films with 140+ AI models from any MCP client.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Generate AI images and videos from any compatible MCP client.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI image and video generation using Midjourney through the AceDataCloud API. It supports comprehensive features including image creation, transformation, blending, editing, and video generation directly within MCP-compatible clients.16605 PyPI18MIT
- AlicenseAqualityDmaintenanceEnables AI image generation, editing, and upscaling via Google Gemini and Imagen models, supporting dynamic model switching and multiple MCP-compatible clients.12MIT
- AlicenseAqualityBmaintenanceEnables video and image generation from any MCP client, with support for models like Veo 3.1, Grok Imagine, and Nano Banana, including text-to-video, image-to-video, image generation and editing.478 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants in MCP clients to generate and edit images by automatically expanding short requests into detailed prompts with composition, lighting, and camera direction, then saving results to disk. Supports Gemini, OpenAI, and BytePlus Seedream providers with selectable quality presets, aspect ratios, and image sizes.1,781 npmMIT