433
*/
434
export function normalizeMcpServerConfiguration(rawConfig: unknown): IMcpServerConfiguration | undefined {
436
return undefined;
437
}
438
439
const candidate = rawConfig as Record<string, unknown>;
440
>
const type = typeof candidate['type'] === 'string' ? candidate['type'] : undefined;
pluginParsers.ts
441
>
442
>
const command = typeof candidate['command'] === 'string' ? candidate['command'] : undefined;
443
>
const url = typeof candidate['url'] === 'string' ? candidate['url'] : undefined;
444
>
const args = Array.isArray(candidate['args']) ? candidate['args'].filter((value): value is string => typeof value === 'string') : undefined;
445
>
const env = candidate['env'] && typeof candidate['env'] === 'object'
446
? Object.fromEntries(Object.entries(candidate['env'] as Record<string, unknown>)
447
.filter(([, value]) => typeof value === 'string' || typeof value === 'number' || value === null)
448
.map(([key, value]) => [key, value as string | number | null]))
449
: undefined;
450
>
const envFile = typeof candidate['envFile'] === 'string' ? candidate['envFile'] : undefined;
pluginParsers.ts
451
>
const cwd = typeof candidate['cwd'] === 'string' ? candidate['cwd'] : undefined;
452
>
const headers = candidate['headers'] && typeof candidate['headers'] === 'object'
453
? Object.fromEntries(Object.entries(candidate['headers'] as Record<string, unknown>)
454
.filter(([, value]) => typeof value === 'string')
455
.map(([key, value]) => [key, value as string]))
456
: undefined;
457
>
const dev = candidate['dev'] && typeof candidate['dev'] === 'object' ? candidate['dev'] as IMcpStdioServerConfiguration['dev'] : undefined;
pluginParsers.ts
458
>
459
>
if (type === 'ws') {
460
return undefined;
461
}
462
463
>
if (type === McpServerType.LOCAL || (!type && command)) {
pluginParsers.ts
464
if (!command) {
465
return undefined;