@fre4x/gemini 1.0.51 → 1.0.53

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.js +70 -32
  2. package/package.json +7 -8
package/dist/index.js CHANGED
@@ -60267,6 +60267,14 @@ var paginationSchema = z2.object({
60267
60267
  offset: z2.number().int().min(0).default(0).describe("Number of results to skip for pagination (default 0)")
60268
60268
  });
60269
60269
 
60270
+ // ../packages/shared/dist/package.js
60271
+ import { createRequire as createJsonRequire } from "node:module";
60272
+ function getPackageVersion(moduleUrl) {
60273
+ const require2 = createJsonRequire(moduleUrl);
60274
+ const packageJson = require2("../package.json");
60275
+ return packageJson.version ?? "0.0.0";
60276
+ }
60277
+
60270
60278
  // ../node_modules/zod/v3/helpers/util.js
60271
60279
  var util;
60272
60280
  (function(util2) {
@@ -67480,6 +67488,7 @@ var StdioServerTransport = class {
67480
67488
  // src/index.ts
67481
67489
  var z3 = external_exports || zod_default || zod_exports;
67482
67490
  var IS_MOCK = process.env.GEMINI_MOCK === "true" || process.env.MOCK === "true";
67491
+ var PACKAGE_VERSION = getPackageVersion(import.meta.url);
67483
67492
  var DEFAULT_TEXT_MODEL = "gemini-2.5-flash";
67484
67493
  var DEFAULT_IMAGE_MODEL = "imagen-4.0-generate-001";
67485
67494
  var DEFAULT_VIDEO_MODEL = "veo-2.0-generate-001";
@@ -67689,7 +67698,7 @@ var TOOL_DEFINITIONS = [
67689
67698
  GET_VIDEO_STATUS_TOOL
67690
67699
  ];
67691
67700
  var server = new Server(
67692
- { name: "gemini-mcp", version: "1.0.0" },
67701
+ { name: "gemini-mcp", version: PACKAGE_VERSION },
67693
67702
  { capabilities: { tools: {} } }
67694
67703
  );
67695
67704
  function inferMimeTypeFromSource(source) {
@@ -67823,15 +67832,23 @@ Mock response \u2014 no API call made.`;
67823
67832
  responseText = response.text || "No analysis generated.";
67824
67833
  }
67825
67834
  if (output_dir) {
67826
- const fname = `analysis-${Date.now()}.txt`;
67827
- const fpath = path2.join(output_dir, fname);
67828
- await fs3.mkdir(output_dir, { recursive: true });
67829
- await fs3.writeFile(fpath, responseText);
67830
- return textResult(
67831
- `${responseText}
67835
+ try {
67836
+ const fname = `analysis-${Date.now()}.txt`;
67837
+ const fpath = path2.join(output_dir, fname);
67838
+ await fs3.mkdir(output_dir, { recursive: true });
67839
+ await fs3.writeFile(fpath, responseText);
67840
+ return textResult(
67841
+ `${responseText}
67832
67842
 
67833
67843
  \u2705 Analysis result saved to: ${fpath}`
67834
- );
67844
+ );
67845
+ } catch (error48) {
67846
+ return textResult(
67847
+ `${responseText}
67848
+
67849
+ \u26A0\uFE0F Failed to save analysis result: ${error48.message}`
67850
+ );
67851
+ }
67835
67852
  }
67836
67853
  return textResult(responseText);
67837
67854
  }
@@ -67918,14 +67935,21 @@ async function generateImage(rawArgs) {
67918
67935
  { type: "image", data: mockBase64, mimeType: "image/png" }
67919
67936
  ];
67920
67937
  if (output_dir) {
67921
- const fname = `image-${Date.now()}.png`;
67922
- const fpath = path2.join(output_dir, fname);
67923
- await fs3.mkdir(output_dir, { recursive: true });
67924
- await fs3.writeFile(fpath, Buffer.from(mockBase64, "base64"));
67925
- content2.push({
67926
- type: "text",
67927
- text: `[Mock] Saved to: ${fpath}`
67928
- });
67938
+ try {
67939
+ const fname = `image-${Date.now()}.png`;
67940
+ const fpath = path2.join(output_dir, fname);
67941
+ await fs3.mkdir(output_dir, { recursive: true });
67942
+ await fs3.writeFile(fpath, Buffer.from(mockBase64, "base64"));
67943
+ content2.push({
67944
+ type: "text",
67945
+ text: `[Mock] Saved to: ${fpath}`
67946
+ });
67947
+ } catch (error48) {
67948
+ content2.push({
67949
+ type: "text",
67950
+ text: `\u26A0\uFE0F [Mock] Failed to save image: ${error48.message}`
67951
+ });
67952
+ }
67929
67953
  }
67930
67954
  return { content: content2 };
67931
67955
  }
@@ -67956,24 +67980,31 @@ Check Imagen access at https://ai.google.dev/`
67956
67980
  };
