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

46 lines • 1.67 kB
import * as fs from 'fs'; /** * Ensures that a directory exists on disk. * * If the directory does not already exist, it will be created recursively. * Throws an error if the directory cannot be created. * * @param dir - The absolute path of the directory to ensure exists. * @throws Error if directory creation fails due to filesystem errors. */ export function ensureDir(dir) { try { fs.mkdirSync(dir, { recursive: true }); } catch (err) { throw new Error(`Failed to create directory: ${err.message}`); } } /** * Resolves the appropriate configuration directory path for the current operating system. * * Accepts an object mapping platform identifiers (`darwin`, `win32`, `linux`) to path templates. * On Windows, replaces `{APPDATA}` placeholders with the actual APPDATA environment variable. * * @param paths - An object containing platform-specific path templates. * @returns The resolved configuration path for the current platform. * @throws Error if the platform is unsupported or required environment variables are missing. */ export function getPlatformPath(paths) { switch (process.platform) { case 'darwin': return paths.darwin; case 'win32': { const APPDATA = process.env.APPDATA; if (!APPDATA) { throw new Error('APPDATA environment variable not set'); } return paths.win32.replace('{APPDATA}', APPDATA); } case 'linux': return paths.linux; default: throw new Error(`Unsupported operating system: ${process.platform}`); } } //# sourceMappingURL=utils.js.map