@@ -269,6 +269,54 @@ describe("getMcpConfigForManifest", () => {
269269 expect ( result ?. args ) . toEqual ( [ "server.js" , "/user/path1" , "/user/path2" ] ) ;
270270 } ) ;
271271
272+ it ( "should merge platform override env with base env instead of replacing" , async ( ) => {
273+ const manifest : McpbManifestAny = {
274+ ...baseManifest ,
275+ user_config : {
276+ data_directory : {
277+ type : "directory" ,
278+ title : "Data Directory" ,
279+ description : "Where data lives" ,
280+ required : true ,
281+ } ,
282+ } ,
283+ server : {
284+ type : "node" ,
285+ entry_point : "server.js" ,
286+ mcp_config : {
287+ command : "node" ,
288+ args : [ "server.js" ] ,
289+ env : {
290+ DATA_DIR : "${user_config.data_directory}" ,
291+ EXISTING_VAR : "keep-me" ,
292+ } ,
293+ platform_overrides : {
294+ [ process . platform ] : {
295+ env : {
296+ PATH : "/usr/local/bin:${HOME}/.local/bin" ,
297+ } ,
298+ } ,
299+ } ,
300+ } ,
301+ } ,
302+ } ;
303+
304+ const result = await getMcpConfigForManifest ( {
305+ manifest,
306+ extensionPath : "/ext/path" ,
307+ systemDirs : { ...mockSystemDirs , HOME : "/home/user" } ,
308+ userConfig : { data_directory : "/custom/data" } ,
309+ pathSeparator : "/" ,
310+ logger : mockLogger ,
311+ } ) ;
312+
313+ // Base env vars should be preserved after platform override merge
314+ expect ( result ?. env ?. DATA_DIR ) . toBe ( "/custom/data" ) ;
315+ expect ( result ?. env ?. EXISTING_VAR ) . toBe ( "keep-me" ) ;
316+ // Platform override env should also be present
317+ expect ( result ?. env ?. PATH ) . toBe ( "/usr/local/bin:/home/user/.local/bin" ) ;
318+ } ) ;
319+
272320 it ( "should convert boolean user config values to strings" , async ( ) => {
273321 const manifest : McpbManifestAny = {
274322 ...baseManifest ,
0 commit comments