(configs: Record<string, T>)
| 534 | * `getServerCommandArray` defaults `args` to `[]` via `?? []`. |
| 535 | */ |
| 536 | export function filterMcpServersByPolicy<T>(configs: Record<string, T>): { |
| 537 | allowed: Record<string, T> |
| 538 | blocked: string[] |
| 539 | } { |
| 540 | const allowed: Record<string, T> = {} |
| 541 | const blocked: string[] = [] |
| 542 | for (const [name, config] of Object.entries(configs)) { |
| 543 | const c = config as McpServerConfig |
| 544 | if (c.type === 'sdk' || isMcpServerAllowedByPolicy(name, c)) { |
| 545 | allowed[name] = config |
| 546 | } else { |
| 547 | blocked.push(name) |
| 548 | } |
| 549 | } |
| 550 | return { allowed, blocked } |
| 551 | } |
| 552 | |
| 553 | /** |
| 554 | * Internal utility: Expands environment variables in an MCP server config |
no test coverage detected