@jordyvd/openrouter-imagegen-mcp 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/dist/index.cjs +3 -26
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -62198,8 +62198,6 @@ Only make the specific change requested above. The output should be identical to
62198
62198
  }
62199
62199
  };
62200
62200
  const responseContent = [];
62201
- console.error(`[edit_image] Making API request to OpenRouter...`);
62202
- const apiStartTime = Date.now();
62203
62201
  const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
62204
62202
  method: "POST",
62205
62203
  headers: {
@@ -62208,13 +62206,11 @@ Only make the specific change requested above. The output should be identical to
62208
62206
  },
62209
62207
  body: JSON.stringify(requestBody)
62210
62208
  });
62211
- console.error(`[edit_image] API response status: ${response.status} (took ${Date.now() - apiStartTime}ms)`);
62212
62209
  if (!response.ok) {
62213
62210
  const errorText = await response.text();
62214
62211
  throw new Error(`API error: ${response.status} ${errorText}`);
62215
62212
  }
62216
62213
  const result = await response.json();
62217
- console.error(`[edit_image] API response parsed successfully`);
62218
62214
  const assistantMessage = result.choices[0]?.message;
62219
62215
  if (!assistantMessage) {
62220
62216
  throw new Error("No response from model");
@@ -62282,12 +62278,7 @@ Only make the specific change requested above. The output should be identical to
62282
62278
  if (textContent) {
62283
62279
  assistantContent.push({ type: "text", text: textContent });
62284
62280
  }
62285
- let processedImageCount = 0;
62286
62281
  for (const image of images) {
62287
- processedImageCount++;
62288
- console.error(`[edit_image] Processing image ${processedImageCount}/${images.length}`);
62289
- console.error(`[edit_image] Image object keys: ${Object.keys(image).join(", ")}`);
62290
- console.error(`[edit_image] Image object sample: ${JSON.stringify(image).substring(0, 300)}`);
62291
62282
  let imageData2 = null;
62292
62283
  if (image.imageUrl?.url) {
62293
62284
  imageData2 = await fetchImageAsBuffer(image.imageUrl.url);
@@ -62304,9 +62295,8 @@ Only make the specific change requested above. The output should be identical to
62304
62295
  if (imageData2) {
62305
62296
  const extension = imageData2.mimeType.split("/")[1] || "png";
62306
62297
  const filename = `${Date.now()}.${extension}`;
62307
- console.error(`[edit_image] Uploading image ${processedImageCount} to S3 (${(imageData2.buffer.length / 1024).toFixed(1)}KB)...`);
62308
62298
  const s3Url = await uploadImageToS3(imageData2.buffer, filename, imageData2.mimeType, convId);
62309
- console.error(`[edit_image] Image ${processedImageCount} uploaded to S3: ${s3Url}`);
62299
+ console.error(`Uploaded edited image to S3: ${s3Url} (${(imageData2.buffer.length / 1024).toFixed(1)}KB)`);
62310
62300
  responseContent.push({
62311
62301
  type: "text",
62312
62302
  text: `IMAGE_URL: ${s3Url}`
@@ -62315,12 +62305,8 @@ Only make the specific change requested above. The output should be identical to
62315
62305
  type: "image_url",
62316
62306
  image_url: { url: s3Url }
62317
62307
  });
62318
- console.error(`[edit_image] Image ${processedImageCount} added to response and conversation history`);
62319
- } else {
62320
- console.error(`[edit_image] WARNING: Image ${processedImageCount} could not be processed - imageData is null`);
62321
62308
  }
62322
62309
  }
62323
- console.error(`[edit_image] Finished processing ${images.length} images, responseContent has ${responseContent.length} items`);
62324
62310
  messages.push({
62325
62311
  role: "assistant",
62326
62312
  content: assistantContent.length > 0 ? assistantContent : textContent || ""
@@ -62331,13 +62317,10 @@ Only make the specific change requested above. The output should be identical to
62331
62317
  content: textContent || ""
62332
62318
  });
62333
62319
  }
62334
- console.error(`[edit_image] Saving conversation with ${messages.length} messages`);
62335
62320
  conversations.set(convId, messages);
62336
62321
  try {
62337
62322
  await saveConversationToS3(convId, messages);
62338
- console.error(`[edit_image] Conversation saved to S3 successfully`);
62339
- } catch (saveError) {
62340
- console.error(`[edit_image] Warning: Failed to save conversation to S3: ${saveError}`);
62323
+ } catch {
62341
62324
  }
62342
62325
  responseContent.push({
62343
62326
  type: "text",
@@ -62347,16 +62330,10 @@ Only make the specific change requested above. The output should be identical to
62347
62330
  Conversation ID: ${convId}
62348
62331
  Use edit_image with this ID to make more changes.`
62349
62332
  });
62350
- console.error(`[edit_image] Returning response with ${responseContent.length} content items`);
62351
- console.error(`[edit_image] Response content types: ${responseContent.map((c4) => c4.type).join(", ")}`);
62352
- const finalResponse = {
62333
+ return {
62353
62334
  content: responseContent
62354
62335
  };
62355
- console.error(`[edit_image] Final response: ${JSON.stringify(finalResponse).substring(0, 500)}`);
62356
- return finalResponse;
62357
62336
  } catch (error47) {
62358
- console.error(`[edit_image] CAUGHT ERROR: ${error47}`);
62359
- console.error(`[edit_image] Error stack: ${error47 instanceof Error ? error47.stack : "N/A"}`);
62360
62337
  const errorMessage = error47 instanceof Error ? error47.message : String(error47);
62361
62338
  return {
62362
62339
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jordyvd/openrouter-imagegen-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "MCP server for AI image generation via OpenRouter with S3 storage",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {