Skip to content

Commit 7a2065f

Browse files
committed
fix: honor opts.instructions in runMcpServer
Only assemble codebase-map appendix when caller did not supply instructions.
1 parent 7c30ccb commit 7a2065f

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/application/mcp-server.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,19 +681,21 @@ export async function runMcpServer(opts: ServerOpts): Promise<void> {
681681
await watchSession.acquireClient();
682682
}
683683

684-
let instructions: string;
685-
try {
686-
const { openDb, closeDb } = await import("../db");
687-
const db = openDb();
684+
let instructions = opts.instructions;
685+
if (instructions === undefined) {
688686
try {
689-
instructions = assembleMcpInstructions(
690-
buildMcpInstructionsCodebaseMapAppendix(db, getProjectRoot()),
691-
);
692-
} finally {
693-
closeDb(db, { readonly: true });
687+
const { openDb, closeDb } = await import("../db");
688+
const db = openDb();
689+
try {
690+
instructions = assembleMcpInstructions(
691+
buildMcpInstructionsCodebaseMapAppendix(db, getProjectRoot()),
692+
);
693+
} finally {
694+
closeDb(db, { readonly: true });
695+
}
696+
} catch {
697+
instructions = assembleMcpInstructions();
694698
}
695-
} catch {
696-
instructions = assembleMcpInstructions();
697699
}
698700

699701
const server = createMcpServer({ ...opts, instructions });

0 commit comments

Comments
 (0)