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)
- Open Dashboard → AI SDK Projects.
- Generate a
mem_...API key. - 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.
- Use that
tenantIdfrom your backend when calling memories.
Scope Cheat Sheet
| Scope field | What it isolates | Security boundary | Required |
|---|---|---|---|
tenantId | SaaS customer/project database | Yes | For multi-tenant SaaS |
userId | End-user scope inside tenantId | Yes (within tenant) | Optional |
projectId | Optional git/repo context filter | No | Optional |
Important: tenantId vs projectId
These are different:
tenantId= SaaS isolation boundary (database routing)userId= end-user scope insidetenantIdprojectId= 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