Skip to main content
These are the HTTP doors for the memory side of the system.

What this means in practice

Important endpoint families include:
  • capture
  • recall
  • search-messages
  • recent-messages
  • wake
  • checkpoint
  • trace
  • stats
Important related tool surfaces include:
  • crystal_recall
  • crystal_search_messages
  • crystal_recent
  • crystal_debug_recall

How it actually works

Key repo surfaces:
  • convex/crystal/mcp.ts
  • packages/mcp-server/README.md
  • mcp-server/README.md
The modern and legacy MCP packages both depend on this underlying memory/API surface, even though they package it differently.

Endpoint Reference

Session Initialization

POST /api/mcp/wake

Fetch the last session summary and recent messages to initialize a new session. Request:
Response:

Memory Recall

POST /api/mcp/recall

Vector search over memories by semantic query. Request:
Response:
Optional request fields:
  • channel — channel/scope context, including peer-scoped or shared-main values
  • agentId — agent identifier used when resolving knowledge-base visibility for mixed private/shared deployments
  • includeGraphContext — defaults to true; set to false when temporarily prioritizing lower latency over linked entity/relation context
Peer-first fallback (new in 0.7.15). If channel is omitted on a peer-facing call, recall fails-closed on any knowledge base with a concrete peer scope. Previously the guard silently upgraded unscoped callers to management-level visibility. Always pass the peer channel (e.g. peer-coach:511172388) from a peer session.
Behavior notes:
  • the live MCP recall path computes one query embedding and reuses it across semantic memory recall and message-search evidence
  • identical repeated HTTP recall requests can reuse the short-lived query embedding cache
  • KB results are merged after normal memory recall, with agent/scope-aware visibility rules
  • compact graph context is included by default and omitted only when the caller explicitly sends includeGraphContext: false

POST /api/mcp/search-messages

Semantic + keyword search over raw message transcripts, optionally bounded to a time window and paged. Use it for questions like “what did X say last month about Y”: pass the topic as query, the peer as channel, and the window via fromMs/toMs (or ISO startDate/endDate). Request:
Parameters:
  • query (required) — search text.
  • channel / sessionKey — exact scope. On a multi-client (peer) account, always pass the peer channel — search is channel-isolated and never crosses clients.
  • limit — 1–100 (default 10).
  • offset — skip N ranked results for pagination.
  • Time windowfromMs/toMs (epoch ms) or startDate/endDate (ISO date/datetime); sinceMs, before, after are accepted aliases. A plausible seconds-precision value is auto-upscaled to ms.
Response:
Page with offset: nextOffset while pagination.hasMore is true. A short page means you have reached the end — do not assert a window is empty from one page.

POST /api/mcp/recent-messages

Fetch the most recent messages in time order without vector-search cost. Accepts the same channel scope and time window (fromMs/toMs or startDate/endDate) as search-messages; order may be "chronological" (default) or "newest". Request:
Response:

Memory Management

POST /api/mcp/capture

Store a new memory (typically called after AI response completes). Request:
Response:

POST /api/mcp/checkpoint

Mark a session milestone. Request:
Response:

POST /api/mcp/trace

Retrieve the original conversation context for a memory. Request:
Response:

System

GET /api/mcp/stats

Memory store health and usage. Response:

Usage Pattern: Full Turn

Typical agentic flow:
  1. Session start: POST /api/mcp/wake → prime context
  2. Before work: POST /api/mcp/recall with relevant query → semantic context
  3. After response: POST /api/mcp/capture with extracted memory
  4. Optional: POST /api/mcp/checkpoint if turning point reached
For debugging:
  • Add debugRecallOutput=true query param to recall endpoints to get verbose output including all search results, filtering, and prompt injections
  • Use POST /api/mcp/trace to understand memory provenance

Common mistakes

  • assuming the endpoint list is the whole behavior without reading the surrounding logic in mcp.ts
  • mixing HTTP endpoints and MCP tool names without explaining the relationship
  • ignoring auth/rate-limit behavior when describing the API surface

Source of truth

Primary files behind this page:
  • convex/crystal/mcp.ts
  • packages/mcp-server/README.md
  • mcp-server/README.md