MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / toIntegrationConfig

Function toIntegrationConfig

packages/plugins/mcp/src/sdk/plugin.ts:467–503  ·  view source on GitHub ↗
(input: McpServerInput)

Source from the content-addressed store, hash-verified

465 * boundary (a value in `env` becomes something the user is asked to type),
466 * and asserting it through the whole add flow would not show it. */
467export const toIntegrationConfig = (input: McpServerInput): McpIntegrationConfigType => {
468 if (input.transport === "stdio") {
469 // The config only DECLARES the secret env vars by NAME (a `stdio_env`
470 // method); their values are credentials and live on the connection, never
471 // in this blob. Names come from the explicit `envVars` declaration and/or
472 // the keys of any one-shot `env` values.
473 const vars = stdioEnvVarNames(input);
474 const staticEnv = input.staticEnv;
475 return {
476 transport: "stdio",
477 family: input.family?.trim() || undefined,
478 command: input.command,
479 args: input.args ? [...input.args] : undefined,
480 env: staticEnv !== undefined && Object.keys(staticEnv).length > 0 ? staticEnv : undefined,
481 cwd: input.cwd,
482 versionNegotiation: input.versionNegotiation,
483 spawnPerCall: input.spawnPerCall,
484 appServer: input.appServer,
485 authenticationTemplate:
486 vars.length > 0
487 ? [{ slug: STDIO_ENV_TEMPLATE, kind: "stdio_env", vars }]
488 : [{ slug: "none", kind: "none" }],
489 };
490 }
491 return {
492 transport: "remote",
493 family: input.family?.trim() || undefined,
494 endpoint: input.endpoint,
495 remoteTransport: input.remoteTransport ?? "auto",
496 queryParams: input.queryParams,
497 headers: input.headers,
498 authenticationTemplate: input.authenticationTemplate
499 ? normalizeMcpAuthMethods(input.authenticationTemplate)
500 : [mcpAuthMethodFromShorthand(input.auth ?? { kind: "none" })],
501 versionNegotiation: input.versionNegotiation,
502 };
503};
504
505type JsonSchemaObject = Record<string, unknown> & {
506 readonly properties?: Record<string, unknown>;

Callers 2

plugin.test.tsFile · 0.90
addServerFunction · 0.85

Calls 3

normalizeMcpAuthMethodsFunction · 0.90
stdioEnvVarNamesFunction · 0.85

Tested by

no test coverage detected