@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
75 lines (74 loc) • 3.15 kB
TypeScript
import type { ClientOptions } from '../utils/types.js';
import type { ServerConfig, ClientConfig, ClientManager, ClientType } from './types.js';
/**
* Abstract base class providing common functionality for all supported MCP client managers.
*
* Subclasses should extend this class to handle client-specific configuration paths and custom behaviors.
*/
export declare abstract class BaseClientManager implements ClientManager {
protected readonly clientType: ClientType;
readonly displayName: string;
protected readonly capabilities?: string[];
/**
* Initializes a new BaseClientManager instance.
*
* @param options - Configuration options including client type, display name, and optional capabilities.
*/
constructor(options: {
clientType: ClientType;
displayName: string;
capabilities?: string[];
});
/**
* Returns the absolute path to the client's configuration file.
*
* Subclasses must implement this method to provide client-specific path resolution.
* Implementations are responsible for ensuring any necessary directories exist.
*
* @returns The resolved configuration file path.
*/
abstract getConfigPath(): string;
/**
* Updates the client’s configuration with Auth0 MCP server settings.
*
* Loads the existing configuration, applies updates for the MCP server,
* and writes the updated configuration back to disk.
*
* @param options - Client configuration options such as enabled tools and read-only mode.
*/
configure(options: ClientOptions): Promise<void>;
/**
* Creates an MCP server configuration entry based on the provided client options.
*
* This method transforms the user’s options into a command, arguments,
* environment variables, and optional capabilities that the client will use to start the MCP server.
*
* Subclasses may override this method if additional customization of the server config is needed.
*
* @param options - Options controlling server configuration, such as selected tools and read-only mode.
* @returns A fully-formed ServerConfig object.
* @protected
*/
protected createServerConfig(options: ClientOptions): ServerConfig;
/**
* Loads the client’s configuration from disk.
*
* Attempts to read and parse the configuration file at the given path.
* Returns a default configuration object if the file is missing or cannot be read.
*
* @param configPath - Path to the client’s configuration file.
* @returns A parsed ClientConfig object.
* @protected
*/
protected readConfig(configPath: string): ClientConfig;
/**
* Writes the provided configuration object to disk.
*
* Serializes the configuration to formatted JSON and saves it at the specified path.
*
* @param configPath - Path where the configuration should be saved.
* @param config - Configuration object to serialize and write.
* @protected
*/
protected writeConfig(configPath: string, config: ClientConfig): void;
}