Documentation
synrag is one executable: it parses documents, builds a hybrid index (BM25 + the Synapse embedding model + an optional reranker), and serves search and LLM-ready context over HTTP. Everything below runs on a laptop.
Quickstart
# 1. install the binary (~3 MB) and the models (~86 MB) into ~/.local/bin and ~/.synrag curl -fsSL https://ai.synlabs.pro/install.sh | sh # 2. index a folder of PDFs, Office files, HTML, Markdown... synrag index ./docs -o docs.syn --student ~/.synrag/models/synapse.synm # 3. ask from the command line synrag search docs.syn "how do refunds work" -k 5 --student ~/.synrag/models/synapse.synm synrag context docs.syn "how do refunds work" --budget 600 --student ~/.synrag/models/synapse.synm # 4. or serve it over HTTP synrag serve docs.syn --student ~/.synrag/models/synapse.synm --port 7878 curl 'localhost:7878/search?q=how+do+refunds+work&k=5'
--student loads Synapse, the embedding model. Without it synrag runs BM25 only (smaller, faster, lower quality).
Add --rerank ~/.synrag/models/rerank.synr for the best quality.Install
The installer downloads the binary and models from this site, verifies their SHA-256 checksums, and installs them for the current user (no root). Read it first if you like: install.sh. Manual download: Download.
- Linux x86-64, glibc 2.30 or newer (Ubuntu 20.04+, Debian 11+, RHEL 9, Fedora, Arch). One binary, no runtime dependencies.
- Windows: use WSL2. macOS / ARM: builds are coming.
- Options:
SYNRAG_PREFIX=/opt/synrag(install location),SYNRAG_NO_MODELS=1(binary only).
Index documents
synrag index <path>... -o <index.syn> [--student synapse.synm] [--learn] [--chunk-words 160] synrag add <index.syn> <path>... # add or replace (same source = new version) synrag delete <index.syn> <source>... # remove by source synrag parse <file> [--chunks] # see what the parser extracts
Formats: PDF, DOCX, XLSX, PPTX, ODT/ODS/ODP, HTML, Markdown, CSV, JSON / JSONL, ZIP (nested up to 4 levels), plain text.
Scanned documents: --ocr-cmd "tesseract {} - -l eng" runs any OCR command for pages without a text layer.
--learn additionally trains a small corpus model on your documents (~3 s per 50K documents) — slightly better on some corpora, optional.
Serve and query
synrag serve docs.syn --student synapse.synm [--rerank rerank.synr] [--host 127.0.0.1] [--port 7878]
synrag serve --data ./data --api-keys keys.json # collections + authentication
On a non-loopback address the server refuses to start without authentication (API keys or SSO tokens) unless you pass
--insecure-no-auth. Updates are journaled and fsynced before they are applied; a crash loses nothing that was acknowledged.
HTTP API
Single-index mode serves the paths below at the root; with --data every collection has them under /c/{name}/.
Authenticate with Authorization: Bearer <key or token>.
| Request | What it does |
|---|---|
GET /search?q=…&k=10 | Hybrid search. One hit per document (best chunk) with source, title, heading, page, text, score, version; chunks=1 returns all chunks. |
GET /context?q=…&budget=1500 | The sentences that answer the query under a token budget, with [n] citations and the list of sources. |
POST /add {"docs":[{"source","title","text","acl"?}]} | Add or replace documents; searchable immediately. |
POST /upload?source=report.pdf (file bytes) | Parse a file on the server (any supported format) and index it. |
POST /delete {"sources":[…]} | Delete documents. |
POST /save | Write a snapshot and empty the journal (also automatic). |
GET /collections, POST|DELETE /collections/{name} | List, create, drop collections (role admin). |
GET /health, GET /ready, GET /metrics | Liveness, readiness, Prometheus metrics. |
GET /license | Edition, license, chunks in use (role admin). |
curl -s localhost:7878/context --get --data-urlencode 'q=what is the notice period?' -d budget=400
{"context": "The notice period is two months [1]…", "tokens": 58,
"sources": [{"cite": 1, "source": "hr/handbook.pdf", "title": "Employee handbook", "heading": "Termination", "page": 14, "score": 0.91}]}
Python SDK
pip install synrag
import os
from synrag import Server, Client
model = os.path.expanduser("~/.synrag/models/synapse.synm")
# start a local server (builds the index on first run) …
with Server("docs.syn", build_from=["./docs"], student=model) as rag:
for h in rag.search("refund window", k=5):
print(h.rank, h.source, h.page, h.text[:80])
ctx = rag.context("how do refunds work?", budget=800)
print(ctx.text, ctx.sources)
rag.add([{"source": "faq.md", "title": "FAQ", "text": "…"}])
rag.upload("contract.pdf", open("contract.pdf", "rb").read())
# … or connect to a running one
kb = Client("http://10.0.0.5:7878", api_key="sk_…", collection="kb")
# OpenAI-style tool for any function-calling LLM
tool = kb.tool() # {"type": "function", "function": {...}}
answer_context = kb.call_tool({"query": "notice period"})
Connectors (incremental sync with access lists): S3 and S3-compatible storage, Confluence, SharePoint / OneDrive, Google Drive,
any SQL database, local folders — synrag.connectors. Access lists need a license with the acl feature.
MCP server
uvx synrag-mcp (or pip install synrag-mcp, then synrag-mcp) speaks the Model Context Protocol over stdio. Tools:
search_documents, get_context, list_collections; with --allow-writes also
add_document, add_file, delete_documents.
Claude Desktop (claude_desktop_config.json), Cursor (.cursor/mcp.json) and other clients:
{
"mcpServers": {
"synrag": {
"command": "uvx",
"args": ["synrag-mcp", "--index", "/home/me/notes.syn", "--build-from", "/home/me/notes"]
}
}
}
Claude Code: claude mcp add synrag -- uvx synrag-mcp --index ~/notes.syn --build-from ~/notes.
The server is on PyPI and in the official MCP Registry as io.github.Synlabs-ai/synrag;
it finds the installed engine and the Synapse model by itself.
To use a shared server instead: --url http://host:7878 --api-key KEY --collection kb.
Models and modes
| Mode | Flags | 57.6K docs ready in | Query p50 | English nDCG@10 |
|---|---|---|---|---|
| BM25 | (none) | 0.45 s | 0.03–0.36 ms | 0.424 |
| Fast (default recommendation) | --student synapse.synm | 1.6 s | 0.55 ms | 0.441 |
| Fast + reranker | --student … --rerank rerank.synr | 1.6 s | 2.9 ms | 0.451 |
| Full + reranker | --learn --student … --rerank … | 4.8 s | ~3 ms | 0.455 |
The reranker costs ~11.5 ms of CPU per query (throughput ~0.5K queries/s instead of thousands); use it when quality matters more than volume.
Collections and API keys
synrag keygen --id ingest --roles write # prints the key once + its record
synrag keygen --id bot --roles read --collections kb
echo '{"keys":[<record>, <record>]}' > keys.json
synrag serve --data ./data --api-keys keys.json --host 0.0.0.0
curl -X POST -H "Authorization: Bearer $ADMIN" localhost:7878/collections/kb
Roles: read, write, admin, metrics, read-all. Only SHA-256 hashes of keys are stored.
SSO tokens (OIDC: Keycloak, Entra ID, Okta, Auth0, Google), per-document access lists, audit, encryption and the cluster are
described in the production guide.
Editions and licenses
Without a license file synrag runs as the Community edition: up to 1,000,000 chunks per organization (the binary counts them
per server across all collections), every search feature. A license (--license-file acme.license or SYNRAG_LICENSE_FILE) raises the limit and
enables SSO, document ACLs, audit, encryption at rest and the cluster coordinator. synrag license shows what is active.
- Verified offline against keys built into the binary. No activation server, no network calls, no telemetry.
- Starting with an enterprise feature without a license is refused with a message naming the feature — security settings are never silently switched off.
- Above the chunk limit, writes get
402; searches, replacements and deletions keep working. - After expiry: 30 days unchanged, then 90 days read-only with every security feature still on, then serving stops until renewal.
synrag export index.syn -o docs.jsonlexports every document (text and access list) at any time, with or without a license; deleting data always works. - Without a license, a server refuses data that carries document access lists — export it, or install a license with
acl.
Plans: Pricing.