@mseep/mcp-codex-keeper
Version:
An intelligent MCP server that serves as a guardian of development knowledge, providing AI assistants with curated access to latest documentation and best practices
115 lines (114 loc) • 3.37 kB
TypeScript
import { DocSource } from '../types/index.js';
/**
* Error thrown when file system operations fail
*/
export declare class FileSystemError extends Error {
readonly cause?: unknown | undefined;
constructor(message: string, cause?: unknown | undefined);
}
/**
* Configuration for cache management
*/
interface CacheConfig {
maxSize: number;
maxAge: number;
cleanupInterval: number;
}
/**
* Manages file system operations for documentation storage
*/
export declare class FileSystemManager {
private docsPath;
private sourcesFile;
private cacheDir;
private cacheConfig;
private cleanupTimer?;
/**
* Creates a new FileSystemManager instance
* @param basePath - Base path for storing documentation
*/
constructor(basePath: string, cacheConfig?: CacheConfig);
/**
* Starts the cache cleanup timer
*/
private startCleanupTimer;
/**
* Cleans up old cache files
*/
private cleanupCache;
/**
* Ensures required directories exist
* @throws {FileSystemError} If directory creation fails
*/
ensureDirectories(): Promise<void>;
/**
* Saves documentation content to cache using streams
* @param name - Documentation name
* @param content - Content to save
* @throws {FileSystemError} If save operation fails
*/
saveDocumentation(name: string, content: string): Promise<void>;
/**
* Saves documentation sources metadata
* @param docs - Array of documentation sources
* @throws {FileSystemError} If save operation fails
*/
saveSources(docs: DocSource[]): Promise<void>;
/**
* Loads documentation sources metadata
* @returns Array of documentation sources
* @throws {FileSystemError} If load operation fails
*/
loadSources(): Promise<DocSource[]>;
/**
* Searches for text in cached documentation using streams
* @param name - Documentation name
* @param searchQuery - Text to search for
* @returns Whether the text was found
*/
searchInDocumentation(name: string, searchQuery: string): Promise<boolean>;
/**
* Lists all cached documentation files
* @returns Array of filenames
* @throws {FileSystemError} If directory reading fails
*/
listDocumentationFiles(): Promise<string[]>;
/**
* Gets documentation file path
* @param name - Documentation name
* @returns Path to documentation file
*/
getDocumentationPath(name: string): string;
/**
* Checks if documentation exists in cache
* @param name - Documentation name
* @returns Whether documentation exists
*/
hasDocumentation(name: string): Promise<boolean>;
/**
* Gets documentation file name
* @param name - Documentation name
* @returns Sanitized file name
*/
private getDocumentationFileName;
/**
* Gets base documentation path
* @returns Base path for documentation storage
*/
getDocsPath(): string;
/**
* Gets cache directory path
* @returns Path to cache directory
*/
getCachePath(): string;
/**
* Updates cache configuration
* @param config - New cache configuration
*/
updateCacheConfig(config: Partial<CacheConfig>): void;
/**
* Cleanup resources
*/
destroy(): void;
}
export {};