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

Function configureAuth

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

Source from the content-addressed store, hash-verified

1169 * (returns `[]`) for an unknown slug, a stdio server, or an
1170 * undecodable config. */
1171 const configureAuth = (slug: string, input: McpConfigureAuthInput) =>
1172 Effect.gen(function* () {
1173 const record = yield* ctx.core.integrations.get(slugFrom(slug));
1174 const current = record ? parseMcpIntegrationConfig(record.config) : null;
1175 if (!current || current.transport === "stdio") {
1176 return [] as readonly McpAuthMethod[];
1177 }
1178
1179 // Replace mode declares the full set — backfill kind-based slugs.
1180 // Merge mode appends: `mergeAuthTemplates` replaces on slug match and
1181 // assigns fresh `custom_<id>` slugs to slug-less entries, so a custom
1182 // method never silently displaces a declared one.
1183 const merged =
1184 input.mode === "replace"
1185 ? normalizeMcpAuthMethods(input.authenticationTemplate)
1186 : mergeAuthTemplates(
1187 current.authenticationTemplate,
1188 expandMcpAuthMethodInputs(
1189 input.authenticationTemplate,
1190 ) as readonly McpAuthMethod[],
1191 );
1192
1193 yield* ctx.core.integrations.update(slugFrom(slug), {
1194 config: { ...current, authenticationTemplate: merged },
1195 });
1196
1197 return merged;
1198 }).pipe(
1199 Effect.withSpan("mcp.plugin.configure_auth", {
1200 attributes: { "mcp.integration.slug": slug },
1201 }),
1202 );
1203
1204 return {
1205 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