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. Larger notes may be accepted for asynchronous extraction into atomic memories.
status set to saved, updated, extended, duplicate, or accepted.
When status is accepted, the response includes a jobId and message for tracking extraction into atomic memories.
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?)
Removes a memory from future search and list results.
forget(memoryId, options?)
Endpoint-parity alias for 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.
Workspace Methods
Context Vault uses workspaces for shared knowledge. These methods require an API key or dashboard session that belongs to the user.listWorkspaces()
Lists workspaces the current user belongs to.
createWorkspace(request)
Creates a workspace and assigns the current user as owner.
inviteWorkspaceMember(workspaceId, request)
Sends an email invitation for another workspace member. Roles can be admin,
member, or viewer. The user is added only after accepting the invite.
listWorkspaceTeam(workspaceId)
Lists current members and pending invitations.
updateWorkspaceMember(workspaceId, memberId, request)
Updates a member role. Owners cannot be changed through this method.
removeWorkspaceMember(workspaceId, memberId)
Removes a non-owner member from the workspace.
revokeWorkspaceInvitation(workspaceId, invitationId)
Revokes a pending invitation before it is accepted.
acceptWorkspaceInvitation(request)
Accepts a workspace invitation token.
Context Vault Methods
Context Vault methods let you add documents, list processing status, search workspace knowledge, and collect feedback from your app.ingestContextVaultDocument(request, options?)
Adds extracted text, a public file URL, or a documentation URL to a workspace.
llms.txt, MemContext uses the page map and ingests only
the top-priority pages. priorityPageLimit defaults to 15 and is capped at
25.
For public file URLs, pass the file type so the document can be parsed correctly:
uploadContextVaultDocument(request, options?)
Uploads a local file and adds it to Context Vault.
listContextVaultDocuments(workspaceId, options?)
Lists workspace documents and their current status.
cancelContextVaultDocument(documentId, options?)
Stops a pending, retrying, or active document job.
deleteContextVaultDocument(documentId, options?)
Deletes the document, chunks, citations, and any extracted memories that are
only backed by that document.
createContextVaultMemory(request, options?)
Adds a curated company fact to a workspace. Use this for important company
context that is not documented yet.
deleteContextVaultMemory(workspaceId, memoryId, options?)
Deletes a curated company fact from a workspace. Document-extracted memories are
removed by deleting their source document when they are not backed by any other
document.
searchContextVault(request, options?)
Searches workspace knowledge in documents, memories, or hybrid mode.
chunks[] and memories[] separate. For answer generation,
pass chunks[] as source document context and convert memories[] into a
second memory-context document. Curated company facts use
memoryType: "company" and may return with evidence: [].
listContextVaultMemories(request, options?)
Browses extracted workspace memories.
listContextVaultDocumentMemories(workspaceId, documentId, options?)
Lists memories extracted from one document.
submitContextVaultMemoryFeedback(memoryId, request, options?)
Records feedback on an extracted workspace memory.
listContextVaultMemoryEvidence(workspaceId, memoryId, options?)
Loads source chunks for an extracted memory.
getContextVaultHierarchy(workspaceId, options?)
Returns scope/project counts for workspace memories.
Error Handling
Failed API responses throwMemContextApiError.
Links
- Website: memcontext.in
- Official docs: docs.memcontext.in
- API reference: REST API
