@mixio-pro/kalaasetu-mcp 1.0.17 → 1.1.0
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/package.json +1 -1
- package/src/index.ts +11 -11
- package/src/tools/gemini.ts +24 -3
- package/src/tools/image-to-video.ts +13 -3
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { FastMCP } from "fastmcp";
|
|
3
|
-
import {
|
|
4
|
-
geminiTextToImage,
|
|
5
|
-
geminiEditImage,
|
|
3
|
+
import {
|
|
4
|
+
geminiTextToImage,
|
|
5
|
+
geminiEditImage,
|
|
6
6
|
geminiAnalyzeImages,
|
|
7
7
|
geminiSingleSpeakerTts,
|
|
8
|
-
geminiAnalyzeVideos
|
|
8
|
+
geminiAnalyzeVideos,
|
|
9
9
|
} from "./tools/gemini";
|
|
10
10
|
import { analyzeYoutubeVideo } from "./tools/youtube";
|
|
11
11
|
import { imageToVideo } from "./tools/image-to-video";
|
|
@@ -24,27 +24,27 @@ server.addTool(geminiEditImage);
|
|
|
24
24
|
server.addTool(geminiAnalyzeImages);
|
|
25
25
|
|
|
26
26
|
// Gemini TTS Tool
|
|
27
|
-
server.addTool(geminiSingleSpeakerTts);
|
|
27
|
+
// server.addTool(geminiSingleSpeakerTts);
|
|
28
28
|
|
|
29
29
|
// Gemini Video Analysis Tool
|
|
30
30
|
server.addTool(geminiAnalyzeVideos);
|
|
31
31
|
|
|
32
32
|
// YouTube Analyzer Tool
|
|
33
|
-
server.addTool(analyzeYoutubeVideo);
|
|
33
|
+
// server.addTool(analyzeYoutubeVideo);
|
|
34
34
|
|
|
35
35
|
// Vertex AI Image-to-Video Tool
|
|
36
36
|
server.addTool(imageToVideo);
|
|
37
37
|
|
|
38
38
|
// FAL AI Infinitalk Tool
|
|
39
|
-
server.addTool(infinitalk);
|
|
39
|
+
// server.addTool(infinitalk);
|
|
40
40
|
|
|
41
41
|
// FAL AI Hunyuan Avatar Tool
|
|
42
|
-
server.addTool(hunyuanAvatar);
|
|
42
|
+
// server.addTool(hunyuanAvatar);
|
|
43
43
|
|
|
44
44
|
// Perplexity Search Tools
|
|
45
|
-
server.addTool(perplexityImages);
|
|
46
|
-
server.addTool(perplexityVideos);
|
|
45
|
+
// server.addTool(perplexityImages);
|
|
46
|
+
// server.addTool(perplexityVideos);
|
|
47
47
|
|
|
48
48
|
server.start({
|
|
49
49
|
transportType: "stdio",
|
|
50
|
-
});
|
|
50
|
+
});
|
package/src/tools/gemini.ts
CHANGED
|
@@ -22,8 +22,17 @@ async function fileToGenerativePart(filePath: string) {
|
|
|
22
22
|
const fileResult = await ensureLocalFile(filePath);
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
let imageBytes: Buffer;
|
|
26
|
+
if (fileResult.isTemp) {
|
|
27
|
+
// Temp files are always local on disk, read directly with fs
|
|
28
|
+
// This avoids 404s if storage provider is GCS/S3
|
|
29
|
+
imageBytes = fs.readFileSync(fileResult.path);
|
|
30
|
+
} else {
|
|
31
|
+
// If not temp, it might be a storage path, let storage provider handle it
|
|
32
|
+
const storage = getStorage();
|
|
33
|
+
imageBytes = await storage.readFile(fileResult.path);
|
|
34
|
+
}
|
|
35
|
+
|
|
27
36
|
return {
|
|
28
37
|
inlineData: {
|
|
29
38
|
data: Buffer.from(imageBytes).toString("base64"),
|
|
@@ -162,7 +171,19 @@ async function processVideoInput(
|
|
|
162
171
|
|
|
163
172
|
try {
|
|
164
173
|
// Upload file to Gemini API
|
|
165
|
-
//
|
|
174
|
+
// If it's a temp file, we should bypass storage.readFile logic in uploadFileToGemini
|
|
175
|
+
// OR we can rely on uploadFileToGemini's existence check.
|
|
176
|
+
// But uploadFileToGemini uses storage.readFile if !fs.exists.
|
|
177
|
+
// Since fileResult.path IS a local temp file, fs.exists WILL be true.
|
|
178
|
+
// So uploadFileToGemini will see it exists locally and NOT try storage.readFile.
|
|
179
|
+
// Wait, uploadFileToGemini takes `filePath`.
|
|
180
|
+
// If `filePath` is absolute local path, `fs.existsSync` is true.
|
|
181
|
+
// So no changes needed here?
|
|
182
|
+
// Let's verify uploadFileToGemini logic again.
|
|
183
|
+
// It does: if (!fs.existsSync(filePath)) { read from storage }
|
|
184
|
+
// fileResult.path is guaranteed to exist locally (if temp).
|
|
185
|
+
// So correct.
|
|
186
|
+
|
|
166
187
|
const uploadedFile = await uploadFileToGemini(fileResult.path);
|
|
167
188
|
return uploadedFile;
|
|
168
189
|
} finally {
|
|
@@ -19,9 +19,19 @@ async function fileToBase64(
|
|
|
19
19
|
const fileResult = await ensureLocalFile(filePath);
|
|
20
20
|
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
let data: string;
|
|
23
|
+
if (fileResult.isTemp) {
|
|
24
|
+
// Temp files are always local on disk, read directly with fs
|
|
25
|
+
// This avoids 404s if storage provider is GCS
|
|
26
|
+
const fs = await import("fs");
|
|
27
|
+
const buf = fs.readFileSync(fileResult.path);
|
|
28
|
+
data = Buffer.from(buf).toString("base64");
|
|
29
|
+
} else {
|
|
30
|
+
const storage = getStorage();
|
|
31
|
+
const buf = await storage.readFile(fileResult.path);
|
|
32
|
+
data = Buffer.from(buf).toString("base64");
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
// Default to PNG if not sure, similar to existing code
|
|
26
36
|
const mimeType = "image/png";
|
|
27
37
|
return { data, mimeType };
|