ultimate-gemini-mcp 1.6.1__py3-none-any.whl → 1.6.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ultimate-gemini-mcp might be problematic. Click here for more details.

src/__init__.py CHANGED
@@ -7,7 +7,7 @@ A unified MCP server that combines the best features from:
7
7
  - Advanced features: batch processing, editing, templates, and more
8
8
  """
9
9
 
10
- __version__ = "1.6.1"
10
+ __version__ = "1.6.2"
11
11
  __author__ = "Ultimate Gemini MCP"
12
12
 
13
13
  from .config import get_settings
src/config/__init__.py CHANGED
@@ -10,6 +10,7 @@ from .constants import (
10
10
  IMAGEN_MODELS,
11
11
  MAX_BATCH_SIZE,
12
12
  MAX_IMAGES_PER_REQUEST,
13
+ MODEL_METADATA,
13
14
  PERSON_GENERATION_OPTIONS,
14
15
  )
15
16
  from .settings import APIConfig, ServerConfig, Settings, get_settings
@@ -24,6 +25,7 @@ __all__ = [
24
25
  "IMAGEN_MODELS",
25
26
  "MAX_BATCH_SIZE",
26
27
  "MAX_IMAGES_PER_REQUEST",
28
+ "MODEL_METADATA",
27
29
  "PERSON_GENERATION_OPTIONS",
28
30
  "APIConfig",
29
31
  "ServerConfig",
src/config/constants.py CHANGED
@@ -75,3 +75,58 @@ BATCH_TIMEOUT = 120
75
75
 
76
76
  # Output settings
77
77
  DEFAULT_OUTPUT_DIR = "generated_images"
78
+
79
+ # Model metadata for MCP resources
80
+ MODEL_METADATA = {
81
+ "gemini": {
82
+ "gemini-2.5-flash-image": {
83
+ "name": "Gemini 2.5 Flash Image",
84
+ "description": "Advanced image generation with editing and prompt enhancement",
85
+ "features": [
86
+ "Prompt enhancement",
87
+ "Image editing",
88
+ "Character consistency",
89
+ "Multi-image blending",
90
+ "World knowledge integration",
91
+ ],
92
+ "default": True,
93
+ }
94
+ },
95
+ "imagen": {
96
+ "imagen-4": {
97
+ "name": "Imagen 4",
98
+ "description": "High-quality image generation with improved text rendering",
99
+ "features": [
100
+ "Enhanced quality",
101
+ "Better text rendering",
102
+ "Negative prompts",
103
+ "Seed-based reproducibility",
104
+ "Person generation controls",
105
+ "Advanced controls",
106
+ ],
107
+ },
108
+ "imagen-4-fast": {
109
+ "name": "Imagen 4 Fast",
110
+ "description": "Optimized for faster generation while maintaining good quality",
111
+ "features": [
112
+ "Faster generation speed",
113
+ "Good quality output",
114
+ "Negative prompts",
115
+ "Seed-based reproducibility",
116
+ "Person generation controls",
117
+ "Cost-effective",
118
+ ],
119
+ },
120
+ "imagen-4-ultra": {
121
+ "name": "Imagen 4 Ultra",
122
+ "description": "Highest quality with best prompt adherence",
123
+ "features": [
124
+ "Highest quality",
125
+ "Best prompt adherence",
126
+ "Professional results",
127
+ "Enhanced text rendering",
128
+ "Advanced controls",
129
+ ],
130
+ },
131
+ },
132
+ }
src/core/validation.py CHANGED
@@ -126,9 +126,9 @@ def validate_prompts_list(prompts: list[str]) -> None:
126
126
  def sanitize_filename(filename: str) -> str:
127
127
  """Sanitize filename to remove unsafe and special characters."""
128
128
  # Replace all non-alphanumeric characters (except hyphens) with underscores
129
- safe_name = re.sub(r'[^a-zA-Z0-9-]', '_', filename)
129
+ safe_name = re.sub(r"[^a-zA-Z0-9-]", "_", filename)
130
130
  # Remove multiple consecutive underscores
131
- safe_name = re.sub(r'_+', '_', safe_name)
131
+ safe_name = re.sub(r"_+", "_", safe_name)
132
132
  # Remove leading/trailing underscores
133
133
  safe_name = safe_name.strip("_")
134
134
  # Ensure filename is not empty
src/server.py CHANGED
@@ -8,12 +8,15 @@ Unified MCP server supporting:
8
8
  - Batch processing, prompt templates, and comprehensive features
9
9
  """
