UNPKG

jezweb-mcp-core

Version:

Jezweb Model Context Protocol (MCP) Core - A universal server for providing AI tools and resources, designed for seamless integration with various AI models and clients. Features adaptable multi-provider support, comprehensive tool and resource management

60 lines 2.24 kB
/** * NPM Package MCP Handler - Modern ESM Implementation * * This handler uses the shared BaseMCPHandler architecture with the SimpleMCPHandlerConfig * interface for streamlined configuration. It loads configuration from environment variables * using dotenv and provides a clean, modern interface for MCP protocol handling. * * Key features: * - Uses SimpleMCPHandlerConfig for simplified configuration * - Automatic .env file loading via dotenv * - Direct OpenAI API integration via BaseMCPHandler * - Modern ESM module structure * - Simplified error handling and JSON-RPC compliance * - Integrated provider registry system */ import { JsonRpcRequest, JsonRpcResponse } from '../../shared/types/index.js'; import { SimpleMCPHandlerConfig } from '../../shared/core/base-mcp-handler.js'; /** * Modern MCP Handler for NPM Package * * This class provides a simplified interface to the BaseMCPHandler using * the SimpleMCPHandlerConfig interface and environment-based configuration. */ export declare class MCPHandler { private baseMCPHandler; private config; constructor(apiKey: string); /** * Create and initialize the provider registry synchronously * This creates the registry and registers the factory, but doesn't initialize providers yet */ private static createProviderRegistry; /** * Static factory method for proper async initialization * Use this method instead of the constructor when you need to ensure * the provider registry is fully initialized before use */ static create(apiKey: string): Promise<MCPHandler>; /** * Handle incoming MCP requests using the shared BaseMCPHandler */ handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse>; /** * Get registry statistics (for debugging) */ getStats(): import("@shared/core/tool-registry.js").ToolRegistryStats; /** * Check if handler is initialized */ isInitialized(): boolean; /** * Update API key and reinitialize if needed */ updateApiKey(apiKey: string): void; /** * Get current configuration (for debugging) */ getConfig(): SimpleMCPHandlerConfig; } //# sourceMappingURL=mcp-handler.d.ts.map