Skip to main content
Glama

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
NameRequiredDescriptionDefault
keyNoConfig key to update (e.g. 'rerankerEnabled')
valueNoNew value (JSON-encoded: 'false', '15', '"node-llama-cpp"')

Implementation Reference

  • 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,
              }),
            },
          ],
        };
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/louis49/melchizedek'

If you have feedback or need assistance with the MCP directory API, please join our Discord server