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