memcontext-sdk is the official TypeScript SDK for the MemContext public API. It is a small typed wrapper around the REST API with API key auth, scope/project helpers, typed responses, and normalized API errors.
Install
Quickstart
withScope() for the hard end-user or tenant boundary. Use withProject() only as a grouping filter inside that scope.
Client Setup
| Option | Required | Description |
|---|---|---|
apiKey | Yes | MemContext API key from the dashboard. |
baseUrl | No | API base URL. Defaults to https://api.memcontext.in. |
scope | No | Default hard isolation boundary for this client instance. |
project | No | Default project grouping inside the selected scope. |
fetch | No | Custom fetch implementation for tests or custom runtimes. |
Scope Helpers
withScope(scope)
Creates a new client with a default scope. Use this when one API key serves multiple app users, workspaces, organizations, or tenants.
withProject(project)
Creates a new client with a default project. Projects are soft grouping filters inside the current scope.
Methods
save(request, options?)
Saves durable memory. MemContext automatically handles embeddings, deduplication, relationship classification, and versioning.
status set to saved, updated, extended, or duplicate.
search(request)
Searches memories using hybrid retrieval. Use full natural-language questions for best results.
{ found, memories }, where each memory includes content, category, scope, project, relevance, and createdAt as a Date.
list(request?)
Lists current non-deleted memories with pagination and filters.
{ memories, total, hasMore }.
get(memoryId, options?)
Fetches one memory by ID. Pass scope when retrieving scoped memories from a base client.
update(memoryId, request, options?)
Updates memory content, category, or project. Content updates may create relations or supersede related memories.
delete(memoryId, options?)
Soft-deletes a memory so it no longer appears in search or list results.
forget(memoryId, options?)
Endpoint-parity alias for soft delete. Prefer delete() unless you specifically want the /forget response shape.
feedback(memoryId, request, options?)
Records retrieval quality feedback. Feedback helps improve future ranking.
type can be helpful, not_helpful, outdated, or wrong.
history(memoryId, options?)
Returns the current memory and previous versions in its version chain.
profile(options?)
Returns pre-aggregated profile context split into stable and recent memory.
{ static, dynamic }.
graph(options?)
Returns graph visualization data for memories in the selected scope.
{ nodes, links, meta }.
health(signal?)
Checks API health.
Error Handling
Failed API responses throwMemContextApiError.
Links
- Website: memcontext.in
- Official docs: docs.memcontext.in
- API reference: REST API
