@mixio-pro/kalaasetu-mcp 2.2.7-exp → 2.2.8-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.7-exp",
3
+ "version": "2.2.8-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",
@@ -32,45 +32,48 @@ export async function loadRemoteConfig() {
32
32
  let clientId = process.env.CLIENT_ID?.trim();
33
33
  let projectId = process.env.PROJECT_ID?.trim();
34
34
 
35
- if (!token) {
36
- const vscodeCwd = process.env.VSCODE_CWD;
37
- if (vscodeCwd) {
38
- const envLocalPath = join(vscodeCwd, ".env.local");
39
- if (existsSync(envLocalPath)) {
40
- try {
41
- const content = readFileSync(envLocalPath, "utf-8");
42
- const lines = content.split(/\r?\n/);
43
-
44
- for (const line of lines) {
45
- const trimmedLine = line.trim();
46
- if (!trimmedLine || trimmedLine.startsWith("#")) continue;
47
-
48
- const match = trimmedLine.match(/^\s*([^=]+)\s*=\s*(.*)$/);
49
- if (match && match[1] !== undefined && match[2] !== undefined) {
50
- const key = match[1].trim();
51
- const value = match[2].trim().replace(/^(['"])(.*)\1$/, "$2");
52
-
53
- // Load into process.env if not already set manually in current execution
54
- if (!process.env[key]) {
55
- process.env[key] = value;
56
- }
57
-
58
- if (key === "MIXIO_TOKEN" || key === "MIXIO_CONFIG_JWT") {
59
- if (!token) token = value;
60
- }
61
- if (key === "CLIENT_ID") {
62
- if (!clientId) clientId = value;
63
- }
64
- if (key === "PROJECT_ID") {
65
- if (!projectId) projectId = value;
66
- }
35
+ const cwd = process.env.VSCODE_CWD || process.cwd();
36
+ if (cwd) {
37
+ // Check .env.local first, then .env
38
+ const envLocalPath = join(cwd, ".env.local");
39
+ const envPath = join(cwd, ".env");
40
+ let targetPath = existsSync(envLocalPath)
41
+ ? envLocalPath
42
+ : existsSync(envPath)
43
+ ? envPath
44
+ : null;
45
+
46
+ if (targetPath) {
47
+ 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;
67
63
  }
68
64
  }
69
-
70
- logger.info("🔑 Loaded environment details from .env.local");
71
- } catch (err) {
72
- logger.warn(`Failed to read .env.local in VSCODE_CWD: ${err}`);
73
65
  }
66
+
67
+ // Re-evaluate variables after loading from file
68
+ token =
69
+ (process.env.MIXIO_TOKEN || process.env.MIXIO_CONFIG_JWT)?.trim() ||
70
+ token;
71
+ clientId = process.env.CLIENT_ID?.trim() || clientId;
72
+ projectId = process.env.PROJECT_ID?.trim() || projectId;
73
+
74
+ logger.info(`🔑 Loaded environment details from ${targetPath}`);
75
+ } catch (err) {
76
+ logger.warn(`Failed to read env file: ${err}`);
74
77
  }
75
78
  }
76
79
  }
@@ -94,10 +97,14 @@ export async function loadRemoteConfig() {
94
97
  }
95
98
  }
96
99
 
97
- // Ensure CLIENT_ID and PROJECT_ID are in process.env
100
+ // Ensure CLIENT_ID and PROJECT_ID are forcefully populated into process.env if derived
98
101
  if (clientId) process.env.CLIENT_ID = clientId;
99
102
  if (projectId) process.env.PROJECT_ID = projectId;
100
103
 
104
+ logger.info(
105
+ `🔍 Config check: CLIENT_ID=${process.env.CLIENT_ID}, PROJECT_ID=${process.env.PROJECT_ID}`,
106
+ );
107
+
101
108
  if (!token || !clientId || !projectId) {
102
109
  logger.info(
103
110
  `â„šī¸ Remote config skipped: token=${!!token}, client=${clientId || "missing"}, project=${projectId || "missing"}. Continuing with local env.`,