@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/index.d.cts CHANGED
@@ -58,6 +58,9 @@ interface SanctuaryConfig {
58
58
  }
59
59
  /**
60
60
  * Load configuration from file, falling back to defaults.
61
+ *
62
+ * Precedence (highest wins): CLI flags > env vars > config file > defaults
63
+ * This matches the standard config precedence pattern used by most tools.
61
64
  */
62
65
  declare function loadConfig(configPath?: string): Promise<SanctuaryConfig>;
63
66
 
package/dist/index.d.ts CHANGED
@@ -58,6 +58,9 @@ interface SanctuaryConfig {
58
58
  }
59
59
  /**
60
60
  * Load configuration from file, falling back to defaults.
61
+ *
62
+ * Precedence (highest wins): CLI flags > env vars > config file > defaults
63
+ * This matches the standard config precedence pattern used by most tools.
61
64
  */
62
65
  declare function loadConfig(configPath?: string): Promise<SanctuaryConfig>;
63
66
 
package/dist/index.js CHANGED
@@ -254,7 +254,18 @@ function defaultConfig() {
254
254
  };
255
255
  }
256
256
  async function loadConfig(configPath) {
257
- const config = defaultConfig();
257
+ let config = defaultConfig();
258
+ const storagePath = process.env.SANCTUARY_STORAGE_PATH ?? config.storage_path;
259
+ const path = configPath ?? join(storagePath, "sanctuary.json");
260
+ try {
261
+ const raw = await readFile(path, "utf-8");
262
+ const fileConfig = JSON.parse(raw);
263
+ config = deepMerge(config, fileConfig);
264
+ } catch (err) {
265
+ if (err instanceof Error && err.message.includes("unimplemented features")) {
266
+ throw err;
267
+ }
268
+ }
258
269
  if (process.env.SANCTUARY_STORAGE_PATH) {
259
270
  config.storage_path = process.env.SANCTUARY_STORAGE_PATH;
260
271
  }
@@ -267,6 +278,9 @@ async function loadConfig(configPath) {
267
278
  if (process.env.SANCTUARY_DASHBOARD_ENABLED === "true") {
268
279
  config.dashboard.enabled = true;
269
280
  }
281
+ if (process.env.SANCTUARY_DASHBOARD_ENABLED === "false") {
282
+ config.dashboard.enabled = false;
283
+ }
270
284
  if (process.env.SANCTUARY_DASHBOARD_PORT) {
271
285
  config.dashboard.port = parseInt(process.env.SANCTUARY_DASHBOARD_PORT, 10);
272
286
  }
@@ -285,6 +299,9 @@ async function loadConfig(configPath) {
285
299
  if (process.env.SANCTUARY_WEBHOOK_ENABLED === "true") {
286
300
  config.webhook.enabled = true;
287
301
  }
302
+ if (process.env.SANCTUARY_WEBHOOK_ENABLED === "false") {
303
+ config.webhook.enabled = false;
304
+ }
288
305
  if (process.env.SANCTUARY_WEBHOOK_URL) {
289
306
  config.webhook.url = process.env.SANCTUARY_WEBHOOK_URL;
290
307
  }
@@ -297,19 +314,9 @@ async function loadConfig(configPath) {
297
314
  if (process.env.SANCTUARY_WEBHOOK_CALLBACK_HOST) {
298
315
  config.webhook.callback_host = process.env.SANCTUARY_WEBHOOK_CALLBACK_HOST;
299
316
  }
300
- const path = configPath ?? join(config.storage_path, "sanctuary.json");
301
- try {
302
- const raw = await readFile(path, "utf-8");
303
- const fileConfig = JSON.parse(raw);
304
- const merged = deepMerge(config, fileConfig);
305
- validateConfig(merged);
306
- return merged;
307
- } catch (err) {
308
- if (err instanceof Error && err.message.includes("unimplemented features")) {
309
- throw err;
310
- }
311
- return config;
312
- }
317
+ config.version = PKG_VERSION;
318
+ validateConfig(config);
319
+ return config;
313
320
  }
314
321
  async function saveConfig(config, configPath) {
315
322
  const path = join(config.storage_path, "sanctuary.json");