ultimate-gemini-mcp 1.0.16__py3-none-any.whl → 1.0.18__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.0.16"
10
+ __version__ = "1.0.18"
11
11
  __author__ = "Ultimate Gemini MCP"
12
12
 
13
13
  from .config import get_settings
src/server.py CHANGED
@@ -14,7 +14,11 @@ import sys
14
14
  from fastmcp import FastMCP
15
15
 
16
16
  from .config import ALL_MODELS, get_settings
17
- from .tools import register_batch_generate_tool, register_generate_image_tool
17
+ from .tools import (
18
+ register_batch_generate_tool,
19
+ register_generate_image_tool,
20
+ register_get_image_tool,
21
+ )
18
22
 
19
23
  # Set up logging
20
24
  logging.basicConfig(
@@ -51,8 +55,32 @@ def create_app() -> FastMCP:
51
55
  # Register tools
52
56
  register_generate_image_tool(mcp)
53
57
  register_batch_generate_tool(mcp)
58
+ register_get_image_tool(mcp)
54
59
 
55
60
  # Add resources
61
+ @mcp.resource("image://latest", mime_type="image/png")
62
+ def get_latest_image() -> bytes:
63
+ """
64
+ Get the most recently generated image.
65
+
66
+ Returns:
67
+ Binary PNG image data
68
+ """
69
+ if not settings.output_dir.exists():
70
+ raise FileNotFoundError("No images have been generated yet")
71
+
72
+ # Find most recent PNG file
73
+ images = sorted(
74
+ settings.output_dir.glob("*.png"),
75
+ key=lambda p: p.stat().st_mtime,
76
+ reverse=True
77
+ )
78
+
79
+ if not images:
80
+ raise FileNotFoundError("No images found in output directory")
81
+
82
+ return images[0].read_bytes()
83
+
56
84
  @mcp.resource("models://list")
57
85
  def list_models() -> str:
58
86
  """List all available image generation models."""
@@ -133,47 +161,6 @@ def create_app() -> FastMCP:
133
161
 
134
162
  return json.dumps(config, indent=2)
135
163
 
136
- @mcp.resource("images://list")
137
- def list_images() -> str:
138
- """List all generated images in the output directory."""
139
- import json
140
- from pathlib import Path
141
-
142
- image_files = []
143
- if settings.output_dir.exists():
144
- for img in sorted(settings.output_dir.glob("*.png"), key=lambda p: p.stat().st_mtime, reverse=True):
145
- image_files.append({
146
- "filename": img.name,
147
- "size": img.stat().st_size,
148
- "modified": img.stat().st_mtime,
149
- "uri": f"image://{img.name}"
150
- })
151
-
152
- return json.dumps({"images": image_files}, indent=2)
153
-
154
- @mcp.resource("image://{filename}")
155
- def get_image(filename: str) -> bytes:
156
- """
157
- Get a generated image by filename.
158
-
159
- Args:
160
- filename: The filename of the image
161
-
162
- Returns:
163
- Image bytes (PNG format)
164
- """
165
- from pathlib import Path
166
-
167
- image_path = settings.output_dir / filename
168
-
169
- if not image_path.exists():
170
- raise FileNotFoundError(f"Image not found: {filename}")
171
-
172
- if not image_path.is_relative_to(settings.output_dir):
173
- raise ValueError("Access denied: path outside output directory")
174
-
175
- return image_path.read_bytes()
176
-
177
164
  logger.info("Ultimate Gemini MCP Server initialized successfully")
178
165
  return mcp
179
166
 
src/tools/__init__.py CHANGED
@@ -1,11 +1,16 @@
1
1
  """Tools module for Ultimate Gemini MCP."""
2
2
 
3
3
  from .batch_generate import batch_generate_images, register_batch_generate_tool
4
- from .generate_image import generate_image_tool, register_generate_image_tool
4
+ from .generate_image import (
5
+ generate_image_tool,
6
+ register_generate_image_tool,
7
+ register_get_image_tool,
8
+ )
5
9
 
6
10
  __all__ = [
7
11
  "generate_image_tool",
8
12
  "register_generate_image_tool",
13
+ "register_get_image_tool",
9
14
  "batch_generate_images",
10
15
  "register_batch_generate_tool",
11
16
  ]
@@ -179,6 +179,47 @@ async def generate_image_tool(
179
179
  await image_service.close()
180
180
 
181
181
 
182
+ def register_get_image_tool(mcp_server: Any) -> None:
183
+ """Register get_image tool with MCP server."""
184
+
185
+ @mcp_server.tool()
186
+ async def get_image(filename: str) -> str:
187
+ """
188
+ Retrieve a generated image by filename and return as base64.
189
+
190
+ Args:
191
+ filename: The filename of the image (e.g., "gemini-2.5-flash-image_20251026_055415_a cute orange cat sleeping on a sunny windowsill.png")
192
+
193
+ Returns:
194
+ JSON string with base64-encoded image data
195
+ """
196
+ import base64
197
+ import json
198
+
199
+ from ..config import get_settings
200
+
201
+ settings = get_settings()
202
+ image_path = settings.output_dir / filename
203
+
204
+ if not image_path.exists():
205
+ return json.dumps({"success": False, "error": f"Image not found: {filename}"})
206
+
207
+ try:
208
+ image_data = base64.b64encode(image_path.read_bytes()).decode()
209
+
210
+ return json.dumps(
211
+ {
212
+ "success": True,
213
+ "filename": filename,
214
+ "image_base64": image_data,
215
+ "size": image_path.stat().st_size,
216
+ },
217
+ indent=2,
218
+ )
219
+ except Exception as e:
220
+ return json.dumps({"success": False, "error": str(e)})
221
+
222
+
182
223
  def register_generate_image_tool(mcp_server: Any) -> None:
183
224
  """Register generate_image tool with MCP server."""
184
225
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultimate-gemini-mcp
3
- Version: 1.0.16
3
+ Version: 1.0.18
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
@@ -1,5 +1,5 @@
1
- src/__init__.py,sha256=tp0HzLV4X_y-gtvSrYfK9OPkED-ZLzFy6cNMwROpyFE,436
2
- src/server.py,sha256=Nw-OCalYEPo0EmWJpDot8IKux5p50LbFS0hEYjWlCyY,7301
1
+ src/__init__.py,sha256=rh3gu_KdsPjCNLWjsGKuZSr20I1-vugKmz1xv-wVZiM,436
2
+ src/server.py,sha256=mpzCQBE3yUqPc9gDJNvoxR2XKrN56w3yKm2l0S-dBB0,6678
3
3
  src/config/__init__.py,sha256=hL0recV_ycXBEGCym7BqwyaPCnQHy8o429pBirnBeiA,704
4
4
  src/config/constants.py,sha256=uFQJMk03vLb5YjkYMimeIz06WAVnqW3tuWQlJLYjHtc,1875
5
5
  src/config/settings.py,sha256=uTxxblnyqmglz1COd3QxjC2w3o6l51S9MTanP4HBrgE,4257
@@ -13,12 +13,12 @@ src/services/gemini_client.py,sha256=VPuBPDHhAag_8xBqzMuVIEWVG0BINXOHkwKIALzcFAk
13
13
  src/services/image_service.py,sha256=ovYsxDMwqsSiG1YbwBcTBrgmGTA7bdhDF6_jPs9XV_k,7095
14
14
  src/services/imagen_client.py,sha256=mvwbmtYQHqpKKM36tp8JPZTjxav5eeeist37lRJsv4k,6122
15
15
  src/services/prompt_enhancer.py,sha256=J_0s1EVmXdPAhjZPM4hL1vk9YiawqfH_ogF89VrFkW8,4776
16
- src/tools/__init__.py,sha256=zBfAjFT51LvvD7WXTfDYiyJstRdphr2ChddAmGMZxkI,346
16
+ src/tools/__init__.py,sha256=idmgH7aLtnwROyqOf2-KlTutb4mmJsN-xC2ClLB1Z-Q,419
17
17
  src/tools/batch_generate.py,sha256=ESAUkHX5TOKPlHCzgY2jMLyAvSmInN2Jwm5-51EeWwg,5406
18
- src/tools/generate_image.py,sha256=M8jvqEdcPQpKgnMQqIhlCy7i9yO3hMVdsWR6l1pd8G8,9438
18
+ src/tools/generate_image.py,sha256=vTwLY1v8lTZlwb9T7TKNcuYxgNpDDJKaB_NMrM_C0C0,10726
19
19
  src/utils/__init__.py,sha256=T2UShY0j2kiu63YPOsTACrzOfWTTq4PmC0flzcgeCl0,55
20
- ultimate_gemini_mcp-1.0.16.dist-info/METADATA,sha256=wcjXuoJtH06tV9_1qrBewfDdOWVU92CdeLyHZlHqOys,16131
21
- ultimate_gemini_mcp-1.0.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- ultimate_gemini_mcp-1.0.16.dist-info/entry_points.txt,sha256=-BeRTT4oR05e-YnF1ZNbNxlaekD4LsWhD-Zy_1dyRnc,56
23
- ultimate_gemini_mcp-1.0.16.dist-info/licenses/LICENSE,sha256=ilyzUnN0QHYtYGJks-NFUwiniNu08IedLmn_muRqa0o,1480
24
- ultimate_gemini_mcp-1.0.16.dist-info/RECORD,,
20
+ ultimate_gemini_mcp-1.0.18.dist-info/METADATA,sha256=uoAjdHpu3zNfUfbqpV3JCMt5t7zofS1ffrT9OVy4KW8,16131
21
+ ultimate_gemini_mcp-1.0.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ ultimate_gemini_mcp-1.0.18.dist-info/entry_points.txt,sha256=-BeRTT4oR05e-YnF1ZNbNxlaekD4LsWhD-Zy_1dyRnc,56
23
+ ultimate_gemini_mcp-1.0.18.dist-info/licenses/LICENSE,sha256=ilyzUnN0QHYtYGJks-NFUwiniNu08IedLmn_muRqa0o,1480
24
+ ultimate_gemini_mcp-1.0.18.dist-info/RECORD,,