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