UNPKG

@auth0/auth0-mcp-server

Version:

Auth0 Model Context Protocol (MCP) Server (Beta) — A secure and extendable implementation of an MCP server that provides AI assistants with controlled access to the Auth0 Management API through natural language. This project is in beta and not intended fo

32 lines • 1.23 kB
import { TOOLS } from '../tools/index.js'; /** * Default scopes to be used when no specific scopes are provided. * This is an empty array, meaning no scopes are required by default to * promote security by default. */ export const DEFAULT_SCOPES = []; /** * Returns a unique list of all required scopes across all tools. */ export function getAllScopes() { const allScopes = TOOLS.flatMap((tool) => tool._meta?.requiredScopes ?? []); return [...new Set(allScopes)]; } /** * Returns all tools whose required scopes are fully satisfied by the provided scopes. * Tools without declared requiredScopes are excluded. * * @param {string[]} scopes - The set of OAuth scopes available to the caller. * @returns {Tool[]} - Tools that declare requiredScopes and whose every required * scope is present in the provided set. */ export function getToolsForScopes(scopes) { const scopeSet = new Set(scopes); return TOOLS.filter((tool) => { const requiredScopes = tool._meta?.requiredScopes; if (!requiredScopes || requiredScopes.length === 0) return false; return requiredScopes.every((s) => scopeSet.has(s)); }); } //# sourceMappingURL=scopes.js.map