Skip to main content
Glama
testHelpers.ts1.22 kB
/** * Test helper functions for common test patterns */ import { CognitiveMCPServer } from "../../server/CognitiveMCPServer.js"; import { TestCleanup } from "./testCleanup.js"; /** * Create a test server with automatic cleanup */ export async function createTestServer(): Promise<CognitiveMCPServer> { await TestCleanup.createTempBrainDir(); const server = new CognitiveMCPServer(); await server.initialize(true); // Initialize in test mode return server; } /** * Setup test environment with brain directory */ export async function setupTestBrainDir(): Promise<string> { return await TestCleanup.createTempBrainDir(); } /** * Create test memory file path */ export function createTestMemoryPath(): string { return TestCleanup.getTestFilePath("test-memory", ".json"); } /** * Create test data directory */ export async function createTestDataDir(): Promise<string> { const testDir = await TestCleanup.createTempDir("./tmp"); return testDir; } /** * Standard afterEach cleanup for cognitive tests */ export async function standardTestCleanup( server?: CognitiveMCPServer ): Promise<void> { if (server?.isInitialized()) { await server.shutdown(); } await TestCleanup.cleanup(); }

Latest Blog Posts

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/keyurgolani/ThoughtMcp'

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