@muggleai/mcp 1.0.6 → 1.0.10

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.
@@ -39,9 +39,12 @@ var muggleConfigCache = null;
39
39
  function getPackageRoot() {
40
40
  const currentFilePath = fileURLToPath(import.meta.url);
41
41
  const currentDir = path4.dirname(currentFilePath);
42
- if (currentDir.endsWith("dist") || currentDir.includes(path4.join("dist", "shared"))) {
42
+ if (currentDir.includes(path4.join("dist", "shared"))) {
43
43
  return path4.resolve(currentDir, "..", "..");
44
44
  }
45
+ if (currentDir.endsWith("dist")) {
46
+ return path4.resolve(currentDir, "..");
47
+ }
45
48
  if (currentDir.includes(path4.join("src", "shared"))) {
46
49
  return path4.resolve(currentDir, "..", "..");
47
50
  }
@@ -53,23 +56,48 @@ function getMuggleConfig() {
53
56
  }
54
57
  const packageRoot = getPackageRoot();
55
58
  const packageJsonPath = path4.join(packageRoot, "package.json");
59
+ let packageJson;
56
60
  try {
57
- const packageJson = JSON.parse(fs4.readFileSync(packageJsonPath, "utf-8"));
58
- const config = packageJson.muggleConfig;
59
- if (config?.electronAppVersion && config?.downloadBaseUrl) {
60
- muggleConfigCache = {
61
- electronAppVersion: config.electronAppVersion,
62
- downloadBaseUrl: config.downloadBaseUrl,
63
- checksums: config.checksums
64
- };
65
- return muggleConfigCache;
66
- }
67
- } catch {
61
+ const content = fs4.readFileSync(packageJsonPath, "utf-8");
62
+ packageJson = JSON.parse(content);
63
+ } catch (error) {
64
+ const errorMessage = error instanceof Error ? error.message : String(error);
65
+ throw new Error(
66
+ `Failed to read package.json for muggleConfig.
67
+ Path: ${packageJsonPath}
68
+ Package root: ${packageRoot}
69
+ Error: ${errorMessage}
70
+ This is a bug - please report it.`
71
+ );
72
+ }
73
+ const config = packageJson.muggleConfig;
74
+ if (!config) {
75
+ throw new Error(
76
+ `Missing muggleConfig in package.json.
77
+ Path: ${packageJsonPath}
78
+ This is a bug - please report it.`
79
+ );
80
+ }
81
+ if (!config.electronAppVersion || typeof config.electronAppVersion !== "string") {
82
+ throw new Error(
83
+ `Missing or invalid muggleConfig.electronAppVersion in package.json.
84
+ Path: ${packageJsonPath}
85
+ Value: ${JSON.stringify(config.electronAppVersion)}
86
+ This is a bug - please report it.`
87
+ );
88
+ }
89
+ if (!config.downloadBaseUrl || typeof config.downloadBaseUrl !== "string") {
90
+ throw new Error(
91
+ `Missing or invalid muggleConfig.downloadBaseUrl in package.json.
92
+ Path: ${packageJsonPath}
93
+ Value: ${JSON.stringify(config.downloadBaseUrl)}
94
+ This is a bug - please report it.`
95
+ );
68
96
  }
69
97
  muggleConfigCache = {
70
- electronAppVersion: "1.0.1",
71
- downloadBaseUrl: "https://github.com/multiplex-ai/muggle-ai-mcp/releases/download",
72
- checksums: {}
98
+ electronAppVersion: config.electronAppVersion,
99
+ downloadBaseUrl: config.downloadBaseUrl,
100
+ checksums: config.checksums || {}
73
101
  };
74
102
  return muggleConfigCache;
75
103
  }
@@ -7772,5 +7800,5 @@ function isLocalOnlyTool(toolName) {
7772
7800
  }
7773
7801
 
7774
7802
  export { __export, __require, createApiKeyWithToken, createChildLogger, createUnifiedMcpServer, deleteCredentials, getAuthStatus, getBundledElectronAppVersion, getCallerCredentials, getConfig, getCredentialsFilePath, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getQaTools, getValidCredentials, isCredentialsExpired, isElectronAppInstalled, loadCredentials, local_qa_exports, openBrowserUrl, performLogin, performLogout, pollDeviceCode, qa_exports, registerTools, resetConfig, resetLogger, saveCredentials, server_exports, startDeviceCodeFlow, startStdioServer, toolRequiresAuth };
7775
- //# sourceMappingURL=chunk-DX2A2FVG.js.map
7776
- //# sourceMappingURL=chunk-DX2A2FVG.js.map
7803
+ //# sourceMappingURL=chunk-XKXZH7PD.js.map
7804
+ //# sourceMappingURL=chunk-XKXZH7PD.js.map