From ce0cd64409d0445dadc059687fcab03222edb619 Mon Sep 17 00:00:00 2001 From: JohnRichardEnders Date: Fri, 3 Apr 2026 17:17:46 +0200 Subject: [PATCH] feat(mcp): pass YAML config path to createStore for model resolution Co-Authored-By: Claude Opus 4.6 (1M context) --- src/mcp/server.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mcp/server.ts b/src/mcp/server.ts index 9f9f5a4..8f29f9c 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -18,6 +18,7 @@ import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js"; import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js"; import { z } from "zod"; +import { existsSync } from "fs"; import { createStore, extractSnippet, @@ -28,6 +29,7 @@ import { type ExpandedQuery, type IndexStatus, } from "../index.js"; +import { getConfigPath } from "../collections.js"; // ============================================================================= // Types for structured content @@ -536,7 +538,11 @@ Intent-aware lex (C++ performance, not sports): // ============================================================================= export async function startMcpServer(): Promise { - const store = await createStore({ dbPath: getDefaultDbPath() }); + const configPath = getConfigPath(); + const store = await createStore({ + dbPath: getDefaultDbPath(), + ...(existsSync(configPath) ? { configPath } : {}), + }); const server = await createMcpServer(store); const transport = new StdioServerTransport(); await server.connect(transport); @@ -557,7 +563,11 @@ export type HttpServerHandle = { * Binds to localhost only. Returns a handle for shutdown and port discovery. */ export async function startMcpHttpServer(port: number, options?: { quiet?: boolean }): Promise { - const store = await createStore({ dbPath: getDefaultDbPath() }); + const configPath = getConfigPath(); + const store = await createStore({ + dbPath: getDefaultDbPath(), + ...(existsSync(configPath) ? { configPath } : {}), + }); // Pre-fetch default collection names for REST endpoint const defaultCollectionNames = await store.getDefaultCollectionNames();