File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 } ) ;
You can’t perform that action at this time.
0 commit comments