67957
67981
  }
67958
67982
  const savedPaths = [];
67983
+ let saveErrorText = "";
67959
67984
  if (output_dir) {
67960
- await fs3.mkdir(output_dir, { recursive: true });
67961
- const paths = await Promise.all(
67962
- images.map(async (img, index) => {
67963
- const fname = `image-${Date.now()}-${index + 1}.png`;
67964
- const fpath = path2.join(output_dir, fname);
67965
- await fs3.writeFile(fpath, Buffer.from(img.data, "base64"));
67966
- return fpath;
67967
- })
67968
- );
67969
- savedPaths.push(...paths);
67985
+ try {
67986
+ await fs3.mkdir(output_dir, { recursive: true });
67987
+ const paths = await Promise.all(
67988
+ images.map(async (img, index) => {
67989
+ const fname = `image-${Date.now()}-${index + 1}.png`;
67990
+ const fpath = path2.join(output_dir, fname);
67991
+ await fs3.writeFile(fpath, Buffer.from(img.data, "base64"));
67992
+ return fpath;
67993
+ })
67994
+ );
67995
+ savedPaths.push(...paths);
67996
+ } catch (error48) {
67997
+ saveErrorText = `
67998
+
67999
+ \u26A0\uFE0F Failed to save images: ${error48.message}`;
68000
+ }
67970
68001
  }
67971
68002
  const content = [
67972
68003
  {
67973
68004
  type: "text",
67974
68005
  text: `\u2705 Image generated successfully (${images.length} image${images.length > 1 ? "s" : ""}, prompt: "${prompt}").${savedPaths.length > 0 ? `
67975
68006
  Saved to:
67976
- ${savedPaths.join("\n")}` : ""}`
68007
+ ${savedPaths.join("\n")}` : ""}${saveErrorText}`
67977
68008
  },
67978
68009
  ...images
67979
68010
  ];
@@ -68103,11 +68134,15 @@ ${JSON.stringify(op.response, null, 2)}`
68103
68134
  }
68104
68135
  });
68105
68136
  if (output_dir) {
68106
- const fname = `video-${Date.now()}-${index + 1}.mp4`;
68107
- const fpath = path2.join(output_dir, fname);
68108
- await fs3.mkdir(output_dir, { recursive: true });
68109
- await fs3.writeFile(fpath, buffer);
68110
- savedPaths.push(fpath);
68137
+ try {
68138
+ const fname = `video-${Date.now()}-${index + 1}.mp4`;
68139
+ const fpath = path2.join(output_dir, fname);
68140
+ await fs3.mkdir(output_dir, { recursive: true });
68141
+ await fs3.writeFile(fpath, buffer);
68142
+ savedPaths.push(fpath);
68143
+ } catch (error48) {
68144
+ console.error(`Failed to save video: ${error48.message}`);
68145
+ }
68111
68146
  }
68112
68147
  })
68113
68148
  );
@@ -68121,6 +68156,9 @@ ${videos.join("\n")}`
68121
68156
  lines.push(`
68122
68157
  Saved to:
68123
68158
  ${savedPaths.join("\n")}`);
68159
+ } else if (output_dir) {
68160
+ lines.push(`
68161
+ \u26A0\uFE0F Failed to save videos to disk.`);
68124
68162
  }
68125
68163
  return {
68126
68164
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/gemini",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "A Gemini MCP server providing multimodal analysis and image/video generation.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "dist"
12
12
  ],
13
13
  "scripts": {
14
- "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && npx esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\" && node -e \"const fs=require('fs');const p='dist/index.js';const c=fs.readFileSync(p,'utf8');const next=c.startsWith('#!/usr/bin/env node')?c:'#!/usr/bin/env node\\n'+c;fs.writeFileSync(p,next);fs.chmodSync(p,0o755);\"",
14
+ "build": "node ../scripts/build-package.mjs",
15
15
  "typecheck": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsc --noEmit",
16
16
  "start": "node dist/index.js",
17
17
  "dev": "tsx src/index.ts",
@@ -36,17 +36,16 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@google/genai": "^1.44.0",
39
- "@google/generative-ai": "^0.21.0",
40
- "@modelcontextprotocol/sdk": "^1.26.0",
39
+ "@modelcontextprotocol/sdk": "^1.27.1",
41
40
  "p-limit": "^6.1.0",
42
- "zod": "^4.0.0"
41
+ "zod": "^4.3.6"
43
42
  },
44
43
  "devDependencies": {
45
44
  "@modelcontextprotocol/inspector": "^0.21.0",
46
- "@types/node": "^22.13.5",
45
+ "@types/node": "^25.3.5",
47
46
  "cross-env": "^7.0.3",
48
- "tsx": "^4.19.3",
49
- "typescript": "^5.7.3",
47
+ "tsx": "^4.21.0",
48
+ "typescript": "^5.9.3",
50
49
  "vitest": "^4.0.18"
51
50
  }
52
51
  }