UNPKG

@iflow-mcp/leetcode-mcp-server

Version:

MCP Server for LeetCode API (supports leetcode.com and leetcode.cn)

66 lines (65 loc) 3.1 kB
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { LeetCodeBaseService } from "../leetcode/leetcode-base-service.js"; /** * Abstract base registry class for LeetCode components that provides site type detection and authentication status checks. * This class defines the framework for registering different categories of components based on * site version (Global or CN) and authentication requirements. */ export declare abstract class RegistryBase { protected server: McpServer; protected leetcodeService: LeetCodeBaseService; /** * Creates a new registry instance. * * @param server - The MCP server instance to register components with * @param leetcodeService - The LeetCode service implementation to use for API calls */ constructor(server: McpServer, leetcodeService: LeetCodeBaseService); /** * Determines if the current LeetCode service is for the China version. * * @returns True if the service is for LeetCode CN, false otherwise */ protected isCN(): boolean; /** * Determines if the current LeetCode service has valid authentication credentials. * * @returns True if authenticated, false otherwise */ protected isAuthenticated(): boolean; /** * Registers all applicable components based on site version and authentication status. * This method follows a specific registration sequence to ensure proper component organization. */ register(): void; /** * Registers common components available on both Global and CN platforms that don't require authentication. * Implementing classes must define this method to register their specific common components. */ protected registerCommon(): void; /** * Registers components specific to the Global LeetCode site that don't require authentication. * Implementing classes must define this method to register their Global-specific components. */ protected registerGlobal(): void; /** * Registers components specific to the China LeetCode site that don't require authentication. * Implementing classes must define this method to register their China-specific components. */ protected registerChina(): void; /** * Registers common components available on both Global and CN platforms that require authentication. * Implementing classes must define this method to register their authenticated common components. */ protected registerAuthenticatedCommon(): void; /** * Registers components specific to the Global LeetCode site that require authentication. * Implementing classes must define this method to register their authenticated Global-specific components. */ protected registerAuthenticatedGlobal(): void; /** * Registers components specific to the China LeetCode site that require authentication. * Implementing classes must define this method to register their authenticated China-specific components. */ protected registerAuthenticatedChina(): void; }