Skip to main content

[ open source ] single binary · rust · onnx · sqlite · mcp

synopsis
[memex]

Structured information for AI agents via MCP.One Rust binary — hybrid search and a knowledge graph in a single process, built for a 16 GB laptop. No external services.

Engine — Rust 1.96 (pinned)Protocol — MCP · HTTP + SSEStore — SQLite · FTS5Vectors — usearch HNSWEmbeddings — ONNX · localLinking — CEL / Equals / LLMLLM — OpenAI API [local/remote]
MCP ONLINE

// 00 · architecture

One binary. Zero services.

Documents are parsed, chunked, embedded, and run through NER into a knowledge graph with a hybrid FTS5 + usearch index. State lives in a per-dataset knowledge.db, a global cache.db, and usearch index files — served to AI agents over MCP.

Architecture of synopsis[memex]: MCP tools for AI agents

// 01 · pipeline

Documents in → knowledge out.

Synopsis is one stage of a larger information pipeline — not a standalone assistant and not a search platform. Everything between the source files and 12 MCP tools runs in one Rust binary.

Markdown, JSON, and web pages from the configured sources. A startup reconcile, a file watcher, and the pipeline enqueue events into queue_tasks; a background worker processes the queue.

MarkdownJSONWeb pages

A format-specific parser turns every file into the same structured document; header-based or fixed-size chunking with overlap. Unchanged files (same SHA-256) are skipped entirely.

ParserChunkingDedup

Local ONNX embeddings per chunk, ONNX NER, then entity and fact extraction; the same entity is linked across domains with CEL or an LLM — into a knowledge graph and a usearch hybrid index.

EmbeddingsNERFactsusearch index

Entities, relations, and approved facts are served as 12 read-only MCP tools over Streamable HTTP (/mcp), with the legacy HTTP+SSE pair also served.

12 toolsapproved factsProvenance

// 02 · capabilities

One job, done well.

Six systems inside one Rust binary — strict boundaries, no services to operate between them.

/01

Hybrid Search

Lexical (FTS5 BM25) and semantic (usearch HNSW) retrieval run in parallel, fused with Reciprocal Rank Fusion and reranked by recency and authority.

FTS5/BM25usearchRRF
/02

Knowledge Graph

Entities from ONNX NER, cross-domain links from an LLM, CEL linkers for the deterministic cases — a petgraph index serves dossiers, relations, and links.

ONNX NERCEL linkerspetgraph
/03

MCP Server

Twelve read-only tools over Streamable HTTP (/mcp) with the legacy HTTP+SSE pair (GET /sse + POST /message) also served — built for agents, not browsers.

Streamable HTTPlegacy HTTP+SSE12 tools
/04

Disk-Backed ANN

usearch HNSW on mmap, scalar-quantized, with WAL + segments and background compaction — the query path never loads the embedding model.

usearch HNSWmmapWAL + segments
/05

Self-Contained Build

SQLite with FTS5 is compiled in-tree — no C interop, no system dependencies. The ONNX runtime and model weights download on demand, verified by URL + size + SHA-256.

bundled SQLiteno C interopsha-256 verified
/06

Event Task Queue

A startup reconcile, a file watcher, and the pipeline enqueue events (doc:index / doc:delete / entity:link) into queue_tasks; a background worker processes the queue with retries and status reporting.

queue_tasksbackground workerretries

// 03 · how it works

From binary to MCP client.

One binary, five steps — obtain it, install the runtime, download the model, serve, then connect a client. Everything runs locally.

1

Obtain & run

Obtain the binary

Prebuilt Gitea Release archive for the 5 targets (Linux amd64/arm64, Windows amd64, macOS arm64) — or cargo build --release from the pinned Rust 1.96.0 toolchain.

Install the runtime

synopsis onnx-runtime install downloads the ONNX Runtime library per onnx.yaml — URL, size, and SHA-256 verified.

Download the model

synopsis model download fetches the default embedding model into workspace/models/.

Serve

synopsis serve starts the MCP server on :8080 — preset default, config auto-searched, initial ingest plus file watching.

2

Connect a client

Streamable HTTP

