Skip to content

Commit 73e5b67

Browse files
hongkongkiwiclaude
andcommitted
fix: address CodeRabbit review feedback
- Fix manual config for unsupported clients to include all new flags - Improve environment parsing to handle edge cases (empty strings, duplicates) - Normalize environment names (lowercase, trim) for consistent matching - Ensure envOnly takes precedence over devOnly in all places 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e181829 commit 73e5b67

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

packages/cli-v3/src/commands/install-mcp.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

packages/cli-v3/src/commands/mcp.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff 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'];

packages/cli-v3/src/mcp/context.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)