File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -287,10 +287,21 @@ function handleUnsupportedClientOnly(options: InstallMcpCommandOptions): Install
287287    args . push ( "--api-url" ,  options . apiUrl ) ; 
288288  } 
289289
290-   if  ( options . devOnly )  { 
290+   // Handle environment restrictions - envOnly takes precedence 
291+   if  ( options . envOnly )  { 
292+     args . push ( "--env-only" ,  options . envOnly ) ; 
293+   }  else  if  ( options . devOnly )  { 
291294    args . push ( "--dev-only" ) ; 
292295  } 
293296
297+   if  ( options . disableDeployment )  { 
298+     args . push ( "--disable-deployment" ) ; 
299+   } 
300+ 
301+   if  ( options . readonly )  { 
302+     args . push ( "--readonly" ) ; 
303+   } 
304+ 
294305  if  ( options . projectRef )  { 
295306    args . push ( "--project-ref" ,  options . projectRef ) ; 
296307  } 
Original file line number Diff line number Diff line change @@ -130,7 +130,15 @@ export async function mcpCommand(options: McpCommandOptions) {
130130  // Parse envOnly into an array if provided 
131131  let  envOnly : string [ ]  |  undefined ; 
132132  if  ( options . envOnly )  { 
133-     envOnly  =  options . envOnly . split ( ',' ) . map ( env  =>  env . trim ( ) ) ; 
133+     // Parse, normalize, and deduplicate environments 
134+     envOnly  =  Array . from ( 
135+       new  Set ( 
136+         options . envOnly 
137+           . split ( ',' ) 
138+           . map ( env  =>  env . trim ( ) . toLowerCase ( ) ) 
139+           . filter ( Boolean )  // Remove empty strings 
140+       ) 
141+     ) ; 
134142
135143    // Validate environment names 
136144    const  validEnvironments  =  [ 'dev' ,  'staging' ,  'prod' ,  'preview' ] ; 
Original file line number Diff line number Diff line change @@ -189,9 +189,13 @@ export class McpContext {
189189  } 
190190
191191  public  isEnvironmentAllowed ( environment : string ) : boolean  { 
192+     // Normalize the environment name for comparison 
193+     const  normalizedEnv  =  environment . trim ( ) . toLowerCase ( ) ; 
194+ 
192195    // If envOnly is specified, use that (devOnly is already converted to envOnly) 
193196    if  ( this . options . envOnly  &&  this . options . envOnly . length  >  0 )  { 
194-       return  this . options . envOnly . includes ( environment ) ; 
197+       // Note: envOnly is already normalized to lowercase in mcp.ts 
198+       return  this . options . envOnly . includes ( normalizedEnv ) ; 
195199    } 
196200
197201    // If no restrictions, all environments are allowed 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments