( record: PluginRecord, name: string, config: McpServerConfig, )
| 449 | } |
| 450 | |
| 451 | function pluginMcpServerInfo( |
| 452 | record: PluginRecord, |
| 453 | name: string, |
| 454 | config: McpServerConfig, |
| 455 | ): PluginMcpServerInfo { |
| 456 | if (config.transport === 'http' || config.transport === 'sse') { |
| 457 | return { |
| 458 | name, |
| 459 | runtimeName: pluginMcpRuntimeName(record.id, name), |
| 460 | enabled: isMcpServerEnabled(record, name, config), |
| 461 | transport: config.transport, |
| 462 | url: config.url, |
| 463 | headerKeys: config.headers === undefined ? undefined : Object.keys(config.headers).toSorted(), |
| 464 | }; |
| 465 | } |
| 466 | return { |
| 467 | name, |
| 468 | runtimeName: pluginMcpRuntimeName(record.id, name), |
| 469 | enabled: isMcpServerEnabled(record, name, config), |
| 470 | transport: 'stdio', |
| 471 | command: config.command, |
| 472 | args: config.args, |
| 473 | cwd: config.cwd, |
| 474 | envKeys: config.env === undefined ? undefined : Object.keys(config.env).toSorted(), |
| 475 | }; |
| 476 | } |
| 477 | |
| 478 | function withMcpServerEnabled(config: McpServerConfig, enabled: boolean): McpServerConfig { |
| 479 | return { ...config, enabled }; |
no test coverage detected