Point any MCP client at /mcp — the primary transport: JSON-RPC over POST, responses as plain JSON or an SSE stream.

Legacy HTTP+SSE

GET /sse opens the stream, POST /message?sessionId=… carries the calls — the legacy wire contract, still served.

Verify

GET /health returns status, version, and knowledge-base counters.

// 04 · quick start

From binary to MCP tools.

Install the runtime synopsis onnx-runtime install

One-time setup: downloads the ONNX Runtime library per workspace/configs/onnx.yaml — URL, size, and SHA-256 verified — for fully local embeddings.

Download the model synopsis model download

Fetches the default embedding model from the onnx.yaml registry and verifies it before first use.

Serve synopsis serve

Starts the MCP server on port 8080 (preset "default") — startup reconcile plus a file watcher keep the knowledge base fresh.

Read the full quickstart →

synopsis — zsh
$ synopsis onnx-runtime install✓ onnxruntime — cpu · linux/amd64 · sha-256 ok$ synopsis model download✓ model bge-small-en-v1.5 · 384 dims · sha-256 ok$ synopsis serve✓ mcp server → http://localhost:8080/mcp · legacy /sse$ curl -s http://localhost:8080/health{"status":"ok"}

→ first mcp call — POST /mcp · tools/call

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": search,
    "arguments": {
      "query": "vacation policy",
      "domain": "hr"
    }
  }
}

// 05 · mcp tools

Twelve tools. One protocol.

Twelve read-only tools over Streamable HTTP (/mcp), with the legacy HTTP+SSE pair also served — declarative JSON schemas, cursor pagination, and full provenance on every answer.

// 06 · use cases

Built for how teams actually store knowledge.

Domain tags decide what gets extracted and how it links — the same engine serves every department.

HR

People operations

Vacation, hiring, benefits — ask “how does the policy apply to contractors?” and get the answer with the exact source quote.

policyroleprocess
IT

Infrastructure ops

Runbooks, incidents, change records — find the last fix for a service outage across the wiki and ticket history.

serviceincidentrunbook
Product

Product teams

Specs, roadmaps, feedback — keep features, decisions, and owners consistent in one queryable place.

featuredecisionrelease
Engineering

Engineering

Design docs, ADRs, post-mortems — the same system or person linked across code, prose, and tickets.

adrsystempost-mortem

// 07 · tech stack

Chosen for zero operations, not fashion.

Each component exists so the whole system stays one process on local files — and so it can still be rebuilt by a single engineer.

ComponentRoleWhy
Rust 1.96 (pinned)One self-contained binaryThe toolchain is pinned in rust-toolchain.toml; SQLite with FTS5 is compiled in-tree, so a build cannot silently lack FTS5. No C interop.
tokio + axumAsync runtime + HTTPOne process serves the MCP endpoints, the job-queue worker, and the file watcher — no services to operate between them.
rusqlite (bundled SQLite + FTS5)Storage + lexical searchWAL mode keeps serving reads while ingestion writes; BM25 over search_text is the lexical leg of hybrid search.
ONNX Runtime (ort)Local embeddings on CPUNo API keys — int8-quantized bge models run fully offline; the runtime and weights download on demand, verified by URL + size + SHA-256.
usearchDisk-backed ANNHNSW on mmap, scalar-quantized, WAL + segments — 1M × 1024-dim vectors fit a 16 GB laptop, and the query path never loads the embedding model.
rmcpMCP protocolStreamable HTTP (/mcp) with the legacy HTTP+SSE pair also served — declarative, self-documenting tools for Claude Desktop, Cursor, and any MCP client.
CEL · petgraph · minijinjaLinking · graph · promptsCEL expressions drive deterministic entity linking, petgraph indexes the knowledge graph, minijinja renders the LLM prompt templates.
jiff · clap · tracingUTC dates · CLI · loggingRFC 3339 timestamps, a flag-driven CLI surface, and tracing in the binary only — library crates stay logger-less.

// 08 · get started

Give your agents real context.

Point any MCP client at localhost:8080/mcp (or /sse for legacy clients). Documents in, a queryable knowledge base out — about five minutes of your time.

$ synopsis serve — mcp http://localhost:8080/mcp · legacy /sse