@dollhousemcp/mcp-server
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
80 lines • 2.41 kB
TypeScript
/**
* Input validation and sanitization functions
*/
/**
* Enhanced input validation for MCP tools
*/
export declare class MCPInputValidator {
/**
* Validate a persona identifier (name or filename)
*/
static validatePersonaIdentifier(identifier: string): string;
/**
* Validate search query for collection
*/
static validateSearchQuery(query: string): string;
/**
* Validate collection path
*/
static validateCollectionPath(path: string): string;
/**
* Validate URL for import operations
*/
static validateImportUrl(url: string): string;
/**
* Validate expiry days for sharing
*/
static validateExpiryDays(days: number): number;
/**
* Validate boolean confirmation parameters
*/
static validateConfirmation(confirm: boolean, operationName: string): boolean;
/**
* Validate field name for edit operations
*/
static validateEditField(field: string): string;
/**
* Check if hostname is a private IP address (IPv4 and IPv6)
*/
private static isPrivateIP;
/**
* Check for encoded private IP addresses that could bypass basic detection
*/
private static isEncodedPrivateIP;
}
/**
* Validate and sanitize a filename
*/
export declare function validateFilename(filename: string): string;
/**
* Validate and sanitize a path
*/
export declare function validatePath(inputPath: string, baseDir?: string): string;
/**
* Validate and sanitize a username
*/
export declare function validateUsername(username: string): string;
/**
* Validate a category
*/
export declare function validateCategory(category: string): string;
/**
* Validate content size
*/
export declare function validateContentSize(content: string, maxSize?: number): void;
/**
* Comprehensive input validation before pattern matching
* Validates all content types with appropriate limits
*/
export interface ContentValidationOptions {
maxContentLength?: number;
maxYamlLength?: number;
maxMetadataFieldLength?: number;
maxFileSize?: number;
}
export declare function validateInputLengths(content: string, contentType: 'full' | 'yaml' | 'metadata' | 'field', options?: ContentValidationOptions): void;
/**
* General input sanitization
*/
export declare function sanitizeInput(input: string, maxLength?: number): string;
//# sourceMappingURL=InputValidator.d.ts.map