memories.sh logomemories.sh
SDK

AI SDK Projects

Create SaaS-scoped SDK projects in the dashboard and avoid tenantId vs projectId confusion.

Use this page first if you are wiring memories.sh into a SaaS app.

SaaS apps using SDK endpoints (/api/sdk/v1/*) do not need MCP multitenancy. Use MCP routing only when you are serving MCP-native clients.

What is an AI SDK Project?

In the dashboard, an AI SDK Project is a tenantId mapping to an isolated memory database.

  • One project per customer workspace, org, environment, or app surface
  • Works for solo devs and teams
  • Created in your currently selected dashboard workspace

Setup Flow (Dashboard)

  1. Open Dashboard → AI SDK Projects.
  2. Generate a mem_... API key.
  3. Create your first project:
    • Attach Existing DB (recommended): map an existing Turso database.
    • Provision New Project DB: create a new Turso DB from the dashboard.
  4. Use that tenantId from your backend when calling memories.

Scope Cheat Sheet

Scope fieldWhat it isolatesSecurity boundaryRequired
tenantIdSaaS customer/project databaseYesFor multi-tenant SaaS
userIdEnd-user scope inside tenantIdYes (within tenant)Optional
projectIdOptional git/repo context filterNoOptional

Important: tenantId vs projectId

These are different:

  • tenantId = SaaS isolation boundary (database routing)
  • userId = end-user scope inside tenantId
  • projectId = optional repo context filter (for coding assistants)

If your app is not git-centric, omit projectId.

Solo Dev Guidance

You do not need a team workspace to start.

  • Stay in your personal workspace.
  • Create AI SDK Projects there.
  • Add team workspace later if needed.

Server-Side Usage Pattern

Always derive scope in backend auth code, then call memories with your server key.

const client = new MemoriesClient({
  apiKey: process.env.MEMORIES_API_KEY,
  tenantId: auth.orgId, // server-derived
  userId: auth.userId,  // server-derived
})

const context = await client.context.get({
  query: "pricing and billing policy",
  projectId: undefined, // optional git context filter
})

Next: SaaS Auth Routing

On this page