Skip to main content
Glama

MCP Memory Server

by keleshteri
test-memory.jsโ€ข3.67 kB
#!/usr/bin/env node /** * Test script for MCP Memory Server functionality * This script helps test the memory recording and folder mapping features */ import { MCPMemoryServer } from './dist/index.js'; import chalk from 'chalk'; import * as path from 'path'; import * as fs from 'fs-extra'; async function testMemoryFunctionality() { console.log(chalk.blue('๐Ÿงช Testing MCP Memory Server functionality\n')); try { // Create server instance const server = new MCPMemoryServer(); console.log(chalk.green('โœ… Server instance created successfully')); // Test project root detection const currentDir = process.cwd(); console.log(chalk.blue(`๐Ÿ“ Current directory: ${currentDir}`)); // Check if .ai-memory folder exists const memoryDir = path.join(currentDir, '.ai-memory'); const memoryExists = await fs.pathExists(memoryDir); console.log(chalk.blue(`๐Ÿ“‚ .ai-memory folder exists: ${memoryExists}`)); if (memoryExists) { // List contents of .ai-memory folder const contents = await fs.readdir(memoryDir); console.log(chalk.blue(`๐Ÿ“‹ Memory folder contents: ${contents.join(', ')}`)); // Check if project-memory.json exists const projectMemoryPath = path.join(memoryDir, 'project-memory.json'); const projectMemoryExists = await fs.pathExists(projectMemoryPath); if (projectMemoryExists) { const projectMemory = await fs.readJson(projectMemoryPath); console.log(chalk.green('โœ… Project memory file found and readable')); console.log(chalk.yellow('๐Ÿ“„ Project memory preview:')); console.log(JSON.stringify({ projectName: projectMemory.projectContext?.name, currentSessionTask: projectMemory.currentSession?.task, completedStepsCount: projectMemory.currentSession?.completedSteps?.length || 0, globalDecisionsCount: projectMemory.globalDecisions?.length || 0 }, null, 2)); } else { console.log(chalk.yellow('โš ๏ธ Project memory file not found')); } } else { console.log(chalk.yellow('โš ๏ธ .ai-memory folder not found')); console.log(chalk.blue('๐Ÿ’ก This is normal for a new project - it will be created on first use')); } // Test folder structure analysis const srcDir = path.join(currentDir, 'src'); const srcExists = await fs.pathExists(srcDir); if (srcExists) { console.log(chalk.green('โœ… src directory found - ready for folder mapping')); // List src subdirectories const srcContents = await fs.readdir(srcDir, { withFileTypes: true }); const subdirs = srcContents.filter(item => item.isDirectory()).map(item => item.name); if (subdirs.length > 0) { console.log(chalk.blue(`๐Ÿ“ Source subdirectories: ${subdirs.join(', ')}`)); console.log(chalk.blue('๐Ÿ’ก These directories can have _map.md files generated')); } else { console.log(chalk.yellow('๐Ÿ“ No subdirectories in src - maps will be generated for src itself')); } } else { console.log(chalk.yellow('โš ๏ธ src directory not found')); } console.log(chalk.green('\nโœ… Memory system test completed successfully!')); console.log(chalk.blue('\n๐Ÿš€ Next steps:')); console.log(chalk.blue('1. Run: npm install (to install new dependencies)')); console.log(chalk.blue('2. Run: npm run build (to compile TypeScript)')); console.log(chalk.blue('3. Test MCP tools using your MCP client')); } catch (error) { console.error(chalk.red('โŒ Test failed:'), error); process.exit(1); } } // Run the test testMemoryFunctionality();

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/keleshteri/mcp-memory'

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