@fre4x/gemini 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 fritzprix
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # gemini — The Intelligence Bridge
2
+
3
+ > *The agent that can see, hear, and imagine is the agent that cannot be outmaneuvered.*
4
+
5
+ Part of **[FRE4X-B1TE](../)** — a monorepo of MCP servers built for autonomous agents.
6
+
7
+ Google's Gemini is not a chatbot. It is a multimodal reasoning engine. This B1TE bridges your agent directly to that engine — text, images, video, audio — so it can perceive the world as humans do, and then outthink it.
8
+
9
+ ## Tools
10
+
11
+ | Tool | Capability |
12
+ |------|-----------|
13
+ | `generate_text` | Text generation and reasoning via Gemini models (e.g. `gemini-2.0-flash`) |
14
+ | `analyze_media` | Multimodal analysis — image, video, audio — from URL + MIME type |
15
+ | `generate_image` | High-quality image synthesis via Imagen 3.0 / 4.0 |
16
+ | `generate_video` | Asynchronous video generation via Veo |
17
+
18
+ ## Requirements
19
+
20
+ A [Google AI Studio API key](https://aistudio.google.com/) — set as `GEMINI_API_KEY`.
21
+
22
+ ## Deploy
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "gemini": {
28
+ "command": "npx",
29
+ "args": ["-y", "@fre4x/gemini"],
30
+ "env": {
31
+ "GEMINI_API_KEY": "your_api_key_here"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Development
39
+
40
+ ```bash
41
+ bun install
42
+ bun run dev # tsx, no build
43
+ bun run build # compile → dist/
44
+ ```
45
+
46
+ ## License
47
+
48
+ MIT — **WE ARE THE FRE4X.**
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { GoogleGenAI } from "@google/genai";
6
+ import { z } from "zod";
7
+ const API_KEY = process.env.GEMINI_API_KEY;
8
+ if (!API_KEY) {
9
+ console.error("GEMINI_API_KEY environment variable is required");
10
+ process.exit(1);
11
+ }
12
+ const ai = new GoogleGenAI({ apiKey: API_KEY });
13
+ const GENERATE_TEXT_TOOL = {
14
+ name: "generate_text",
15
+ description: "Generate text response from a prompt using Gemini",
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ prompt: {
20
+ type: "string",
21
+ description: "The text prompt to generate content from",
22
+ },
23
+ model: {
24
+ type: "string",
25
+ description: "Gemini model to use (default: gemini-2.0-flash)",
26
+ default: "gemini-2.0-flash",
27
+ },
28
+ },
29
+ required: ["prompt"],
30
+ },
31
+ };
32
+ const ANALYZE_MEDIA_TOOL = {
33
+ name: "analyze_media",
34
+ description: "Analyze image, video, or audio files using Gemini",
35
+ inputSchema: {
36
+ type: "object",
37
+ properties: {
38
+ prompt: {
39
+ type: "string",
40
+ description: "Question or instruction about the media",
41
+ },
42
+ media_url: {
43
+ type: "string",
44
+ description: "URL of the media file (image, video, or audio)",
45
+ },
46
+ mime_type: {
47
+ type: "string",
48
+ description: "MIME type of the media file",
49
+ },
50
+ model: {
51
+ type: "string",
52
+ description: "Gemini model to use (default: gemini-2.0-flash)",
53
+ default: "gemini-2.0-flash",
54
+ },
55
+ },
56
+ required: ["prompt", "media_url", "mime_type"],
57
+ },
58
+ };
59
+ const GENERATE_IMAGE_TOOL = {
60
+ name: "generate_image",
61
+ description: "Generate an image using Imagen 4.0",
62
+ inputSchema: {
63
+ type: "object",
64
+ properties: {
65
+ prompt: {
66
+ type: "string",
67
+ description: "Description of the image to generate",
68
+ },
69
+ aspect_ratio: {
70
+ type: "string",
71
+ description: "Aspect ratio of the generated image (e.g., 1:1, 16:9, 4:3, 9:16)",
72
+ default: "1:1",
73
+ },
74
+ model: {
75
+ type: "string",
76
+ description: "Imagen model to use (default: imagen-3.0-generate-001)",
77
+ default: "imagen-3.0-generate-001",
78
+ },
79
+ },
80
+ required: ["prompt"],
81
+ },
82
+ };
83
+ const GENERATE_VIDEO_TOOL = {
84
+ name: "generate_video",
85
+ description: "Generate a video using Veo",
86
+ inputSchema: {
87
+ type: "object",
88
+ properties: {
89
+ prompt: {
90
+ type: "string",
91
+ description: "Description of the video to generate",
92
+ },
93
+ model: {
94
+ type: "string",
95
+ description: "Veo model to use (default: veo-2.0-generate-001)",
96
+ default: "veo-2.0-generate-001",
97
+ },
98
+ },
99
+ required: ["prompt"],
100
+ },
101
+ };
102
+ const server = new Server({
103
+ name: "gemini-mcp",
104
+ version: "1.0.0",
105
+ }, {
106
+ capabilities: {
107
+ tools: {},
108
+ },
109
+ });
110
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
111
+ tools: [
112
+ GENERATE_TEXT_TOOL,
113
+ ANALYZE_MEDIA_TOOL,
114
+ GENERATE_IMAGE_TOOL,
115
+ GENERATE_VIDEO_TOOL,
116
+ ],
117
+ }));
118
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
119
+ const { name, arguments: args } = request.params;
120
+ try {
121
+ if (name === "generate_text") {
122
+ const { prompt, model = "gemini-2.0-flash" } = z
123
+ .object({
124
+ prompt: z.string(),
125
+ model: z.string().optional(),
126
+ })
127
+ .parse(args);
128
+ const response = await ai.models.generateContent({
129
+ model,
130
+ contents: prompt,
131
+ });
132
+ return {
133
+ content: [
134
+ {
135
+ type: "text",
136
+ text: response.text || "No response generated.",
137
+ },
138
+ ],
139
+ };
140
+ }
141
+ if (name === "analyze_media") {
142
+ const { prompt, media_url, mime_type, model = "gemini-2.0-flash" } = z
143
+ .object({
144
+ prompt: z.string(),
145
+ media_url: z.string(),
146
+ mime_type: z.string(),
147
+ model: z.string().optional(),
148
+ })
149
+ .parse(args);
150
+ // Fetch the media file
151
+ const mediaResponse = await fetch(media_url);
152
+ const mediaBuffer = await mediaResponse.arrayBuffer();
153
+ const base64Data = Buffer.from(mediaBuffer).toString("base64");
154
+ const response = await ai.models.generateContent({
155
+ model,
156
+ contents: [
157
+ {
158
+ role: "user",
159
+ parts: [
160
+ { text: prompt },
161
+ {
162
+ inlineData: {
163
+ data: base64Data,
164
+ mimeType: mime_type,
165
+ },
166
+ },
167
+ ],
168
+ },
169
+ ],
170
+ });
171
+ return {
172
+ content: [
173
+ {
174
+ type: "text",
175
+ text: response.text || "No analysis generated.",
176
+ },
177
+ ],
178
+ };
179
+ }
180
+ if (name === "generate_image") {
181
+ const { prompt, aspect_ratio = "1:1", model = "imagen-3.0-generate-001" } = z
182
+ .object({
183
+ prompt: z.string(),
184
+ aspect_ratio: z.string().optional(),
185
+ model: z.string().optional(),
186
+ })
187
+ .parse(args);
188
+ // Note: Imagen 4.0 was mentioned in search but imagen-3.0 is more widely available as of now.
189
+ // Using the models.generateImages API
190
+ const response = await ai.models.generateImages({
191
+ model,
192
+ prompt,
193
+ config: {
194
+ aspectRatio: aspect_ratio,
195
+ },
196
+ });
197
+ const images = response.generatedImages.map((img) => ({
198
+ type: "image",
199
+ data: img.image.imageBytes.toString("base64"),
200
+ mimeType: "image/png",
201
+ }));
202
+ return {
203
+ content: images,
204
+ };
205
+ }
206
+ if (name === "generate_video") {
207
+ const { prompt, model = "veo-2.0-generate-001" } = z
208
+ .object({
209
+ prompt: z.string(),
210
+ model: z.string().optional(),
211
+ })
212
+ .parse(args);
213
+ // Veo uses an operation pattern
214
+ const operation = await ai.models.generateVideos({
215
+ model,
216
+ prompt,
217
+ });
218
+ // For simplicity in this MCP tool, we might want to wait or return the operation ID.
219
+ // But usually MCP tools are expected to return the final result.
220
+ // Given video generation can take minutes, it might be better to return a status/URL if possible.
221
+ // However, for a high-quality prototype, let's try to wait if it's reasonable or return metadata.
222
+ return {
223
+ content: [
224
+ {
225
+ type: "text",
226
+ text: `Video generation started. Operation ID: ${operation.name}. Note: Video generation is asynchronous and may take some time.`,
227
+ },
228
+ ],
229
+ };
230
+ }
231
+ throw new Error(`Tool not found: ${name}`);
232
+ }
233
+ catch (error) {
234
+ if (error instanceof z.ZodError) {
235
+ throw new Error(`Invalid arguments: ${error.issues
236
+ .map((e) => `${e.path.join(".")}: ${e.message}`)
237
+ .join(", ")}`);
238
+ }
239
+ throw error;
240
+ }
241
+ });
242
+ async function run() {
243
+ const transport = new StdioServerTransport();
244
+ await server.connect(transport);
245
+ console.error("Gemini MCP Server running on stdio");
246
+ }
247
+ run().catch((error) => {
248
+ console.error("Fatal error in main():", error);
249
+ process.exit(1);
250
+ });
251
+ //# sourceMappingURL=index.js.map
@@ -0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AC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,sBAAsB,KAAK,CAAC,MAAM;iBAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;iBAC/C,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACtD,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ import { describe, it, expect, vi } from 'vitest';
2
+ import { GoogleGenAI } from "@google/genai";
3
+ // Mocking the SDK using a class
4
+ vi.mock('@google/genai', () => {
5
+ class MockGoogleGenAI {
6
+ models = {
7
+ generateContent: vi.fn().mockResolvedValue({
8
+ text: 'Hello, this is a mock response'
9
+ }),
10
+ generateImages: vi.fn().mockResolvedValue({
11
+ generatedImages: [
12
+ {
13
+ image: {
14
+ imageBytes: Buffer.from('mock-image-bytes')
15
+ }
16
+ }
17
+ ]
18
+ }),
19
+ generateVideos: vi.fn().mockResolvedValue({
20
+ name: 'mock-operation-id'
21
+ })
22
+ };
23
+ constructor(config) { }
24
+ }
25
+ return { GoogleGenAI: MockGoogleGenAI };
26
+ });
27
+ describe('Gemini MCP Server Regression Tests', () => {
28
+ it('should have GoogleGenAI initialized', () => {
29
+ const ai = new GoogleGenAI({ apiKey: 'test-key' });
30
+ expect(ai).toBeDefined();
31
+ });
32
+ it('should generate text using mock SDK', async () => {
33
+ const ai = new GoogleGenAI({ apiKey: 'test-key' });
34
+ const response = await ai.models.generateContent({
35
+ model: 'gemini-2.0-flash',
36
+ contents: 'test prompt'
37
+ });
38
+ expect(response.text).toBe('Hello, this is a mock response');
39
+ });
40
+ it('should mock image generation', async () => {
41
+ const ai = new GoogleGenAI({ apiKey: 'test-key' });
42
+ const response = await ai.models.generateImages({
43
+ model: 'imagen-3.0',
44
+ prompt: 'test image prompt'
45
+ });
46
+ expect(response.generatedImages[0].image.imageBytes.toString()).toBe('mock-image-bytes');
47
+ });
48
+ });
49
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,gCAAgC;AAChC,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;IAC5B,MAAM,eAAe;QACnB,MAAM,GAAG;YACP,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;gBACzC,IAAI,EAAE,gCAAgC;aACvC,CAAC;YACF,cAAc,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;gBACxC,eAAe,EAAE;oBACf;wBACE,KAAK,EAA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AC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@fre4x/gemini",
3
+ "version": "1.0.1",
4
+ "description": "A Gemini MCP server providing text completion, multimodal analysis, and image/video generation.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "gemini": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "typecheck": "tsc --noEmit",
16
+ "prepublishOnly": "npm run build",
17
+ "start": "node dist/index.js",
18
+ "dev": "tsx src/index.ts",
19
+ "watch": "tsc -w",
20
+ "inspector": "mcp-inspector node dist/index.js",
21
+ "test": "vitest run"
22
+ },
23
+ "keywords": [
24
+ "mcp",
25
+ "gemini",
26
+ "google-ai",
27
+ "mcp-server",
28
+ "multimodal",
29
+ "imagen",
30
+ "veo"
31
+ ],
32
+ "author": "fritzprix <innocentevil0914@gmail.com>",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "@google/genai": "^0.11.0",
36
+ "@modelcontextprotocol/sdk": "^1.26.0",
37
+ "zod": "^3.24.1"
38
+ },
39
+ "devDependencies": {
40
+ "@modelcontextprotocol/inspector": "^0.21.0",
41
+ "@types/node": "^22.13.5",
42
+ "tsx": "^4.19.3",
43
+ "typescript": "^5.7.3",
44
+ "vitest": "^4.0.18"
45
+ }
46
+ }