@fre4x/gemini 1.0.46 → 1.0.49
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.
- package/dist/index.js +28 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28926,8 +28926,9 @@ var require_dist3 = __commonJS({
|
|
|
28926
28926
|
|
|
28927
28927
|
// src/index.ts
|
|
28928
28928
|
import * as fs3 from "node:fs/promises";
|
|
28929
|
+
import { realpathSync } from "node:fs";
|
|
28929
28930
|
import * as path2 from "node:path";
|
|
28930
|
-
import { fileURLToPath
|
|
28931
|
+
import { fileURLToPath } from "node:url";
|
|
28931
28932
|
|
|
28932
28933
|
// ../node_modules/@google/genai/dist/node/index.mjs
|
|
28933
28934
|
var import_p_retry = __toESM(require_p_retry(), 1);
|
|
@@ -67479,7 +67480,6 @@ var StdioServerTransport = class {
|
|
|
67479
67480
|
// src/index.ts
|
|
67480
67481
|
var z3 = external_exports || zod_default || zod_exports;
|
|
67481
67482
|
var IS_MOCK = process.env.GEMINI_MOCK === "true" || process.env.MOCK === "true";
|
|
67482
|
-
var API_KEY = process.env.GEMINI_API_KEY;
|
|
67483
67483
|
var DEFAULT_TEXT_MODEL = "gemini-2.5-flash";
|
|
67484
67484
|
var DEFAULT_IMAGE_MODEL = "imagen-4.0-generate-001";
|
|
67485
67485
|
var DEFAULT_VIDEO_MODEL = "veo-2.0-generate-001";
|
|
@@ -67502,17 +67502,25 @@ var ALLOWED_MEDIA_MIME_TYPES = /* @__PURE__ */ new Set([
|
|
|
67502
67502
|
"video/quicktime",
|
|
67503
67503
|
"application/pdf"
|
|
67504
67504
|
]);
|
|
67505
|
-
|
|
67506
|
-
|
|
67507
|
-
process.
|
|
67505
|
+
var ai = null;
|
|
67506
|
+
function getApiKey() {
|
|
67507
|
+
const apiKey = process.env.GEMINI_API_KEY;
|
|
67508
|
+
if (!apiKey) {
|
|
67509
|
+
throw new Error(
|
|
67510
|
+
"GEMINI_API_KEY environment variable is required. Set GEMINI_MOCK=true or MOCK=true to run without a key."
|
|
67511
|
+
);
|
|
67512
|
+
}
|
|
67513
|
+
return apiKey;
|
|
67508
67514
|
}
|
|
67509
|
-
var ai = IS_MOCK ? null : new GoogleGenAI({ apiKey: API_KEY });
|
|
67510
67515
|
function getAi() {
|
|
67511
|
-
if (
|
|
67516
|
+
if (IS_MOCK) {
|
|
67512
67517
|
throw new Error(
|
|
67513
67518
|
"AI SDK not initialized. Ensure GEMINI_API_KEY is set and MOCK mode is off."
|
|
67514
67519
|
);
|
|
67515
67520
|
}
|
|
67521
|
+
if (!ai) {
|
|
67522
|
+
ai = new GoogleGenAI({ apiKey: getApiKey() });
|
|
67523
|
+
}
|
|
67516
67524
|
return ai;
|
|
67517
67525
|
}
|
|
67518
67526
|
var FILE_EXT_TO_MIME = {
|
|
@@ -67828,7 +67836,7 @@ async function listModels(rawArgs) {
|
|
|
67828
67836
|
return textResult(lines2.join("\n").trim());
|
|
67829
67837
|
}
|
|
67830
67838
|
const resp = await fetch(
|
|
67831
|
-
`https://generativelanguage.googleapis.com/v1beta/models?key=${
|
|
67839
|
+
`https://generativelanguage.googleapis.com/v1beta/models?key=${getApiKey()}&pageSize=200`
|
|
67832
67840
|
);
|
|
67833
67841
|
if (!resp.ok) {
|
|
67834
67842
|
throw new Error(
|
|
@@ -68110,8 +68118,18 @@ async function runServer() {
|
|
|
68110
68118
|
await server.connect(transport);
|
|
68111
68119
|
console.error("Gemini MCP Server running on stdio");
|
|
68112
68120
|
}
|
|
68113
|
-
|
|
68114
|
-
if (
|
|
68121
|
+
function isMainModule(url2) {
|
|
68122
|
+
if (!process.argv[1]) return false;
|
|
68123
|
+
try {
|
|
68124
|
+
const scriptPath = fileURLToPath(url2);
|
|
68125
|
+
const realScriptPath = realpathSync(scriptPath);
|
|
68126
|
+
const realArgvPath = realpathSync(process.argv[1]);
|
|
68127
|
+
return realScriptPath === realArgvPath;
|
|
68128
|
+
} catch {
|
|
68129
|
+
return false;
|
|
68130
|
+
}
|
|
68131
|
+
}
|
|
68132
|
+
if (isMainModule(import.meta.url)) {
|
|
68115
68133
|
runServer().catch((error48) => {
|
|
68116
68134
|
console.error("Fatal error in main():", error48);
|
|
68117
68135
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fre4x/gemini",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.49",
|
|
4
4
|
"description": "A Gemini MCP server providing multimodal analysis and image/video generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"start": "node dist/index.js",
|
|
17
17
|
"dev": "tsx src/index.ts",
|
|
18
18
|
"watch": "tsc -w",
|
|
19
|
-
"inspector": "
|
|
20
|
-
"inspector:published": "cross-env GEMINI_MOCK=true
|
|
19
|
+
"inspector": "node ../scripts/run-official-inspector.mjs node dist/index.js",
|
|
20
|
+
"inspector:published": "cross-env GEMINI_MOCK=true node ../scripts/run-official-inspector.mjs npx @fre4x/gemini",
|
|
21
21
|
"test": "vitest run --exclude dist"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|