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

Function configureAuth

packages/plugins/mcp/src/sdk/plugin.ts:1130–1161  ·  view source on GitHub ↗
(slug: string, input: McpConfigureAuthInput)

Source from the content-addressed store, hash-verified

1128 * (returns `[]`) for an unknown slug, a stdio server, or an
1129 * undecodable config. */
1130 const configureAuth = (slug: string, input: McpConfigureAuthInput) =>
1131 Effect.gen(function* () {
1132 const record = yield* ctx.core.integrations.get(slugFrom(slug));
1133 const current = record ? parseMcpIntegrationConfig(record.config) : null;
1134 if (!current || current.transport === "stdio") {
1135 return [] as readonly McpAuthMethod[];
1136 }
1137
1138 // Replace mode declares the full set — backfill kind-based slugs.
1139 // Merge mode appends: `mergeAuthTemplates` replaces on slug match and
1140 // assigns fresh `custom_<id>` slugs to slug-less entries, so a custom
1141 // method never silently displaces a declared one.
1142 const merged =
1143 input.mode === "replace"
1144 ? normalizeMcpAuthMethods(input.authenticationTemplate)
1145 : mergeAuthTemplates(
1146 current.authenticationTemplate,
1147 expandMcpAuthMethodInputs(
1148 input.authenticationTemplate,
1149 ) as readonly McpAuthMethod[],
1150 );
1151
1152 yield* ctx.core.integrations.update(slugFrom(slug), {
1153 config: { ...current, authenticationTemplate: merged },
1154 });
1155
1156 return merged;
1157 }).pipe(
1158 Effect.withSpan("mcp.plugin.configure_auth", {
1159 attributes: { "mcp.integration.slug": slug },
1160 }),
1161 );
1162
1163 return {
1164 probeEndpoint,

Callers

nothing calls this directly

Calls 7

normalizeMcpAuthMethodsFunction · 0.90
mergeAuthTemplatesFunction · 0.90
slugFromFunction · 0.85
getMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected