ultimate-gemini-mcp 1.0.2__py3-none-any.whl → 1.0.3__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 +1 -1
- src/services/gemini_client.py +27 -3
- src/services/imagen_client.py +6 -1
- src/tools/generate_image.py +14 -1
- {ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/METADATA +1 -1
- {ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/RECORD +9 -9
- {ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/WHEEL +0 -0
- {ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/entry_points.txt +0 -0
- {ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/licenses/LICENSE +0 -0
src/__init__.py
CHANGED
src/services/gemini_client.py
CHANGED
|
@@ -83,7 +83,21 @@ class GeminiClient:
|
|
|
83
83
|
|
|
84
84
|
parts.append({"text": prompt_text})
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
# Build generation config for image generation
|
|
87
|
+
generation_config = {
|
|
88
|
+
"responseModalities": ["Image"]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
# Add aspect ratio to image config if specified
|
|
92
|
+
if aspect_ratio:
|
|
93
|
+
generation_config["imageConfig"] = {
|
|
94
|
+
"aspectRatio": aspect_ratio
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
request_body = {
|
|
98
|
+
"contents": [{"parts": parts}],
|
|
99
|
+
"generationConfig": generation_config
|
|
100
|
+
}
|
|
87
101
|
|
|
88
102
|
headers = {
|
|
89
103
|
"x-goog-api-key": self.api_key,
|
|
@@ -92,14 +106,21 @@ class GeminiClient:
|
|
|
92
106
|
|
|
93
107
|
try:
|
|
94
108
|
logger.debug(f"Sending request to {url}")
|
|
109
|
+
logger.debug(f"Request body: {request_body}")
|
|
95
110
|
response = await self.client.post(url, json=request_body, headers=headers)
|
|
96
111
|
response.raise_for_status()
|
|
97
112
|
data = response.json()
|
|
98
113
|
|
|
114
|
+
logger.debug(f"Response status: {response.status_code}")
|
|
115
|
+
logger.debug(f"Response data: {data}")
|
|
116
|
+
|
|
99
117
|
# Extract images from response
|
|
100
118
|
images = self._extract_images(data)
|
|
101
119
|
|
|
102
120
|
if not images:
|
|
121
|
+
logger.error(f"No images extracted from response. Response structure: {list(data.keys())}")
|
|
122
|
+
if "candidates" in data:
|
|
123
|
+
logger.error(f"Candidates: {data['candidates']}")
|
|
103
124
|
raise APIError("No image data found in Gemini API response")
|
|
104
125
|
|
|
105
126
|
return {"images": images, "model": model, "response": data}
|
|
@@ -170,10 +191,13 @@ class GeminiClient:
|
|
|
170
191
|
content = candidate.get("content", {})
|
|
171
192
|
parts = content.get("parts", [])
|
|
172
193
|
for part in parts:
|
|
173
|
-
|
|
174
|
-
|
|
194
|
+
# Handle both inline_data and inlineData formats
|
|
195
|
+
inline_data = part.get("inline_data") or part.get("inlineData")
|
|
196
|
+
if inline_data:
|
|
197
|
+
image_data = inline_data.get("data")
|
|
175
198
|
if image_data:
|
|
176
199
|
images.append(image_data)
|
|
200
|
+
logger.debug(f"Extracted image data of length: {len(image_data)}")
|
|
177
201
|
except Exception as e:
|
|
178
202
|
logger.warning(f"Error extracting images from response: {e}")
|
|
179
203
|
|
src/services/imagen_client.py
CHANGED
|
@@ -90,8 +90,13 @@ class ImagenClient:
|
|
|
90
90
|
if negative_prompt:
|
|
91
91
|
request_body["instances"][0]["negativePrompt"] = negative_prompt
|
|
92
92
|
|
|
93
|
+
# Note: Seed parameter is not supported by Imagen API (as of 2025)
|
|
94
|
+
# The API returns a 400 error if seed is provided
|
|
93
95
|
if seed is not None:
|
|
94
|
-
|
|
96
|
+
logger.warning(
|
|
97
|
+
"Seed parameter is not supported by Imagen API and will be ignored. "
|
|
98
|
+
"Images cannot be reproduced with a seed value."
|
|
99
|
+
)
|
|
95
100
|
|
|
96
101
|
headers = {
|
|
97
102
|
"Content-Type": "application/json",
|
src/tools/generate_image.py
CHANGED
|
@@ -77,8 +77,21 @@ async def generate_image_tool(
|
|
|
77
77
|
|
|
78
78
|
if person_generation:
|
|
79
79
|
validate_person_generation(person_generation)
|
|
80
|
+
|
|
81
|
+
# Warn if prompt may conflict with person_generation policy
|
|
82
|
+
if person_generation == "dont_allow":
|
|
83
|
+
person_keywords = ["person", "people", "man", "woman", "child", "human", "face", "portrait", "crowd"]
|
|
84
|
+
if any(keyword in prompt.lower() for keyword in person_keywords):
|
|
85
|
+
logger.warning(
|
|
86
|
+
f"Prompt contains person-related keywords but person_generation is set to 'dont_allow'. "
|
|
87
|
+
f"This may result in the API blocking image generation."
|
|
88
|
+
)
|
|
89
|
+
|
|
80
90
|
if seed is not None:
|
|
81
91
|
validate_seed(seed)
|
|
92
|
+
logger.warning(
|
|
93
|
+
"Note: The seed parameter is not currently supported by Imagen API and will be ignored."
|
|
94
|
+
)
|
|
82
95
|
|
|
83
96
|
# Get settings
|
|
84
97
|
settings = get_settings()
|
|
@@ -213,7 +226,7 @@ def register_generate_image_tool(mcp_server: Any) -> None:
|
|
|
213
226
|
use_world_knowledge: Use real-world knowledge (Gemini only)
|
|
214
227
|
person_generation: Person policy: dont_allow, allow_adult, allow_all (Imagen only)
|
|
215
228
|
negative_prompt: What to avoid in the image (Imagen only)
|
|
216
|
-
seed: Random seed for reproducibility (
|
|
229
|
+
seed: Random seed for reproducibility (NOT SUPPORTED - will be ignored)
|
|
217
230
|
|
|
218
231
|
Available models:
|
|
219
232
|
- gemini-2.5-flash-image (default)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ultimate-gemini-mcp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
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,4 +1,4 @@
|
|
|
1
|
-
src/__init__.py,sha256=
|
|
1
|
+
src/__init__.py,sha256=fXeeHRer3O8akAlzdXxD5fmz35ToF8aNHQ7eUXE6-xA,435
|
|
2
2
|
src/server.py,sha256=vVJ96VMl-Z7y756qjASywZaD2QYj5v8nIQ8r504Mg3g,5877
|
|
3
3
|
src/config/__init__.py,sha256=hL0recV_ycXBEGCym7BqwyaPCnQHy8o429pBirnBeiA,704
|
|
4
4
|
src/config/constants.py,sha256=iLHMFVJzWRkSMkG6gXHBWepVLbcDvlgqZtkgfEuaaUQ,1877
|
|
@@ -7,15 +7,15 @@ src/core/__init__.py,sha256=h8ik58bFn0g0XFVtMEI4MDoFapi4FlQywgd3S0eR2Oo,1266
|
|
|
7
7
|
src/core/exceptions.py,sha256=U09aPGmlDTAGbt6PbF-PKbmT1ee9LHqghkOXGn094UI,1197
|
|
8
8
|
src/core/validation.py,sha256=NzF01GVhmBefn_bo4cGDMREuE6kc3RujbfOtfx9eLyk,5186
|
|
9
9
|
src/services/__init__.py,sha256=5iCkCasXmsBcJ0zDIu3qCSdTZtmKPDmWuz14dMK0N7I,395
|
|
10
|
-
src/services/gemini_client.py,sha256=
|
|
10
|
+
src/services/gemini_client.py,sha256=6xZWNIRbqtXUP7hs-LygHXKfMvkhOlPaR36nKJkM74Y,8520
|
|
11
11
|
src/services/image_service.py,sha256=UcErTYMjG6ihKeT2w0UaGiiVIoUwf2Kt7oSafEjx28w,7526
|
|
12
|
-
src/services/imagen_client.py,sha256=
|
|
12
|
+
src/services/imagen_client.py,sha256=TWtordh22auxI19ZdWxyXpfSgrWFnM28I1WzTqMiVn4,5932
|
|
13
13
|
src/services/prompt_enhancer.py,sha256=JFTKqwWafngq37yGjiYT5-FJbIj4Buvt0js2nU_9gsw,4805
|
|
14
14
|
src/tools/__init__.py,sha256=zBfAjFT51LvvD7WXTfDYiyJstRdphr2ChddAmGMZxkI,346
|
|
15
15
|
src/tools/batch_generate.py,sha256=tcilmaOWXMFnVBMdMbIUXxHtbpnBLeIkJe2LDXnE7qU,5200
|
|
16
|
-
src/tools/generate_image.py,sha256=
|
|
17
|
-
ultimate_gemini_mcp-1.0.
|
|
18
|
-
ultimate_gemini_mcp-1.0.
|
|
19
|
-
ultimate_gemini_mcp-1.0.
|
|
20
|
-
ultimate_gemini_mcp-1.0.
|
|
21
|
-
ultimate_gemini_mcp-1.0.
|
|
16
|
+
src/tools/generate_image.py,sha256=woTKSXUE12wX1vCQ3bMzLHduXgU7Z3hCvhoDekadzP0,9506
|
|
17
|
+
ultimate_gemini_mcp-1.0.3.dist-info/METADATA,sha256=LPy5QqjDXamsbIA6oWn2n3g3V1tCDSpVaam0alT5H-0,11646
|
|
18
|
+
ultimate_gemini_mcp-1.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
19
|
+
ultimate_gemini_mcp-1.0.3.dist-info/entry_points.txt,sha256=-BeRTT4oR05e-YnF1ZNbNxlaekD4LsWhD-Zy_1dyRnc,56
|
|
20
|
+
ultimate_gemini_mcp-1.0.3.dist-info/licenses/LICENSE,sha256=ilyzUnN0QHYtYGJks-NFUwiniNu08IedLmn_muRqa0o,1480
|
|
21
|
+
ultimate_gemini_mcp-1.0.3.dist-info/RECORD,,
|
|
File without changes
|
{ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{ultimate_gemini_mcp-1.0.2.dist-info → ultimate_gemini_mcp-1.0.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|