m9k_config
View or update plugin configuration for the Melchizedek MCP server. Changes save to ~/.melchizedek/config.json and apply after restart.
Instructions
View or update plugin configuration. Changes are saved to ~/.melchizedek/config.json and take effect on next server restart. Without arguments, returns current config.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Config key to update (e.g. 'rerankerEnabled') | |
| value | No | New value (JSON-encoded: 'false', '15', '"node-llama-cpp"') |
Implementation Reference
- src/tools/memory.ts:422-513 (handler)The handler for the m9k_config tool which handles viewing and updating plugin configurations.
server.registerTool( 'm9k_config', { description: 'View or update plugin configuration. Changes are saved to ~/.melchizedek/config.json and take effect on next server restart. Without arguments, returns current config.', inputSchema: { key: z.string().optional().describe("Config key to update (e.g. 'rerankerEnabled')"), value: z .string() .optional() .describe("New value (JSON-encoded: 'false', '15', '\"node-llama-cpp\"')"), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false, }, }, async ({ key, value }) => { // Without args: return current config + ignored projects if (!key) { const ignoredProjects = getIgnoredProjects(ctx.db); return { content: [ { type: 'text' as const, text: JSON.stringify({ ...ctx.cfg, ignoredProjects }), }, ], }; } // With key+value: update config if (!value) { throw new McpError(ErrorCode.InvalidParams, 'Both key and value are required for updates'); } if (!CONFIGURABLE_KEYS.has(key)) { throw new McpError( ErrorCode.InvalidParams, `Unknown config key: ${key}. Valid keys: ${[...CONFIGURABLE_KEYS].join(', ')}`, ); } let parsed: unknown; try { parsed = JSON.parse(value); } catch { throw new McpError(ErrorCode.InvalidParams, `Invalid JSON value: ${value}`); } writeConfigFile({ [key]: parsed } as Partial<MelchizedekConfig>); // Update in-memory config const updatedCfg = { ...ctx.cfg, [key]: parsed }; Object.assign(ctx.cfg, updatedCfg); // Hot-reload reranker when relevant keys change let hotReloadFailed = false; if (RERANKER_HOT_RELOAD_KEYS.has(key)) { try { const detected = await detectRerankerBackend(ctx.cfg); if (detected) { ctx.searchContext.reranker = detected.reranker; } else { // New config doesn't yield a reranker — keep old one active hotReloadFailed = true; } } catch { hotReloadFailed = true; } } const restartRequired = RESTART_REQUIRED_KEYS.has(key); return { content: [ { type: 'text' as const, text: JSON.stringify({ updated: true, key, config: updatedCfg, hotReloadFailed, restartRequired, }), }, ], }; }, );