---
title: Mem0
icon: /images/mem0.svg
description: Mount scoped Mem0 Platform memories as JSON files from Node or the browser.
---

`Mem0Resource` is a browser-safe, read-only view of one Mem0 user, agent, or run scope. Every memory is rendered as `<memory-id>.json`; `search` performs semantic search in that same scope.

<Warning>
  Mem0 API keys are secrets. Use this resource from Node or another trusted runtime; do not embed a Platform API key in a public browser bundle. Browser applications should call a server-side proxy instead.
</Warning>

```ts
import { Mem0Resource, MountMode, Workspace } from '@struktoai/mirage-node'

const memories = new Mem0Resource({
  apiKey: process.env.MEM0_API_KEY!,
  userId: 'alex',
})

const ws = new Workspace({ '/memories': memories }, { mode: MountMode.READ })
await ws.execute('ls /memories/')
await ws.execute('search --top-k 5 "quarterly planning" /memories/')
```

Exactly one of `userId`, `agentId`, or `runId` is required.

| Field | Default | Notes |
| --- | --- | --- |
| `apiKey` | required | Mem0 Platform API key. Redacted in snapshots. |
| `host` | `https://api.mem0.ai` | Mem0 API base URL. |
| `userId`, `agentId`, `runId` | one required | Scope filter applied to listing and search. |
| `defaultPageSize` | `100` | Page size while listing memories. |
| `defaultSearchLimit` | `10` | Default semantic result count. |

The TypeScript resource mirrors the [Python Mem0 resource](/python/resource/mem0), including pagination, JSON rendering, score formatting, path-limited search, and `--threshold`.
