img-gen
Provides image generation capabilities using Google's Gemini 2.5 Flash model, allowing for text-to-image generation with automatic optimization and compression.
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., "@img-genGenerate a realistic image of a futuristic city with flying cars at sunset"
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.
img-gen
An MCP (Model Context Protocol) server that provides image generation and weather services for Claude Desktop and other MCP-compatible clients.
Features
π¨ Image Generation
Generate images using Google's Gemini 2.5 Flash Image model
Automatic image compression and resizing to optimize token usage
Base64 encoding for seamless integration with MCP clients
Comprehensive logging and error handling
π€οΈ Weather Services
Get weather alerts for US states
Fetch detailed weather forecasts by latitude/longitude
Uses the National Weather Service (NWS) API
Related MCP server: Weather MCP Server
Prerequisites
Python 3.11 or higher
uv package manager
Google Gemini API key (for image generation)
Claude Desktop (optional, for MCP integration)
Installation
Clone this repository:
git clone <repository-url>
cd img_genInstall dependencies using
uv:
uv syncConfiguration
Google Gemini API Key
For image generation, you need to set up your Google Gemini API key. Update the API_KEY variable in image_generation.py:
API_KEY = "your-api-key-here"Alternatively, you can modify the code to read from an environment variable for better security.
Claude Desktop Integration
To use this MCP server with Claude Desktop, add the following configuration to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Image Generation Server Configuration:
{
"mcpServers": {
"image_generation": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/img_gen",
"run",
"image_generation.py"
]
}
}
}Weather Server Configuration:
{
"mcpServers": {
"weather": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/img_gen",
"run",
"weather.py"
]
}
}
}Note: Replace /path/to/uv with your actual uv installation path (e.g., /Users/username/.local/bin/uv) and /path/to/img_gen with the absolute path to this project directory.
Usage
Running the MCP Servers
Image Generation Server:
uv run image_generation.pyWeather Server:
uv run weather.pyImage Generation
The generate_image tool accepts a text prompt and returns a generated image:
Tool:
generate_imageParameters:
prompt(string): A text description of the image you want to generate
Returns: MCP Content objects containing the generated image in base64 format
Weather Services
Get Weather Alerts
Tool:
get_alertsParameters:
state(string): Two-letter US state code (e.g., "CA", "NY")
Returns: Active weather alerts for the specified state
Get Weather Forecast
Tool:
get_forecastParameters:
latitude(float): Latitude of the location (up to 4 decimal places recommended)longitude(float): Longitude of the location (up to 4 decimal places recommended)
Returns: Detailed weather forecast for the next 5 periods
Project Structure
img_gen/
βββ image_generation.py # MCP server for image generation using Gemini API
βββ weather.py # MCP server for weather alerts and forecasts
βββ main.py # Basic entry point
βββ pyproject.toml # Project dependencies and configuration
βββ uv.lock # Locked dependency versions
βββ README.md # This fileImage Processing
The image generation server includes automatic image optimization:
Max Dimension: 1024 pixels (maintains aspect ratio)
JPEG Quality: 85
Target File Size: ~500 KB
Format: Converts all images to JPEG for consistency
Images are automatically resized and compressed to reduce token usage while maintaining reasonable quality.
Dependencies
Key dependencies include:
mcp[cli]- Model Context Protocol frameworkgoogle-genai- Google Gemini API clientpillow- Image processinghttpx- HTTP client for weather API
See pyproject.toml for the complete list of dependencies.
Logging
Both servers include comprehensive logging:
Logs are written to
stderrLog levels: INFO, DEBUG, WARNING, ERROR
Includes timestamps and module names
Error Handling
Image generation failures return error messages via MCP
Weather API failures gracefully handle network issues
Invalid inputs are validated and return appropriate error messages
License
[Add your license here]
Contributing
[Add contribution guidelines if applicable]
Available Tools
1 toolgenerate_imageC
Create images based on the prompt
Args:
prompt: A prompt to generate the image using image generation model
Returns:
A list of MCP Content objects containing the generated image
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'Create images' implies a generative/mutation operation, the description lacks critical behavioral details: it doesn't mention authentication requirements, rate limits, cost implications, quality expectations, or what happens when generation fails. For a generative AI tool with zero annotation coverage, this is a significant gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured with clear sections (Args, Returns) and uses minimal sentences. The first sentence directly states the purpose, and subsequent sections provide necessary information without redundancy. However, the 'Args' section could be more integrated with the main description rather than appearing as a separate bullet.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has an output schema (which covers return values) and only one parameter, the description is reasonably complete for basic understanding. However, for an AI image generation tool with no annotations, it should provide more context about behavioral characteristics like generation time, supported image formats, resolution options, or usage limitations to be truly complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description provides basic semantic information about the single parameter ('A prompt to generate the image using image generation model'), but with 0% schema description coverage, this doesn't fully compensate. The description doesn't specify prompt format requirements, length constraints, style guidance, or what makes an effective prompt. Baseline 3 is appropriate as the description adds some value but doesn't fully address the coverage gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with 'Create images based on the prompt' - a specific verb ('Create') and resource ('images') with the mechanism ('based on the prompt'). However, without sibling tools, there's no opportunity to differentiate from alternatives, so it cannot achieve a perfect score of 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It simply states what the tool does without any context about appropriate use cases, prerequisites, or limitations. There's no mention of when this tool would be preferred over other image generation methods.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.0- First observed
generate_image
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap with other tools. The tool 'generate_image' has a clear, singular purpose that cannot be confused with any other tool in the set.
The single tool name 'generate_image' follows a clear verb_noun pattern, and since there are no other tools, consistency is inherently perfect with no deviations or mixed conventions to evaluate.
A single tool is too few for a server named 'img-gen', which suggests a broader image generation domain. This minimal set feels thin and incomplete, as it lacks operations like editing, upscaling, or managing generated images, which are common in such domains.
The tool surface is severely incomplete for an image generation server. While 'generate_image' covers creation, there are obvious gaps such as no tools for editing images, retrieving past generations, or handling variations, which limits agent workflows and leads to dead ends.
Maintenance
Related MCP Connectors
Get current weather for any city and create images from your prompts. Streamline planning, reportsβ¦
Generate AI images and videos from any compatible MCP client.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceIntegrates Google's Gemini API with MCP-compatible clients for chat, real-time web search, knowledge queries, code/text analysis, and content generation.59 npmMIT
- FlicenseBqualityDmaintenanceProvides weather forecasts and alerts for US locations using the National Weather Service API. Enables users to retrieve active alerts by state and detailed forecasts by coordinates via MCP tools.2-
- FlicenseNot gradedqualityCmaintenanceProvides tools for text simplification, translation, and image description via Google Gemini, enabling accessible content processing from any MCP client.-
- FlicenseCqualityCmaintenanceExposes US weather data as MCP tools, resources, and prompts via the National Weather Service API, enabling clients like Claude Desktop to get alerts, forecasts, and weather briefings.21-