Skip to main content
Glama

meMCP - Memory-Enhanced Model Context Protocol

MIT License
23
2
MemoryTools.js2.88 kB
import { z } from 'zod'; import { MemoryOperations } from './modules/MemoryOperations.js'; import { MemoryQueryHandler } from './modules/MemoryQueryHandler.js'; import { MemoryStreamingTools } from './modules/MemoryStreamingTools.js'; import { MemoryManagement } from './modules/MemoryManagement.js'; export class MemoryTools { constructor(factStore, processor, qualityScorer) { this.factStore = factStore; this.processor = processor; this.qualityScorer = qualityScorer; // Initialize modular components this.operations = new MemoryOperations(factStore, qualityScorer); this.queryHandler = new MemoryQueryHandler(factStore, processor); this.streamingTools = new MemoryStreamingTools(factStore); this.management = new MemoryManagement(factStore); // Maintain backward compatibility this.streamingManager = this.streamingTools.getStreamingManager(); } async registerTools(server) { // Register tools from modular components this.operations.registerTools(server); this.queryHandler.registerTools(server); this.streamingTools.registerTools(server); this.management.registerTools(server); } // Delegate methods to modular components for backward compatibility async handleStoreInsight(args) { return await this.operations.handleStoreInsight(args); } async handleQuery(args) { return await this.queryHandler.handleQuery(args); } async handleUpdateFact(args) { return await this.operations.handleUpdateFact(args); } async handleDeleteFact(args) { return await this.operations.handleDeleteFact(args); } async handleGetStats(args) { return await this.operations.handleGetStats(args); } async handleGetRelated(args) { return await this.operations.handleGetRelated(args); } async handleBulkProcess(args) { return await this.queryHandler.handleBulkProcess(args); } async handleCleanup(args) { return await this.management.handleCleanup(args); } // Backward compatibility methods // Direct method for storing insights (used by slash commands) async storeInsight(insight) { return await this.operations.storeInsight(insight); } // Additional convenience methods that delegate to modules async searchSimilarFacts(factId, options = {}) { return await this.queryHandler.searchSimilarFacts(factId, options); } async getFactKeywords(factId, topN = 10) { return await this.queryHandler.getFactKeywords(factId, topN); } async getSemanticStats() { return await this.queryHandler.getSemanticStats(); } async createBatchStream(query, options = {}) { return await this.streamingTools.createBatchStream(query, options); } async getStreamStats() { return await this.streamingTools.getStreamStats(); } async getMaintenanceStats() { return await this.management.getMaintenanceStats(); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mixelpixx/meMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server