Skip to content

Commit 83c1713

Browse files
committed
Allow skipping config validation in preview
1 parent 2254c1b commit 83c1713

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

packages/mcp-server/src/server/errorHandler.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
RateLimitError,
2222
RequestValidationError,
2323
ValidationError,
24+
ConfigurationError,
2425
} from "../errors";
2526
import { FileSizeError, NonTypeScriptError } from "../services/review-code";
2627

@@ -172,6 +173,19 @@ export function errorToResponse(
172173
});
173174
}
174175

176+
case "ConfigurationError": {
177+
const e = error as ConfigurationError;
178+
const response: ApiErrorResponse = {
179+
error: e.message,
180+
status: "configuration_error",
181+
details: { key: e.key, expected: e.expected, received: e.received },
182+
};
183+
return NextResponse.json(response, {
184+
status: 500,
185+
headers: baseHeaders,
186+
});
187+
}
188+
175189
case "PatternLoadError": {
176190
const e = error as PatternLoadError;
177191
const response: ApiErrorResponse = {

packages/mcp-server/src/services/config/helpers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,12 @@ export function loadConfig(): Effect.Effect<MCPConfig, ConfigurationError> {
244244
DEFAULT_CONFIG.tracingSamplingRate,
245245
};
246246

247-
// Validate configuration
248-
yield* validateConfig(config);
247+
// Validate configuration unless explicitly skipped (useful for preview debugging)
248+
if (process.env.SKIP_CONFIG_VALIDATE !== "true") {
249+
yield* validateConfig(config);
250+
} else {
251+
console.warn("[Config] SKIP_CONFIG_VALIDATE=true - skipping config validation");
252+
}
249253

250254
return config;
251255
});

0 commit comments

Comments
 (0)