10
10
 
11
+ import json
11
12
  import logging
12
13
  import sys
14
+ from functools import lru_cache
15
+ from typing import TypedDict
13
16
 
14
17
  from fastmcp import FastMCP
15
18
 
16
- from .config import ALL_MODELS, get_settings
19
+ from .config import ALL_MODELS, MODEL_METADATA, get_settings
17
20
  from .tools import register_batch_generate_tool, register_generate_image_tool
18
21
 
19
22
  # Set up logging
@@ -26,6 +29,45 @@ logging.basicConfig(
26
29
  logger = logging.getLogger(__name__)
27
30
 
28
31
 
32
+ class PromptMessage(TypedDict):
33
+ """Type definition for MCP prompt messages."""
34
+
35
+ role: str
36
+ content: str
37
+
38
+
39
+ def _validate_prompt_messages(messages: list[PromptMessage]) -> list[PromptMessage]:
40
+ """
41
+ Validate prompt message structure for MCP compliance.
42
+
43
+ Args:
44
+ messages: List of message dictionaries with 'role' and 'content' keys
45
+
46
+ Returns:
47
+ Validated messages (same as input if valid)
48
+
49
+ Raises:
50
+ ValueError: If message structure is invalid or types are incorrect
51
+ """
52
+ for msg in messages:
53
+ if "role" not in msg or "content" not in msg:
54
+ raise ValueError(f"Invalid prompt message structure: {msg}")
55
+ if not isinstance(msg["role"], str) or not isinstance(msg["content"], str):
56
+ raise ValueError(f"Prompt message role and content must be strings: {msg}")
57
+ return messages
58
+
59
+
60
+ @lru_cache(maxsize=1)
61
+ def _get_models_json() -> str:
62
+ """
63
+ Get models information as JSON (cached).
64
+
65
+ This function is cached because the models list is static.
66
+ Uses MODEL_METADATA from constants.py as the single source of truth.
67
+ """
68
+ return json.dumps(MODEL_METADATA, indent=2)
69
+
70
+
29
71
  def create_app() -> FastMCP:
30
72
  """
31
73
  Create and configure the Ultimate Gemini MCP application.
@@ -52,73 +94,99 @@ def create_app() -> FastMCP:
52
94
  register_generate_image_tool(mcp)
53
95
  register_batch_generate_tool(mcp)
54
96
 
97
+ # Add prompts
98
+ @mcp.prompt()
99
+ def quick_image_generation() -> list[PromptMessage]:
100
+ """Quick start: Generate a single image with Gemini."""
101
+ return _validate_prompt_messages(
102
+ [
103
+ {
104
+ "role": "user",
105
+ "content": "Generate an image of a serene mountain landscape at sunset using the default Gemini model.",
106
+ }
107
+ ]
108
+ )
109
+
110
+ @mcp.prompt()
111
+ def high_quality_image() -> list[PromptMessage]:
112
+ """Generate a high-quality image using Imagen 4 Ultra."""
113
+ return _validate_prompt_messages(
114
+ [
115
+ {
116
+ "role": "user",
117
+ "content": "Generate a professional quality image of a futuristic cityscape with neon lights using the imagen-4-ultra model.",
118
+ }
119
+ ]
120
+ )
121
+
122
+ @mcp.prompt()
123
+ def image_with_negative_prompt() -> list[PromptMessage]:
124
+ """Generate an image using negative prompts (Imagen only)."""
125
+ return _validate_prompt_messages(
126
+ [
127
+ {
128
+ "role": "user",
129
+ "content": "Generate an image of a beautiful garden with flowers using imagen-4. Make sure there are no people or animals in the image.",
130
+ }
131
+ ]
132
+ )
133
+
134
+ @mcp.prompt()
135
+ def batch_image_generation() -> list[PromptMessage]:
136
+ """Generate multiple images from a list of prompts."""
137
+ return _validate_prompt_messages(
138
+ [
139
+ {
140
+ "role": "user",
141
+ "content": "Generate images for these three scenes: a cat on a windowsill, a dog in a park, and a bird in a tree.",
142
+ }
143
+ ]
144
+ )
145
+
146
+ @mcp.prompt()
147
+ def edit_existing_image() -> list[PromptMessage]:
148
+ """Edit an existing image using Gemini (requires input image)."""
149
+ return _validate_prompt_messages(
150
+ [
151
+ {
152
+ "role": "user",
153
+ "content": "I have an image at ~/Pictures/photo.jpg. Can you edit it to change the time of day to sunset?",
154
+ }
155
+ ]
156
+ )
157
+
158
+ @mcp.prompt()
159
+ def character_consistency() -> list[PromptMessage]:
160
+ """Generate images with character consistency across multiple scenes (Gemini only, multi-step)."""
161
+ return _validate_prompt_messages(
162
+ [
163
+ {
164
+ "role": "user",
165
+ "content": "First, generate an image of a cartoon wizard character studying in a library with maintain_character_consistency enabled. Then, generate a second image of the same wizard character exploring a magical forest, also with maintain_character_consistency enabled to keep the character's appearance consistent between scenes.",
166
+ }
167
+ ]
168
+ )
169
+
55
170
  # Add resources
56
- @mcp.resource("models://list")
171
+ @mcp.resource(
172
+ "models://list",
173
+ name="Available Models",
174
+ description="List all available image generation models with their features and capabilities",
175
+ mime_type="application/json",
176
+ )
57
177
  def list_models() -> str:
58
178
  """List all available image generation models."""
59
- import json
60
-
61
- models_info = {
62
- "gemini": {
63
- "gemini-2.5-flash-image": {
64
- "name": "Gemini 2.5 Flash Image",
65
- "description": "Advanced image generation with editing and prompt enhancement",
66
- "features": [
67
- "Prompt enhancement",
68
- "Image editing",
69
- "Character consistency",
70
- "Multi-image blending",
71
- "World knowledge integration",
72
- ],
73
- "default": True,
74
- }
75
- },
76
- "imagen": {
77
- "imagen-4": {
78
- "name": "Imagen 4",
79
- "description": "High-quality image generation with improved text rendering",
80
- "features": [
81
- "Enhanced quality",
82
- "Better text rendering",
83
- "Negative prompts",
84
- "Seed-based reproducibility",
85
- "Person generation controls",
86
- "Advanced controls",
87
- ],
88
- },
89
- "imagen-4-fast": {
90
- "name": "Imagen 4 Fast",
91
- "description": "Optimized for faster generation while maintaining good quality",
92
- "features": [
93
- "Faster generation speed",
94
- "Good quality output",
95
- "Negative prompts",
96
- "Seed-based reproducibility",
97
- "Person generation controls",
98
- "Cost-effective",
99
- ],
100
- },
101
- "imagen-4-ultra": {
102
- "name": "Imagen 4 Ultra",
103
- "description": "Highest quality with best prompt adherence",
104
- "features": [
105
- "Highest quality",
106
- "Best prompt adherence",
107
- "Professional results",
108
- "Enhanced text rendering",
109
- "Advanced controls",
110
- ],
111
- },
112
- },
113
- }
179
+ return _get_models_json()
114
180
 
115
- return json.dumps(models_info, indent=2)
116
-
117
- @mcp.resource("settings://config")
181
+ @mcp.resource(
182
+ "settings://config",
183
+ name="Server Configuration",
184
+ description="Shows current server configuration including output directory, timeout settings, batch size limits, and default parameters",
185
+ mime_type="application/json",
186
+ )
118
187
  def get_config() -> str:
119
188
  """Get current server configuration."""
120
- import json
121
-
189
+ # Note: Settings are not cached because they could change based on environment
122
190
  config = {
123
191
  "output_directory": str(settings.output_dir),
124
192
  "prompt_enhancement_enabled": settings.api.enable_prompt_enhancement,
@@ -57,7 +57,9 @@ class ImageResult:
57
57
  """Generate clean, short filename."""
58
58
  timestamp = self.timestamp.strftime("%Y%m%d_%H%M%S")
59
59
  # Shorten model name (e.g., gemini-2.5-flash-image -> gemini-flash)
60
- model_short = self.model.replace("gemini-2.5-flash-image", "gemini-flash").replace("imagen-4-", "img4-")
60
+ model_short = self.model.replace("gemini-2.5-flash-image", "gemini-flash").replace(
61
+ "imagen-4-", "img4-"
62
+ )
61
63
  # Sanitize and shorten prompt (max 30 chars)
62
64
  prompt_snippet = sanitize_filename(self.prompt[:30])
63
65
  index_str = f"_{self.index + 1}" if self.index > 0 else ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultimate-gemini-mcp
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: Ultimate image generation MCP server unifying Gemini 2.5 Flash Image and Imagen 4/Fast/Ultra with advanced features
5
5
  Project-URL: Homepage, https://github.com/anand-92/ultimate-image-gen-mcp
6
6
  Project-URL: Repository, https://github.com/anand-92/ultimate-image-gen-mcp
@@ -61,7 +61,7 @@ Description-Content-Type: text/markdown
61
61
  - Comprehensive error handling and validation
62
62
  - Configurable settings via environment variables
63
63
  - Detailed logging and debugging
64
- - MCP resources for configuration and model information
64
+ - MCP prompts, tools, and resources for complete MCP integration
65
65
 
66
66
  ## 🎬 Showcase - See It In Action
67
67
 
@@ -143,10 +143,14 @@ a maine coon cat blended with spiderman raimi suit version
143
143
  2. **Model Variety**: Compare Imagen 4, Imagen 4 Ultra, and Gemini 2.5 Flash results side-by-side
144
144
  3. **AI Enhancement Magic**: See how prompt enhancement adds lighting, composition, and technical details
145
145
  4. **Consistent Quality**: All images feature dramatic chiaroscuro lighting, atmospheric effects, and hyper-detailed textures
146
+
146
147
  5. **Model-Specific Strengths**:
147
- - Imagen 4 Ultra: Maximum quality and material detail
148
- - Gemini 2.5 Flash: Dynamic poses and creative interpretations
149
- - Imagen 4: Balanced speed and quality
148
+ - **Imagen 4 Ultra**: Maximum quality and material detail - best for final production work
149
+ - **Imagen 4**: Balanced quality with good performance - the standard choice
150
+ - **Imagen 4 Fast**: Optimized speed while maintaining quality - perfect for rapid iteration and prototyping
151
+ - **Gemini 2.5 Flash**: Dynamic poses and creative interpretations with editing capabilities
152
+
153
+ **Note**: The showcase above demonstrates `imagen-4`, `imagen-4-ultra`, and `gemini-2.5-flash-image`. All Imagen models (including `imagen-4-fast`) produce similar quality outputs, with the main difference being generation speed.
150
154
 
151
155
  ## 🚀 Quick Start
152
156
 
@@ -384,13 +388,75 @@ Running with the same seed will produce the same image.
384
388
  | `MAX_BATCH_SIZE` | Maximum parallel batch size | `8` |
385
389
  | `LOG_LEVEL` | Logging level | `INFO` |
386
390
 
391
+ ## 💬 Prompts
392
+
393
+ The server provides several ready-to-use prompt templates to help you get started. These can be selected in your MCP client (Claude Desktop, Cursor, etc.) for instant use.
394
+
395
+ ### `quick_image_generation`
396
+ **Description**: Quick start - Generate a single image with Gemini.
397
+
398
+ **What it does**: Creates a serene mountain landscape at sunset using the default Gemini model with prompt enhancement enabled.
399
+
400
+ **Usage in Claude Desktop**: Select this prompt to get started immediately with a basic image generation.
401
+
402
+ ### `high_quality_image`
403
+ **Description**: Generate a high-quality image using Imagen 4 Ultra.
404
+
405
+ **What it does**: Creates a professional quality futuristic cityscape with neon lights using Imagen's highest quality model.
406
+
407
+ **Usage example**: Perfect when you need the absolute best quality for professional work or final presentations.
408
+
409
+ ### `image_with_negative_prompt`
410
+ **Description**: Generate an image using negative prompts (Imagen only).
411
+
412
+ **What it does**: Creates a beautiful garden with flowers while explicitly avoiding people or animals using Imagen's negative prompt feature.
413
+
414
+ **Usage example**: Use this when you want precise control over what NOT to include in your images.
415
+
416
+ ### `batch_image_generation`
417
+ **Description**: Generate multiple images from a list of prompts.
418
+
419
+ **What it does**: Creates three different images (cat on windowsill, dog in park, bird in tree) in a single request.
420
+
421
+ **Usage example**: Ideal for generating multiple related images at once, like social media content or design variations.
422
+
423
+ ### `edit_existing_image`
424
+ **Description**: Edit an existing image using Gemini (requires input image).
425
+
426
+ **What it does**: Takes an existing image and modifies it to change the time of day to sunset.
427
+
428
+ **Usage example**: Select this prompt and update the path to your own image file (e.g., ~/Pictures/photo.jpg) to edit it.
429
+
430
+ ### `character_consistency`
431
+ **Description**: Generate images with character consistency across multiple scenes (Gemini only, multi-step).
432
+
433
+ **What it does**: First generates a wizard character in a library, then generates the same wizard in a different scene (magical forest) while maintaining consistent character appearance.
434
+
435
+ **Usage example**: Perfect for creating consistent character designs across multiple images for storytelling, character sheets, or animation concepts.
436
+
387
437
  ## 📚 MCP Resources
388
438
 
389
- ### `models://list`
390
- View all available models with descriptions and features.
439
+ Resources provide read-only access to server information and can be attached as context in your MCP client.
440
+
441
+ ### `models://list` - Available Models
442
+ **URI**: `models://list`
443
+ **Type**: application/json
444
+ **Description**: Lists all available image generation models (Gemini and Imagen) with their features, capabilities, and descriptions.
445
+
446
+ **Use this when you need to**:
447
+ - Check which models are available
448
+ - Understand model capabilities
449
+ - See model-specific features
450
+
451
+ ### `settings://config` - Server Configuration
452
+ **URI**: `settings://config`
453
+ **Type**: application/json
454
+ **Description**: Shows current server configuration including output directory, timeout settings, batch size limits, and default parameters.
391
455
 
392
- ### `settings://config`
393
- View current server configuration.
456
+ **Use this when you need to**:
457
+ - Check where images are being saved
458
+ - Verify prompt enhancement is enabled
459
+ - See current timeout and batch settings
394
460
 
395
461
  ## 🎭 Use Cases
396
462
 
@@ -1,21 +1,21 @@
1
- src/__init__.py,sha256=-pG7_5PkC32LJjdJT2Ueqqk2HX66FhXfWbaJxRdmLOA,435
2
- src/server.py,sha256=hyXuhS1h6DN2EiGle8giEPSV1UB3ba7t4do_2olTK3A,5862
3
- src/config/__init__.py,sha256=hL0recV_ycXBEGCym7BqwyaPCnQHy8o429pBirnBeiA,704
4
- src/config/constants.py,sha256=ue4dT6wFwCzAgDWvSt8RnbdaoaGHY8c7SViNxI-P73w,1870
1
+ src/__init__.py,sha256=jG_iqkolbdWR4FZOnC98ZIc3gGf0npnnYUdXFiCQem0,435
2
+ src/server.py,sha256=4GH2lgv_mb6I5DQta4t4-wXe1pQegnXeTj6ynnwlT7E,8319
3
+ src/config/__init__.py,sha256=nKsm-7I6lQnImjjhBEkgaHduvCNQbff7LRXBR80HRuE,746
4
+ src/config/constants.py,sha256=8kbpO_Wag1RQA4YBD4fo2rNBkP-Fg6nT2xHA-WKdgz0,3703
5
5
  src/config/settings.py,sha256=uTxxblnyqmglz1COd3QxjC2w3o6l51S9MTanP4HBrgE,4257
6
6
  src/core/__init__.py,sha256=PQKMAY5eYIEO1oS_hrzeuDgRopl76Wn6NLfhtXBX92I,1200
7
7
  src/core/exceptions.py,sha256=NVb4tpwoX_DR-Wp8r73brXvZhEP35SUMyuEis8llFR0,1211
8
- src/core/validation.py,sha256=ZlKDcviKQvZLCfOALSIn7sOOt1DxNlchPq0YhJJMqKI,4887
8
+ src/core/validation.py,sha256=5OZU7M5_4GoM52NeNozURHe6sF7cIpZBEuyuS95aiLE,4887
9
9
  src/services/__init__.py,sha256=n6FVDj052zvTerDFJSjaiLIycWGePm8Wr6dabbvd9o0,395
10
10
  src/services/gemini_client.py,sha256=VPuBPDHhAag_8xBqzMuVIEWVG0BINXOHkwKIALzcFAk,8324
11
- src/services/image_service.py,sha256=6eqp7dukRPfIgHs4sBvfxZ7hsc8E6LrvPx_RdU_h1OM,7300
11
+ src/services/image_service.py,sha256=27Pirtr23H8U8rDKpeUMhV4XtyUgUPc56otQy043tZU,7322
12
12
  src/services/imagen_client.py,sha256=mvwbmtYQHqpKKM36tp8JPZTjxav5eeeist37lRJsv4k,6122
13
13
  src/services/prompt_enhancer.py,sha256=J_0s1EVmXdPAhjZPM4hL1vk9YiawqfH_ogF89VrFkW8,4776
14
14
  src/tools/__init__.py,sha256=zBfAjFT51LvvD7WXTfDYiyJstRdphr2ChddAmGMZxkI,346
15
15
  src/tools/batch_generate.py,sha256=R_aqngSCwg3QAprPHe_0uqH_KJ35G6DoSVA9CU3KkZk,5744
16
16
  src/tools/generate_image.py,sha256=wNN1w_KlMpqDP80EhNiDzvEvPozCOFweY9y4w9NtWac,9458
17
- ultimate_gemini_mcp-1.6.1.dist-info/METADATA,sha256=oybKglSmqi_v3zJDCfF3h4NOZnZnhIFDgHnLR5E-Z9E,17729
18
- ultimate_gemini_mcp-1.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
- ultimate_gemini_mcp-1.6.1.dist-info/entry_points.txt,sha256=-BeRTT4oR05e-YnF1ZNbNxlaekD4LsWhD-Zy_1dyRnc,56
20
- ultimate_gemini_mcp-1.6.1.dist-info/licenses/LICENSE,sha256=ilyzUnN0QHYtYGJks-NFUwiniNu08IedLmn_muRqa0o,1480
21
- ultimate_gemini_mcp-1.6.1.dist-info/RECORD,,
17
+ ultimate_gemini_mcp-1.6.2.dist-info/METADATA,sha256=g8pUyqkmyrrS9pL_NgCuLbItefOdkv6yZyt-wDSuyeM,21253
18
+ ultimate_gemini_mcp-1.6.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
+ ultimate_gemini_mcp-1.6.2.dist-info/entry_points.txt,sha256=-BeRTT4oR05e-YnF1ZNbNxlaekD4LsWhD-Zy_1dyRnc,56
20
+ ultimate_gemini_mcp-1.6.2.dist-info/licenses/LICENSE,sha256=ilyzUnN0QHYtYGJks-NFUwiniNu08IedLmn_muRqa0o,1480
21
+ ultimate_gemini_mcp-1.6.2.dist-info/RECORD,,