(input: McpServerInput)
| 430 | * boundary (a value in `env` becomes something the user is asked to type), |
| 431 | * and asserting it through the whole add flow would not show it. */ |
| 432 | export const toIntegrationConfig = (input: McpServerInput): McpIntegrationConfigType => { |
| 433 | if (input.transport === "stdio") { |
| 434 | // The config only DECLARES the secret env vars by NAME (a `stdio_env` |
| 435 | // method); their values are credentials and live on the connection, never |
| 436 | // in this blob. Names come from the explicit `envVars` declaration and/or |
| 437 | // the keys of any one-shot `env` values. |
| 438 | const vars = stdioEnvVarNames(input); |
| 439 | const staticEnv = input.staticEnv; |
| 440 | return { |
| 441 | transport: "stdio", |
| 442 | family: input.family?.trim() || undefined, |
| 443 | command: input.command, |
| 444 | args: input.args ? [...input.args] : undefined, |
| 445 | env: staticEnv !== undefined && Object.keys(staticEnv).length > 0 ? staticEnv : undefined, |
| 446 | cwd: input.cwd, |
| 447 | versionNegotiation: input.versionNegotiation, |
| 448 | spawnPerCall: input.spawnPerCall, |
| 449 | appServer: input.appServer, |
| 450 | authenticationTemplate: |
| 451 | vars.length > 0 |
| 452 | ? [{ slug: STDIO_ENV_TEMPLATE, kind: "stdio_env", vars }] |
| 453 | : [{ slug: "none", kind: "none" }], |
| 454 | }; |
| 455 | } |
| 456 | return { |
| 457 | transport: "remote", |
| 458 | family: input.family?.trim() || undefined, |
| 459 | endpoint: input.endpoint, |
| 460 | remoteTransport: input.remoteTransport ?? "auto", |
| 461 | queryParams: input.queryParams, |
| 462 | headers: input.headers, |
| 463 | authenticationTemplate: input.authenticationTemplate |
| 464 | ? normalizeMcpAuthMethods(input.authenticationTemplate) |
| 465 | : [mcpAuthMethodFromShorthand(input.auth ?? { kind: "none" })], |
| 466 | versionNegotiation: input.versionNegotiation, |
| 467 | }; |
| 468 | }; |
| 469 | |
| 470 | type JsonSchemaObject = Record<string, unknown> & { |
| 471 | readonly properties?: Record<string, unknown>; |
no test coverage detected