Skip to content

Commit 6498564

Browse files
committed
✨ feat: Update changelog and documentation for image-to-image query improvements
🔧 fix: Adjust image query handling to support multiple references correctly 📄 docs: Clarify image URL requirements in README and schemas 🔄 chore: Bump version to 1.3.1 in package files
1 parent 64bff05 commit 6498564

File tree

7 files changed

+32
-15
lines changed

7 files changed

+32
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
217217

218218
### Notes
219219
- Model behavior details for `kontext`, `nanobanana`, and `seedream` are documented in `new_models_integration.md`. `kontext` uses only the first reference; `nanobanana` is safe up to ~4 refs; `seedream` up to 10.
220+
## [1.3.1] - `2025-09-26`
221+
222+
### Fixed
223+
- Image-to-image query construction for kontext, nanobanana, and seedream:
224+
- Now sends multiple reference images as repeated `image` parameters instead of a single comma-encoded string. This matches the API examples and fixes 400/403 errors some users saw when passing multiple references.
225+
- Continues to accept a single URL or a comma-separated string; comma strings are split and sent as repeated params.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ Perfect for creating variations and new styles:
303303

304304
Multi-reference images: `editImage` and `generateImageFromReference` accept `imageUrl` as a single URL or an array of URLs. The server encodes arrays as the comma-separated `image` parameter used by the API. Ordering matters; kontext uses only the first image, nanobanana is safe up to ~4 refs, and seedream supports up to 10.
305305

306+
Important: URLs only. The image-to-image tools require publicly accessible HTTP(S) URLs. Local file paths, file uploads, and base64/data URLs are not supported by this MCP server (it does not upload files). If you need to work from a local image, host it somewhere accessible (e.g., a temporary file host, object storage, or a raw link in a repo) and pass the URL.
307+
306308
### **Example Usage**
307309
```javascript
308310
// Edit an existing image

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
33
"name": "@pinkpixel/mcpollinations",
4-
"version": "1.3.0",
4+
"version": "1.3.1",
55
"description": "Model Context Protocol (MCP) server for the Pollinations APIs with image saving functionality.",
66
"license": "MIT",
77
"type": "module",

pollinations-mcp-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ log('Default params:', {
177177
const server = new Server(
178178
{
179179
name: '@pinkpixel/mcpollinations',
180-
version: '1.3.0',
180+
version: '1.3.1',
181181
},
182182
{
183183
capabilities: {

src/services/imageSchema.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const editImageSchema = {
128128
{ type: 'string' },
129129
{ type: 'array', items: { type: 'string' } }
130130
],
131-
description: 'URL of the input image to edit. Accepts a string or an array for multiple references (first is most important).'
131+
description: 'Public HTTP(S) URL(s) of the input image(s) to edit. Accepts a string or an array for multiple references (first is most important). Local file paths, file uploads, or base64/data URLs are not supported.'
132132
},
133133
model: {
134134
type: 'string',
@@ -189,7 +189,7 @@ export const generateImageFromReferenceSchema = {
189189
{ type: 'string' },
190190
{ type: 'array', items: { type: 'string' } }
191191
],
192-
description: 'URL(s) of reference images. Accepts a string or an array for multi-reference (comma-joined).'
192+
description: 'Public HTTP(S) URL(s) of reference images. Accepts a string or an array for multi-reference. Local file paths, file uploads, or base64/data URLs are not supported.'
193193
},
194194
model: {
195195
type: 'string',

src/services/imageService.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,20 @@ export async function editImage(prompt, imageUrl, model = 'kontext', seed = Math
224224
throw new Error('Image URL(s) are required and must be a string or array of strings');
225225
}
226226

227-
// Support multi-reference images using comma-separated encoding expected by API
228-
const imageParam = Array.isArray(imageUrl)
229-
? imageUrl.filter(Boolean).join(',')
230-
: imageUrl;
227+
// Support multi-reference images. Prefer repeating the `image` param per URL
228+
// to avoid comma-encoding ambiguities.
229+
const imageList = Array.isArray(imageUrl)
230+
? imageUrl.filter(Boolean)
231+
: (typeof imageUrl === 'string' && imageUrl.includes(','))
232+
? imageUrl.split(',').map(s => s.trim()).filter(Boolean)
233+
: [imageUrl];
231234

232235
// Build the query parameters
233236
const queryParams = new URLSearchParams();
234237
queryParams.append('model', model);
235-
queryParams.append('image', imageParam); // Add one or more input image URLs
238+
for (const u of imageList) {
239+
queryParams.append('image', u);
240+
}
236241
if (seed !== undefined) queryParams.append('seed', seed);
237242
if (width !== 1024) queryParams.append('width', width);
238243
if (height !== 1024) queryParams.append('height', height);
@@ -378,14 +383,18 @@ export async function generateImageFromReference(prompt, imageUrl, model = 'kont
378383
throw new Error('Reference image URL(s) are required and must be a string or array of strings');
379384
}
380385

381-
const imageParam = Array.isArray(imageUrl)
382-
? imageUrl.filter(Boolean).join(',')
383-
: imageUrl;
386+
const imageList = Array.isArray(imageUrl)
387+
? imageUrl.filter(Boolean)
388+
: (typeof imageUrl === 'string' && imageUrl.includes(','))
389+
? imageUrl.split(',').map(s => s.trim()).filter(Boolean)
390+
: [imageUrl];
384391

385392
// Build the query parameters
386393
const queryParams = new URLSearchParams();
387394
queryParams.append('model', model);
388-
queryParams.append('image', imageParam); // Add one or more reference image URLs
395+
for (const u of imageList) {
396+
queryParams.append('image', u);
397+
}
389398
if (seed !== undefined) queryParams.append('seed', seed);
390399
if (width !== 1024) queryParams.append('width', width);
391400
if (height !== 1024) queryParams.append('height', height);

0 commit comments

Comments
 (0)