Skip to content

MCP server

Crate open/crates/oliviadb-mcp, binary oliviadb-mcp (stdio, newline-delimited JSON-RPC), protocol revision 2026-07-28 (stateless: server/discover, resultType on every result, _meta protocol version on every request, multi round-trip requests, subscriptions/listen).

oliviadb-mcp --dir DIR --tenant T --principal P [--teams a,b] [--profiles read,memory,admin] [--models]

Catalogue

profile tool annotations
read memory_recall (context under a budget; returns a sealed pack handle and refs) read-only, idempotent
read memory_expand (one ref of a pack) read-only
read oliviadb_path (path language) read-only
memory memory_remember (episode + facts, idempotent per step) not destructive, idempotent
memory memory_assert (fact with evidence, expected_version) not destructive
memory memory_feedback (used refs or answer, outcome) not destructive
memory memory_retract destructive
memory watch_create (returns a watch resource link) not destructive
admin memory_export_subject read-only
admin memory_erase_subject (needs out-of-band confirmation; purge: then the recall index's purge) destructive
admin memory_index_purge (flush and full compaction: no deleted recall-index entry left in live files) not destructive
admin memory_consolidate not destructive

destructiveHint: false is set explicitly on non-destructive writers (the protocol's default is true). Resources: oliviadb://<tenant>/ENTITY, …/ENTITY=<name>[/ATTR=<attr>][?history=true], …/PRINCIPAL=<id>[/THREAD=<t>], …/watch/<id> (templates listed); prompt dossier; completion offers only catalogue names (path types), never values.

Operational data (layer 1)

Server::with_data(AgentView) adds a system of record, read-only, through an agent view (oliviadb_memory::operational): an OperationalSource (collections of hierarchical records: types with parent, key field and typed fields; reads at a version; the changes it applied) under one Policy per collection, the model memory uses: row predicates over the fields of a node and its ancestors (TYPE.FIELD, user attributes substituted), visibility of types (TYPE) and fields, masks, derived fields (shown only with their sources, redacted when a source is masked), the personal-data class. Paths: CATALOG, <collection>, <collection>/<type> (a listing, sealed page cursor), <collection>/<type>=<key>/... (a node), <type>[n] for twins by position, =~<name> for nodes whose key is hidden (raw hidden keys are refused as addresses); ?as_of=<source time>. Search (data_recall) runs over an index built only from what the view shows; watches (data_watch) report a change only when what the agent sees changed; their cursors are source positions (OperationalSource::position), equal on every copy of the source. Tests: oliviadb-memory/tests/operational.rs. Sources for particular systems of record, and the compilation of their access definitions into these policies, are in the enterprise part.

Watches and events

watch_create makes oliviadb://<tenant>/watch/<id> with a cursor at the current transaction time; subscriptions/listen with that URI in resourceSubscriptions is acknowledged (only watch URIs are honoured, the acknowledgement says so) and gets notifications/resources/updated when memory about the watched entities changes; the events are read from the resource (node ids and transaction times since the cursor). notifications/cancelled for the listen request ends the stream with its result.

Security

  • The stdio server serves one tenant and principal fixed at launch; the profiles granted decide the tools listed and accepted. Over the network the same tools serve many principals with OAuth 2.1 tokens (scopes per profile, token exchange RFC 8693) or API keys: network-api.md.
  • Handles (pk_… context packs, rs_… request state) are XChaCha20-Poly1305 sealed with a per-process key, bound to the principal and an expiry; forged or foreign handles fail.
  • Subject erasure: the first call returns input_required with a URL-mode elicitation and sealed request state; the retry succeeds only after the confirmation nonce was approved on the server side (Server::approve, the operator's step-up), never on the client's accept alone; each confirmation is single use.
  • All data results are cacheScope: private; discovery is public.
  • Agent policies (Server::with_policy): recall, path navigation and expansion are filtered (row predicates, attribute visibility) and masked (values, personal-data class) by the same policy.
  • Untrusted episode text flagged by the injection guard is withheld from recall and from path reads, shown only through memory_expand with a warning.

Conformance

oliviadb-mcp/tests/conformance.rs validates every message of a scripted session (35 messages: every tool, resources, prompts, completion, listen/updated/cancel, errors -32022/-32602/-32601) and the specification's own example requests (10 replayed) against the JSON Schema of revision 2026-07-28 (tools/fetch-mcp-spec.sh, pinned commit and checksum), plus a check that the validator rejects a malformed result.

HTTP transport

oliviadb-server (and oliviadb-agent-server) serve the Streamable HTTP transport of the same revision at POST /mcp, behind the network API's authentication (API keys or OAuth bearer tokens: the caller's identity and profiles, as for the REST routes). The revision has no sessions: every request is a session of the caller over the shared core, answered with one JSON object. The transport's rules are enforced: MCP-Protocol-Version and Mcp-Method on every request and Mcp-Name on tools/call, resources/read and prompts/get, each equal to the body (the =?base64?...?= form decoded), else 400 with HeaderMismatch (-32020); another version 400 (-32022, listing the supported one); an unknown method 404 (-32601); a notification 202; GET and DELETE 405; an Origin that does not name the server 403. subscriptions/listen is not served over HTTP (watches have their server-sent events at /v1/watches/{id}/events). Test: oliviadb-server/tests/mcp_http.rs (results equal the stdio server's for the same identity).

Not built: OAuth on stdio, tasks extension, oliviadb_translate, per-tool output schemas beyond memory_recall, pagination (lists are small).