UNPKG

@kaminaduck/scryfall-mcp-server

Version:

A Model Context Protocol (MCP) server that provides access to the Scryfall API for Magic: The Gathering card data

66 lines 2.09 kB
/** * File management utilities for the Scryfall MCP server. */ import { CardDatabase } from './database.js'; export interface ResourceInfo { card_name: string; filename: string; mime_type: string; download_date: string; set_code: string; card_id: string; } export declare class FileManager { private db; private ownsDb; constructor(db?: CardDatabase); /** * Initialize the file manager with database connection. */ init(): Promise<void>; /** * Generate a unique file ID. */ generateFileId(): string; /** * Get the file path for a given file ID. */ getFilePath(fileId: string): Promise<string | undefined>; /** * Determine the MIME type of a file. */ getMimeType(filePath: string): string; /** * Read file content by file ID with enhanced security and error handling. */ readFileContent(fileId: string): Promise<[Buffer, string] | undefined>; /** * Register a file in the database and return its file ID with enhanced validation. */ registerFile(filePath: string, cardName: string, cardId?: string, setCode?: string, imageUrl?: string): Promise<string>; /** * Clean up old temporary files. */ cleanupTempFiles(directory: string, maxAgeHours?: number): Promise<number>; /** * Recursively walk a directory and return all file paths. */ private walkDirectory; /** * Validate that a resource access is allowed with comprehensive security checks. */ validateResourceAccess(resourceType: string, fileId: string): Promise<boolean>; /** * Get comprehensive information about a resource, matching Python version functionality. */ getResourceInfo(fileId: string): Promise<ResourceInfo | undefined>; /** * Close the database connection if we own it. */ close(): void; } /** * Create a file manager instance with automatic initialization. */ export declare function createFileManager(db?: CardDatabase): Promise<FileManager>; //# sourceMappingURL=fileManager.d.ts.map