@sanctuary-framework/mcp-server 0.5.0 → 0.5.1

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/dist/cli.cjs CHANGED
@@ -259,7 +259,18 @@ function defaultConfig() {
259
259
  };
260
260
  }
261
261
  async function loadConfig(configPath) {
262
- const config = defaultConfig();
262
+ let config = defaultConfig();
263
+ const storagePath = process.env.SANCTUARY_STORAGE_PATH ?? config.storage_path;
264
+ const path$1 = configPath ?? path.join(storagePath, "sanctuary.json");
265
+ try {
266
+ const raw = await promises.readFile(path$1, "utf-8");
267
+ const fileConfig = JSON.parse(raw);
268
+ config = deepMerge(config, fileConfig);
269
+ } catch (err) {
270
+ if (err instanceof Error && err.message.includes("unimplemented features")) {
271
+ throw err;
272
+ }
273
+ }
263
274
  if (process.env.SANCTUARY_STORAGE_PATH) {
264
275
  config.storage_path = process.env.SANCTUARY_STORAGE_PATH;
265
276
  }
@@ -272,6 +283,9 @@ async function loadConfig(configPath) {
272
283
  if (process.env.SANCTUARY_DASHBOARD_ENABLED === "true") {
273
284
  config.dashboard.enabled = true;
274
285
  }
286
+ if (process.env.SANCTUARY_DASHBOARD_ENABLED === "false") {
287
+ config.dashboard.enabled = false;
288
+ }
275
289
  if (process.env.SANCTUARY_DASHBOARD_PORT) {
276
290
  config.dashboard.port = parseInt(process.env.SANCTUARY_DASHBOARD_PORT, 10);
277
291
  }
@@ -290,6 +304,9 @@ async function loadConfig(configPath) {
290
304
  if (process.env.SANCTUARY_WEBHOOK_ENABLED === "true") {
291
305
  config.webhook.enabled = true;
292
306
  }
307
+ if (process.env.SANCTUARY_WEBHOOK_ENABLED === "false") {
308
+ config.webhook.enabled = false;
309
+ }
293
310
  if (process.env.SANCTUARY_WEBHOOK_URL) {
294
311
  config.webhook.url = process.env.SANCTUARY_WEBHOOK_URL;
295
312
  }
@@ -302,19 +319,9 @@ async function loadConfig(configPath) {
302
319
  if (process.env.SANCTUARY_WEBHOOK_CALLBACK_HOST) {
303
320
  config.webhook.callback_host = process.env.SANCTUARY_WEBHOOK_CALLBACK_HOST;
304
321
  }
305
- const path$1 = configPath ?? path.join(config.storage_path, "sanctuary.json");
306
- try {
307
- const raw = await promises.readFile(path$1, "utf-8");
308
- const fileConfig = JSON.parse(raw);
309
- const merged = deepMerge(config, fileConfig);
310
- validateConfig(merged);
311
- return merged;
312
- } catch (err) {
313
- if (err instanceof Error && err.message.includes("unimplemented features")) {
314
- throw err;
315
- }
316
- return config;
317
- }
322
+ config.version = PKG_VERSION;
323
+ validateConfig(config);
324
+ return config;
318
325
  }
319
326
  async function saveConfig(config, configPath) {
320
327
  const path$1 = path.join(config.storage_path, "sanctuary.json");