If Memory Crystal is a vault, the API key is the key that opens the vault. No key means no memory access.Documentation Index
Fetch the complete documentation index at: https://docs.memorycrystal.ai/llms.txt
Use this file to discover all available pages before exploring further.
What this means in practice
Most HTTP-facing access uses:MEMORY_CRYSTAL_API_KEYMEMORY_CRYSTAL_API_URL
How it actually works
Authentication happens at two layers:1. API Key Creation Flow
When a user wants to use Memory Crystal via HTTP or MCP, they first generate an API key:2. HTTP Request Authentication
Every HTTP request must include the key as a Bearer token:- Extract Bearer token from header
- SHA256 hash it
- Query
crystalApiKeysfor a matching hash - Check if key is active and not expired
- Check if key belongs to the authenticated user
- Fire-and-forget: update
lastUsedAttimestamp
3. MCP Server Configuration
For MCP transport, set environment variables:4. Rate Limiting Integration
After auth succeeds, rate limits are checked immediately:HTTP Status Codes
200 OK
Request authenticated and processed successfully.401 Unauthorized
- Missing
Authorizationheader - Malformed header (not
Bearer <token>) - Bearer token doesn’t match any known key hash
- Key is inactive (disabled by user)
- Key has expired (
expiresAt < now) - Key belongs to a different user
403 Forbidden
The authenticated user is not allowed to access this resource. Examples:- Memory belongs to a different user
- Knowledge base is scoped to a channel the user is not in
- User’s tier doesn’t support this operation
429 Too Many Requests
Rate limit exceeded for the user’s tier. Response headers:Commands / examples
Example process-level configuration (MCP):0.7.15 — API-key recall path improvements
As of 0.7.15, the API-key (HTTP) path ofcrystal_why_did_we, crystal_who_owns, crystal_dependency_chain, and crystal_explain_connection now forwards the channel parameter to the backend recall endpoint. Previously these four tools silently dropped channel on the API-key branch, returning unscoped cross-channel results. JWT clients were already correct; hosted/API-key consumers should now pass channel when peer scoping is desired.
Common mistakes
- mixing
CRYSTAL_API_KEYandMEMORY_CRYSTAL_API_KEYwithout understanding which layer is consuming them - forgetting the backend URL for MCP server setups
- assuming local install success means auth is valid
Source of truth
Primary files behind this page:.env.examplepackages/mcp-server/README.mdmcp-server/README.mdconvex/crystal/mcp.tsconvex/crystal/knowledgeHttp.tsscripts/crystal-doctor.sh