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

Function configureAuth

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

Source from the content-addressed store, hash-verified

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