@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
48 lines (47 loc) • 2.56 kB
TypeScript
declare function requestAuthorization(selectedScopes?: string[], interaction?: boolean): Promise<void>;
export declare function refreshAccessToken(selectedScopes?: string[]): Promise<string | null>;
/**
* Revokes the refresh token that is previously set within keychain when offline_access is requested.
* Returns true if the call is successful or if the refresh token does not exist.
* @returns {Promise<boolean>}
*/
export declare function revokeRefreshToken(): Promise<boolean>;
/**
* Determines if the current access token is expired or will expire soon.
*
* This security check is crucial for maintaining continuous authenticated access
* to Auth0 APIs. It includes a configurable buffer time to proactively detect
* tokens that will expire soon, preventing potential disruptions during operations
* that might span multiple API calls. This proactive approach allows the system to
* initiate refresh flows before actual expiration occurs.
*
* The function considers a token expired in the following cases:
* - No expiration time is found in the keychain via `keychain.getTokenExpiresAt()`
* - Current time + buffer exceeds the token's expiration time
* - Error occurs during expiration check (fails secure)
*
* This function is used both by `validateAuthorization()` in `run.ts` for user-friendly
* startup validation and by `validateConfig()` for continuous runtime validation.
*
* @param {number} bufferSeconds - Seconds before actual expiration to consider token expired (default: 300s/5min)
* @returns {Promise<boolean>} True if token is expired or will expire within the buffer period
*/
export declare function isTokenExpired(bufferSeconds?: number): Promise<boolean>;
/**
* Retrieves a valid access token for Auth0 API operations.
*
* This function serves as the main entry point for credential retrieval,
* ensuring that only valid, non-expired tokens are provided to API operations.
* It implements a critical security checkpoint that prevents operations from
* proceeding with invalid authentication, which could lead to API failures
* or unpredictable behavior.
*
* The function performs these key security checks:
* 1. Verifies token expiration status using isTokenExpired
* 2. Provides clear guidance to users when re-authentication is needed
* 3. Handles errors gracefully with a fail-secure approach
*
* @returns {Promise<string|null>} A valid access token, or null if no valid token is available
*/
export declare function getValidAccessToken(): Promise<string | null>;
export { requestAuthorization };