UNPKG

@pluggedin/pluggedin-mcp-proxy

Version:

Unified MCP proxy that aggregates all your MCP servers (STDIO, SSE, Streamable HTTP) into one powerful interface. Access any tool through a single connection, search across unified documents with built-in RAG, and receive notifications from any model. Tes

58 lines (57 loc) 2.65 kB
import { NotificationHandlers } from "./notification-handlers.js"; import { DocumentHandlers } from "./document-handlers.js"; import { SetupHandlers } from "./setup-handlers.js"; /** * Handles execution of static tools that are built into the Plugged.in MCP proxy. * Delegates to domain-specific handlers for better organization and maintainability. */ export class StaticToolHandlers { toolToServerMap; instructionToServerMap; notificationHandlers; documentHandlers; setupHandlers; constructor(toolToServerMap, instructionToServerMap) { this.toolToServerMap = toolToServerMap; this.instructionToServerMap = instructionToServerMap; this.notificationHandlers = new NotificationHandlers(); this.documentHandlers = new DocumentHandlers(); this.setupHandlers = new SetupHandlers(toolToServerMap, instructionToServerMap); } /** * Route tool calls to appropriate domain handlers */ async handleStaticTool(toolName, args) { switch (toolName) { // Setup and discovery tools case 'pluggedin_setup': return this.setupHandlers.handleSetup(args); case 'pluggedin_discover_tools': return this.setupHandlers.handleDiscoverTools(args); case 'pluggedin_rag_query': return this.setupHandlers.handleRagQuery(args); // Notification tools case 'pluggedin_send_notification': return this.notificationHandlers.handleSendNotification(args); case 'pluggedin_list_notifications': return this.notificationHandlers.handleListNotifications(args); case 'pluggedin_mark_notification_read': return this.notificationHandlers.handleMarkNotificationRead(args); case 'pluggedin_delete_notification': return this.notificationHandlers.handleDeleteNotification(args); // Document tools case 'pluggedin_create_document': return this.documentHandlers.handleCreateDocument(args); case 'pluggedin_list_documents': return this.documentHandlers.handleListDocuments(args); case 'pluggedin_search_documents': return this.documentHandlers.handleSearchDocuments(args); case 'pluggedin_get_document': return this.documentHandlers.handleGetDocument(args); case 'pluggedin_update_document': return this.documentHandlers.handleUpdateDocument(args); default: return null; // Not a static tool } } }