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

105 lines 3.27 kB
/** * Database management for tracking downloaded Scryfall cards. */ import Database from 'better-sqlite3'; export interface CardRecord { id: number; card_name: string; filename: string; download_date: string; card_id: string | null; set_code: string | null; image_url: string | null; file_id: string; } export declare class CardDatabase { private db; private dbPath; constructor(dbPath?: string); /** * Initialize the database connection and schema. */ init(dbPath?: string): Promise<void>; /** * Create the necessary tables if they don't exist. */ private initDb; /** * Check database integrity and repair common issues. */ checkDatabaseIntegrity(): Promise<void>; /** * Repair database by removing orphaned records and fixing common issues. */ repairDatabase(): Promise<{ recordsRemoved: number; issuesFixed: number; }>; /** * Check if a card has already been downloaded. */ cardExists(cardName: string): boolean; cardExists(cardName: string, checkAllFaces: boolean): boolean; /** * Add a card to the database after downloading. */ addCard(cardName: string, filename: string, cardId?: string, setCode?: string, imageUrl?: string, fileId?: string): string; /** * Get information about a downloaded card. */ getCardInfo(cardName: string): CardRecord | undefined; /** * Extract base card name from a potentially face-specific card name. * For transform cards, removes the face suffix. */ private extractBaseName; /** * Get all faces of a card by its base name. */ getCardsByBaseName(baseName: string): CardRecord[]; /** * Get all faces of a specific card version. */ getTransformCardFaces(cardName: string, setCode?: string, collectorNumber?: string): CardRecord[]; /** * Check if a card has multiple faces in the database. */ isTransformCard(cardName: string): boolean; /** * Add a transform card face with specific face information. */ addTransformCardFace(baseName: string, faceName: string, faceIndex: number, filename: string, cardId?: string, setCode?: string, imageUrl?: string, fileId?: string): string; /** * Get information about a specific face of a card. */ getCardFaceInfo(cardName: string, faceIndex: number): CardRecord | undefined; /** * Get a list of all downloaded cards. */ getAllCards(): CardRecord[]; /** * Remove a card from the database. */ removeCard(cardName: string): boolean; /** * Get card information by file ID. */ getCardByFileId(fileId: string): CardRecord | undefined; /** * Get the file path for a given file ID. */ getFilePathById(fileId: string): string | undefined; /** * Close the database connection. */ close(): void; /** * Get the underlying database instance for advanced operations. */ getDatabase(): Database.Database; } /** * Create a database instance with automatic initialization. */ export declare function createCardDatabase(dbPath?: string): Promise<CardDatabase>; //# sourceMappingURL=database.d.ts.map