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

Function describeMcpAuthMethods

packages/plugins/mcp/src/sdk/plugin.ts:877–914  ·  view source on GitHub ↗
(
  record: IntegrationRecord,
)

Source from the content-addressed store, hash-verified

875});
876
877export const describeMcpAuthMethods = (
878 record: IntegrationRecord,
879): readonly AuthMethodDescriptor[] => {
880 const config = parseMcpIntegrationConfig(record.config);
881 if (!config) return [];
882
883 // Stdio servers declare a single `stdio_env` method (or `none`); remote
884 // servers declare header/query/oauth methods. Runtime method selection uses
885 // this same truthful projection, including synthetic legacy stdio methods.
886 const methods = projectedMcpAuthMethods(config);
887 return methods.map((method: McpAuthMethod): AuthMethodDescriptor => {
888 if (method.kind === "stdio_env") return describeStdioEnvAuthMethod(method);
889 if (method.kind === "apikey") return describeApiKeyAuthMethod(method);
890 if (method.kind === "oauth2") {
891 return {
892 id: method.slug,
893 label: "OAuth",
894 kind: "oauth",
895 template: method.slug,
896 // Only remote configs carry an endpoint; stdio never reaches here with
897 // oauth2.
898 oauth: {
899 discoveryUrl: config.transport === "remote" ? config.endpoint : undefined,
900 ...(method.scopes !== undefined ? { scopes: method.scopes } : {}),
901 supportsDynamicRegistration: true,
902 // Present only when this server was configured with an enterprise
903 // identity provider. The connect path re-checks the server's metadata
904 // for the ID-JAG grant profile and falls back to interactive OAuth
905 // when it is absent, so this is an opt-in, not an override.
906 ...(method.enterpriseIdentityProvider === undefined
907 ? {}
908 : { enterpriseIdentityProvider: method.enterpriseIdentityProvider }),
909 },
910 };
911 }
912 return describeNoneAuthMethod(method.slug);
913 });
914};
915
916export const describeMcpIntegrationDisplay = (
917 record: IntegrationRecord,

Callers 1

Calls 5

describeApiKeyAuthMethodFunction · 0.90
describeNoneAuthMethodFunction · 0.90
projectedMcpAuthMethodsFunction · 0.85

Tested by

no test coverage detected