@mixio-pro/kalaasetu-mcp 1.0.10 → 1.0.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mixio-pro/kalaasetu-mcp",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "A powerful Model Context Protocol server providing AI tools for content generation and analysis",
5
5
  "type": "module",
6
6
  "module": "src/index.ts",
@@ -8,6 +8,7 @@ export function getStorage(): StorageProvider {
8
8
  if (!storageInstance) {
9
9
  const type = process.env.STORAGE_PROVIDER || "local";
10
10
  console.error(`Initializing storage provider: ${type}`);
11
+ console.error(`Base path (cwd): ${process.cwd()}`);
11
12
 
12
13
  if (type === "gcs") {
13
14
  const bucket = process.env.GCS_BUCKET;
@@ -40,7 +40,12 @@ export class LocalStorageProvider implements StorageProvider {
40
40
  if (!path.isAbsolute(filePath)) {
41
41
  fullPath = path.resolve(this.basePath, filePath);
42
42
  }
43
- return fs.existsSync(fullPath);
43
+ try {
44
+ await fs.promises.access(fullPath, fs.constants.F_OK);
45
+ return true;
46
+ } catch {
47
+ return false;
48
+ }
44
49
  }
45
50
 
46
51
  async getPublicUrl(filePath: string): Promise<string> {
@@ -18,9 +18,23 @@ const ai = new GoogleGenAI({
18
18
 
19
19
  async function fileToGenerativePart(filePath: string) {
20
20
  const storage = getStorage();
21
- if (!(await storage.exists(filePath))) {
22
- throw new Error(`File not found: ${filePath}`);
21
+
22
+ // Check if file exists
23
+ const exists = await storage.exists(filePath);
24
+ if (!exists) {
25
+ // Try to provide more helpful error information
26
+ const isAbsolute = path.isAbsolute(filePath);
27
+ const resolvedPath = isAbsolute
28
+ ? filePath
29
+ : path.resolve(process.cwd(), filePath);
30
+ throw new Error(
31
+ `File not found: ${filePath}\n` +
32
+ `Resolved path: ${resolvedPath}\n` +
33
+ `Is absolute: ${isAbsolute}\n` +
34
+ `CWD: ${process.cwd()}`
35
+ );
23
36
  }
37
+
24
38
  const imageBytes = await storage.readFile(filePath);
25
39
  return {
26
40
  inlineData: {
@@ -153,8 +167,19 @@ async function processVideoInput(
153
167
  } else {
154
168
  // Local file processing - use File Upload API
155
169
  const storage = getStorage();
156
- if (!(await storage.exists(input))) {
157
- throw new Error(`Video file not found: ${input}`);
170
+
171
+ // Check if file exists
172
+ const exists = await storage.exists(input);
173
+ if (!exists) {
174
+ // Try to provide more helpful error information
175
+ const isAbsolute = path.isAbsolute(input);
176
+ const resolvedPath = isAbsolute ? input : path.resolve(process.cwd(), input);
177
+ throw new Error(
178
+ `Video file not found: ${input}\n` +
179
+ `Resolved path: ${resolvedPath}\n` +
180
+ `Is absolute: ${isAbsolute}\n` +
181
+ `CWD: ${process.cwd()}`
182
+ );
158
183
  }
159
184
 
160
185
  // Upload file to Gemini API
@@ -54,9 +54,23 @@ async function fileToBase64(
54
54
  filePath: string
55
55
  ): Promise<{ data: string; mimeType: string }> {
56
56
  const storage = getStorage();
57
- if (!(await storage.exists(filePath))) {
58
- throw new Error(`File not found: ${filePath}`);
57
+
58
+ // Check if file exists
59
+ const exists = await storage.exists(filePath);
60
+ if (!exists) {
61
+ // Try to provide more helpful error information
62
+ const isAbsolute = path.isAbsolute(filePath);
63
+ const resolvedPath = isAbsolute
64
+ ? filePath
65
+ : path.resolve(process.cwd(), filePath);
66
+ throw new Error(
67
+ `File not found: ${filePath}\n` +
68
+ `Resolved path: ${resolvedPath}\n` +
69
+ `Is absolute: ${isAbsolute}\n` +
70
+ `CWD: ${process.cwd()}`
71
+ );
59
72
  }
73
+
60
74
  const buf = await storage.readFile(filePath);
61
75
  const data = Buffer.from(buf).toString("base64");
62
76
  // Default to PNG if not sure, similar to existing code