@chrischall/gemini-mcp 1.5.0 → 1.5.1

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.
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "metadata": {
9
9
  "description": "MCP server for Google Gemini image generation and editing — generate and edit images via the Gemini API",
10
- "version": "1.5.0"
10
+ "version": "1.5.1"
11
11
  },
12
12
  "plugins": [
13
13
  {
@@ -15,7 +15,7 @@
15
15
  "displayName": "Gemini Images",
16
16
  "source": "./",
17
17
  "description": "Generate and edit images with Google Gemini image models (Nano Banana / Nano Banana Pro) via natural language prompts",
18
- "version": "1.5.0",
18
+ "version": "1.5.1",
19
19
  "author": {
20
20
  "name": "Chris Hall"
21
21
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gemini-mcp",
3
3
  "displayName": "Gemini Images",
4
- "version": "1.5.0",
4
+ "version": "1.5.1",
5
5
  "description": "MCP server for Google Gemini image generation and editing — generate and edit images via the Gemini API",
6
6
  "author": {
7
7
  "name": "Chris Hall",
package/dist/bundle.js CHANGED
@@ -32805,7 +32805,7 @@ async function loadStdioDotenv() {
32805
32805
  }
32806
32806
 
32807
32807
  // src/version.ts
32808
- var VERSION = "1.5.0";
32808
+ var VERSION = "1.5.1";
32809
32809
 
32810
32810
  // src/tools/models.ts
32811
32811
  init_dist();
@@ -34374,7 +34374,7 @@ var GeminiClient = class {
34374
34374
  this.uploadUrls = opts.uploadUrls;
34375
34375
  this.session.jobs.resigner = this.mediaSink;
34376
34376
  this.explicitApiKey = opts.apiKey?.trim() || void 0;
34377
- this.fetchImpl = opts.fetchImpl ?? fetch;
34377
+ this.fetchImpl = opts.fetchImpl ?? ((...args) => fetch(...args));
34378
34378
  this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
34379
34379
  }
34380
34380
  /**
@@ -34543,8 +34543,9 @@ var GeminiClient = class {
34543
34543
  */
34544
34544
  async uploadToFilesApi(body, mimeType, displayName, contentLength) {
34545
34545
  const key = this.requireKey();
34546
+ const doFetch = this.fetchImpl;
34546
34547
  const startPath = "/files";
34547
- const startRes = await this.fetchImpl(`${UPLOAD_BASE_URL}${startPath}`, {
34548
+ const startRes = await doFetch(`${UPLOAD_BASE_URL}${startPath}`, {
34548
34549
  method: "POST",
34549
34550
  headers: {
34550
34551
  "x-goog-api-key": key,
@@ -34568,7 +34569,7 @@ var GeminiClient = class {
34568
34569
  });
34569
34570
  }
34570
34571
  const streaming = !(body instanceof Blob);
34571
- const upRes = await this.fetchImpl(uploadUrl, {
34572
+ const upRes = await doFetch(uploadUrl, {
34572
34573
  method: "POST",
34573
34574
  headers: {
34574
34575
  "X-Goog-Upload-Offset": "0",
package/dist/client.js CHANGED
@@ -165,7 +165,18 @@ export class GeminiClient {
165
165
  // the job registry needs a way to re-sign from the stable r2_key.
166
166
  this.session.jobs.resigner = this.mediaSink;
167
167
  this.explicitApiKey = opts.apiKey?.trim() || undefined;
168
- this.fetchImpl = opts.fetchImpl ?? fetch;
168
+ // Never store the global `fetch` raw on the instance: it would be invoked
169
+ // as `this.fetchImpl(...)`, handing native fetch this GeminiClient as its
170
+ // receiver — workerd rejects any non-global receiver with "Illegal
171
+ // invocation: function called with incorrect 'this' reference", while
172
+ // Node's fetch does not care, so only production could see the crash
173
+ // (it did: every hosted generation whose reference image took the >6MB
174
+ // Files-API promotion). The arrow pins the receiver to the global scope.
175
+ // An INJECTED impl is stored as-is, so tests can emulate workerd's
176
+ // receiver check and catch any `this.fetchImpl(...)` call site — which is
177
+ // also why call sites must alias it to a local before calling (see
178
+ // uploadToFilesApi). Guarded by tests/tools/hosted-reference-forms.test.ts.
179
+ this.fetchImpl = opts.fetchImpl ?? ((...args) => fetch(...args));
169
180
  this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
170
181
  }
171
182
  /**
@@ -343,9 +354,13 @@ export class GeminiClient {
343
354
  */
344
355
  async uploadToFilesApi(body, mimeType, displayName, contentLength) {
345
356
  const key = this.requireKey();
357
+ // Local alias so the calls below carry NO receiver: `this.fetchImpl(...)`
358
+ // would hand native fetch this GeminiClient as `this`, which workerd
359
+ // rejects with an Illegal invocation (see the constructor note).
360
+ const doFetch = this.fetchImpl;
346
361
  // 1. start — establish the resumable upload session
347
362
  const startPath = '/files';
348
- const startRes = await this.fetchImpl(`${UPLOAD_BASE_URL}${startPath}`, {
363
+ const startRes = await doFetch(`${UPLOAD_BASE_URL}${startPath}`, {
349
364
  method: 'POST',
350
365
  headers: {
351
366
  'x-goog-api-key': key,
@@ -375,7 +390,7 @@ export class GeminiClient {
375
390
  // falls back to chunked encoding, which the resumable protocol does not
376
391
  // accept (this half is docs-derived; see docs/GEMINI-API.md).
377
392
  const streaming = !(body instanceof Blob);
378
- const upRes = await this.fetchImpl(uploadUrl, {
393
+ const upRes = await doFetch(uploadUrl, {
379
394
  method: 'POST',
380
395
  headers: {
381
396
  'X-Goog-Upload-Offset': '0',
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Single source of the server version. release-please bumps the literal below. */
2
- export const VERSION = '1.5.0'; // x-release-please-version
2
+ export const VERSION = '1.5.1'; // x-release-please-version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrischall/gemini-mcp",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "mcpName": "io.github.chrischall/gemini-mcp",
5
5
  "description": "Gemini image-generation MCP server for Claude — developed and maintained by AI (Claude Code)",
6
6
  "author": "Claude Code (AI) <https://www.anthropic.com/claude>",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/chrischall/gemini-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.5.0",
9
+ "version": "1.5.1",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/gemini-mcp",
14
- "version": "1.5.0",
14
+ "version": "1.5.1",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },