@@ -185,6 +185,23 @@ test('CONFIG: a throwing readFile, absent file, and no config at all are all tol
185185 assert . strictEqual ( M . loadServerConfig ( ) . servers . length , 0 ) ;
186186} ) ;
187187
188+ test ( 'CONFIG: no MCP config at all reports NO problems (the common case must be silent)' , ( ) => {
189+ // Regression: a missing `settings` used to be wrapped as {mcpServers: undefined}, which fell through
190+ // to the bare-map branch and reported a phantom server named "mcpServers" — an error for every user
191+ // who has never configured MCP. Assert on problems, not just servers.
192+ for ( const arg of [ undefined , { } , { settings : undefined } , { settings : null } , { settings : { } } ] ) {
193+ const r = M . loadServerConfig ( arg ) ;
194+ assert . deepStrictEqual ( r . servers , [ ] , JSON . stringify ( arg ) ) ;
195+ assert . deepStrictEqual ( r . problems , [ ] , 'expected no problems for ' + JSON . stringify ( arg ) + ', got ' + JSON . stringify ( r . problems ) ) ;
196+ }
197+ } ) ;
198+
199+ test ( 'CONFIG: a settings object may itself use the {mcpServers:…} wrapper' , ( ) => {
200+ const { servers, problems } = M . loadServerConfig ( { settings : { mcpServers : { wrapped : { command : 'x' } } } } ) ;
201+ assert . deepStrictEqual ( servers . map ( ( s ) => s . name ) , [ 'wrapped' ] ) ;
202+ assert . deepStrictEqual ( problems , [ ] ) ;
203+ } ) ;
204+
188205test ( 'CONFIG: the server cap is enforced' , ( ) => {
189206 const settings = { } ;
190207 for ( let i = 0 ; i < M . MAX_SERVERS + 3 ; i ++ ) { settings [ 's' + i ] = { command : 'x' } ; }
0 commit comments