ntfy-mcp-server
Version:
An MCP (Model Context Protocol) server designed to interact with the ntfy push notification service. It enables LLMs and AI agents to send notifications to your devices with extensive customization options.
95 lines (94 loc) • 3.47 kB
TypeScript
/**
* Interface for entity prefix configuration
*/
export interface EntityPrefixConfig {
[key: string]: string;
}
/**
* ID Generation Options
*/
export interface IdGenerationOptions {
length?: number;
separator?: string;
charset?: string;
}
/**
* Generic ID Generator class for creating and managing unique identifiers
*/
export declare class IdGenerator {
private static DEFAULT_CHARSET;
private static DEFAULT_SEPARATOR;
private static DEFAULT_LENGTH;
private entityPrefixes;
private prefixToEntityType;
/**
* Constructor that accepts entity prefix configuration
* @param entityPrefixes Map of entity types to their prefixes
*/
constructor(entityPrefixes?: EntityPrefixConfig);
/**
* Set or update entity prefixes and rebuild the reverse lookup
* @param entityPrefixes Map of entity types to their prefixes
*/
setEntityPrefixes(entityPrefixes: EntityPrefixConfig): void;
/**
* Get all registered entity prefixes
* @returns The entity prefix configuration
*/
getEntityPrefixes(): EntityPrefixConfig;
/**
* Generates a cryptographically secure random alphanumeric string
* @param length The length of the random string to generate
* @param charset Optional custom character set
* @returns Random alphanumeric string
*/
generateRandomString(length?: number, charset?: string): string;
/**
* Generates a unique ID with an optional prefix
* @param prefix Optional prefix to add to the ID
* @param options Optional generation options
* @returns A unique identifier string
*/
generate(prefix?: string, options?: IdGenerationOptions): string;
/**
* Generates a custom ID for an entity with format PREFIX_XXXXXX
* @param entityType The type of entity to generate an ID for
* @param options Optional generation options
* @returns A unique identifier string (e.g., "PROJ_A6B3J0")
* @throws {McpError} If the entity type is not registered
*/
generateForEntity(entityType: string, options?: IdGenerationOptions): string;
/**
* Validates if a given ID matches the expected format for an entity type
* @param id The ID to validate
* @param entityType The expected entity type
* @param options Optional validation options
* @returns boolean indicating if the ID is valid
*/
isValid(id: string, entityType: string, options?: IdGenerationOptions): boolean;
/**
* Strips the prefix from an ID
* @param id The ID to strip
* @param separator Optional custom separator
* @returns The ID without the prefix
*/
stripPrefix(id: string, separator?: string): string;
/**
* Determines the entity type from an ID
* @param id The ID to get the entity type for
* @param separator Optional custom separator
* @returns The entity type
* @throws {McpError} If the ID format is invalid or entity type is unknown
*/
getEntityType(id: string, separator?: string): string;
/**
* Normalizes an entity ID to ensure consistent uppercase format
* @param id The ID to normalize
* @param separator Optional custom separator
* @returns The normalized ID in uppercase format
*/
normalize(id: string, separator?: string): string;
}
export declare const idGenerator: IdGenerator;
export declare const generateUUID: () => string;
export default idGenerator;