The primary entry point for the MemMachine TypeScript REST client library.
Overview
The MemMachineClient serves as the unified API for memory management, project operations, and server health checks. It is designed to be the starting point for all interactions with the MemMachine service.
Key Features
Hierarchical Management: Generate MemMachineMemory and MemMachineProject instances for scoped operations.
Resource Discovery: List all projects accessible to your API key.
Observability: Access Prometheus metrics and perform real-time health checks on the server.
The following example demonstrates the recommended pattern for initializing the client and traversing to a specific project and memory instance.
import MemMachineClient from '@memmachine/client';async function main() { // 1. Initialize the client const client = new MemMachineClient({ api_key: 'your_api_key' }); // 2. Access a specific project const project = client.project({ org_id: 'your_org_id', project_id: 'your_project_id' }); // 3. Initialize memory for that project const memory = project.memory(); // 4. Perform high-level health checks const status = await client.healthCheck(); console.log(`Server Status: ${status.status}`);}main();
For best performance, reuse a single MemMachineClient instance across your application to leverage connection pooling through the internal AxiosInstance.