@mixio-pro/kalaasetu-mcp 2.2.8-exp → 2.2.9-exp

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": "2.2.8-exp",
3
+ "version": "2.2.9-exp",
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",
@@ -54,6 +54,7 @@
54
54
  "@sentry/node": "^10.36.0",
55
55
  "@types/node": "^24.10.1",
56
56
  "@types/wav": "^1.0.4",
57
+ "dotenv": "^17.3.1",
57
58
  "fastmcp": "3.26.8",
58
59
  "form-data": "^4.0.5",
59
60
  "google-auth-library": "^10.5.0",
@@ -1,13 +1,15 @@
1
1
  import { logger } from "./logger";
2
2
  import { join } from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
+ import * as dotenv from "dotenv";
4
5
 
5
6
  /**
6
7
  * Decodes a JWT payload without validation.
7
8
  */
8
9
  function decodeJwt(token: string): any {
9
10
  try {
10
- const parts = token.split(".");
11
+ const jwt = token.replace(/^Bearer\s+/i, "");
12
+ const parts = jwt.split(".");
11
13
  if (parts.length !== 3 || !parts[1]) return null;
12
14
  const payload = parts[1];
13
15
  const decoded = Buffer.from(payload, "base64").toString("utf-8");
@@ -45,24 +47,7 @@ export async function loadRemoteConfig() {
45
47
 
46
48
  if (targetPath) {
47
49
  try {
48
- const content = readFileSync(targetPath, "utf-8");
49
- const lines = content.split(/\r?\n/);
50
-
51
- for (const line of lines) {
52
- const trimmedLine = line.trim();
53
- if (!trimmedLine || trimmedLine.startsWith("#")) continue;
54
-
55
- const match = trimmedLine.match(/^\s*([^=]+)\s*=\s*(.*)$/);
56
- if (match && match[1] !== undefined && match[2] !== undefined) {
57
- const key = match[1].trim();
58
- const value = match[2].trim().replace(/^(['"])(.*)\1$/, "$2");
59
-
60
- // Load into process.env if not already set manually in current execution
61
- if (!process.env[key]) {
62
- process.env[key] = value;
63
- }
64
- }
65
- }
50
+ dotenv.config({ path: targetPath });
66
51
 
67
52
  // Re-evaluate variables after loading from file
68
53
  token =
@@ -83,12 +68,18 @@ export async function loadRemoteConfig() {
83
68
  const payload = decodeJwt(token);
84
69
  if (payload) {
85
70
  // Prioritize values from the token payload
86
- clientId = (payload.clientId || payload.client || clientId)
71
+ clientId = (
72
+ payload.clientId ||
73
+ payload.client ||
74
+ payload.client_id ||
75
+ clientId
76
+ )
87
77
  ?.toString()
88
78
  ?.trim();
89
79
  projectId = (
90
80
  payload.projectId ||
91
81
  payload.project ||
82
+ payload.project_id ||
92
83
  projectId ||
93
84
  "default"
94
85
  )