Module api

Module api 

Source
Expand description

HTTP routing and REST handlers. HTTP surface for Rusty Memory.

This module exposes a compact Axum router with a handful of endpoints:

  • POST /index – Chunk a raw document, generate embeddings, and persist them in Qdrant. Accepts optional metadata (collection, project_id, memory_type, tags, source_uri) and returns indexing counters (chunks_indexed, chunk_size, inserted, updated, skipped_duplicates).
  • GET /collections – List Qdrant collections managed by this server.
  • POST /collections – Create or resize a collection (idempotent).
  • GET /metrics – Observe ingestion counters and the last chunk size used.
  • GET /commands – Machine-readable command catalog for quick discovery by tools/hosts.

The HTTP surface shares the same processing pipeline with the MCP server, so behavior is identical across interfaces.

Functions§

create_router
Build the HTTP router exposing the ingestion API surface.