Skip to main content

Class MemMachineClient

Main API client for interacting with the MemMachine RESTful service. This client provides a unified interface for memory management, project operations, and server health checks. It handles configuration and serves as the gateway to your organizations and projects.
new MemMachineClient(options: ClientOptions)
Parameters
NameTypeDescription
optionsClientOptionsConfiguration for the client, including base URL and optional API key.

Methods

project()

Creates a MemMachineProject instance for managing a specific project and its memories.
client.project(projectContext: ProjectContext)
Parameters
NameTypeDescription
projectContextProjectContextObject containing org_id and project_id.
Returns

getProjects()

Retrieves a list of all projects accessible to the client on the MemMachine server.
await client.getProjects()
Returns
  • Promise<Project[]> — A list of Project entities.
Throws

healthCheck()

Checks the connection and health status of the MemMachine server.
await client.healthCheck()
Returns
  • Promise<HealthStatus> — The HealthStatus object containing server uptime and version.

Usage Example

import { MemMachineClient } from '@memmachine/client';

const client = new MemMachineClient({ 
  base_url: 'https://your-base-url'
});

// Access a specific project
const project = client.project({ 
  org_id: 'demo_org', 
  project_id: 'main_project' 
});

// Check server status
const status = await client.healthCheck();
console.log(`Server status: ${status.status}`);