ontorata/ratary
π π βοΈ π πͺ π§ - Persistent coding memory for AI assistants β hybrid search, knowledge graph, token-efficient context. MCP stdio (28 tools), npm @ratary/mcp-server, optional remote Streamable HTTP. Self-host D1, Postgres, MariaDB, or Docker.
Quick Install
{
"mcpServers": {
"ontorata-ratary": {
"command": "npx",
"args": [
"-y",
"ontorata-ratary"
]
}
}
}Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.
Documentation Overview
Ratary
Build AI that remembers.
Ratary is the open-source AI Brain Platform β persistent memory,
structured knowledge, and intelligent retrieval for every model and agent you run.
Get started β Β Β·Β Star on GitHub Β Β·Β Website Β Β·Β Docs
Ratary is where AI remembers. Β· Built by Ontorata
Quick start Β· Ecosystem Β· Architecture Β· How it works Β· Capabilities Β· Docs
The problem
Why does AI forget between sessions?
Every AI session starts from zero.
Your model forgets yesterday's architecture decisions. Your agent drops customer context between runs. Your coding assistant can't recall why you chose Postgres over DynamoDB. Teams paste the same background into Cursor, Claude, ChatGPT, and custom bots β and knowledge still drifts.
Vector databases store chunks. RAG pipelines retrieve documents. Agent frameworks orchestrate tools.
None of them give AI a durable brain.
Why Ratary exists
Why build a brain layer now?
AI models are getting cheaper. Context windows are getting larger. Agents are getting capable.
But AI still forgets.
The bottleneck is no longer reasoning. It's memory β durable, structured, retrievable, and owned by you.
Every serious application eventually needed a database. Every serious AI system will need a brain layer: persistent intelligence that sits between your models and your storage β independent of any single vendor, IDE, or agent framework.
AI should remember.
Developers should own that memory.
Ratary exists to be that layer. Applications bring models. Ratary brings the brain.
What Ratary is
What is Ratary?
Ratary is an AI Brain Platform β infrastructure that gives AI:
- Persistent memory β durable, owner-scoped, versioned
- Structured knowledge β metadata, relations, graph traversal
- Intelligent retrieval β hybrid search + bounded context assembly
- Protocol access β Ratary MCP, REST, optional gRPC
It sits between AI clients and storage. One brain, many surfaces β Cursor, Claude Code, custom agents, enterprise APIs, and remote MCP hosts.
The runnable deployment is Ratary Server β this repository. Ratary is the product; Ratary Server is what you clone and run.
Bring your model. Ratary brings the memory.
Quick start
How do I run Ratary Server locally?
Ratary is the product. Ratary Server is the open-source deployment you run β ontorata/ratary (this repository). @ratary/sdk, @ratary/cli, and Ratary MCP connect to it; sibling Ontorata products use the same source of truth.
Prerequisites: Node.js 24 Β· SQL metadata store (pick one β Postgres is the template default)
Path A β PostgreSQL (npm + local or Docker)
git clone https://github.com/ontorata/ratary.git
cd ratary && npm install
cp .env.example .env # Set AUTH_SECRET + DATABASE_URL β see .env.example QUICK START
npm run db:apply-postgres-schema
npm run setup # wire Ratary MCP for Cursor, Claude Code, β¦
npm run dev
Or use Docker: docker compose --profile postgres up --build β see docs/DOCKER.md.
Path B β Cloudflare D1
git clone https://github.com/ontorata/ratary.git
cd ratary && npm install
cp .env.example .env # Set AUTH_SECRET + SQL_PROVIDER=d1 + CLOUDFLARE_* / D1_*
npm run db:migrate
npm run setup
npm run dev
Details: docs/GUIDE.md Β· docs/CONFIGURATION.md
β API http://localhost:9876 Β· Swagger /docs
First REST call: bootstrap once to get an API key (aic_...) β see GUIDE β First REST API key.
# Save your first memory
curl -X POST http://localhost:9876/api/v1/memory \
-H "Authorization: Bearer aic_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Hello brain","project":"demo","content":"Ratary remembers this."}'
Full guide: docs/GUIDE.md Β· SDK & MCP examples in docs/examples/
npm packages (@ratary)
Client libraries ship on npm under the @ratary scope β product name, published by Ontorata. No server clone required for SDK, CLI, or hosted MCP.
npm install @ratary/sdk@1.1.0
npx @ratary/mcp-server@1.1.3 # remote REST β stdio MCP
npm install -g @ratary/cli@1.1.0 # operator CLI
| Package | Version | Install | Role |
|---|---|---|---|
@ratary/sdk | 1.1.0 | npm install @ratary/sdk | Typed REST client + client.admin.* |
@ratary/cli | 1.1.0 | npm install -g @ratary/cli | Operator commands (admin, connectors) |
@ratary/mcp-server | 1.1.3 | npx @ratary/mcp-server | IDE MCP β hosted API |
Set RATARY_BASE_URL and RATARY_API_KEY (aic_...). Details: packages/README.md Β· remote MCP install.
Ecosystem
Which repository owns what?
The Visual architecture diagram shows logical layers inside Ratary Server. This diagram shows repository and product relationships β what ships in this repo, what connects to it, and what lives in sibling Ontorata repositories. Both views describe the same platform from different angles.
Throughout this README, Ratary MCP means the official memory MCP implementation (stdio in this repo Β· npm @ratary/mcp-server for hosted REST). It is not the same as Ontorata MCP (ecosystem gateway β separate repo).
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Ratary Cloud (opt-in) β
β optional hosted deployment Β· not this repo β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Ratary Server β ontorata/ratary (this repo) β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
@ratary/sdk @ratary/cli @ratary/mcp-server
(SDK) (CLI) (Ratary MCP Β· npm)
β β β
ββββββββββββββββ΄βββββββββββββββ
β
βββββββββββββββββββββββ΄ββββββββββββββββββββββ
βΌ βΌ βΌ
Ontorata MCP Ontorata Studio Ontory Runtime
ontorata/ontorata-mcp ontorata/Ontorata-Studio ontorata/ontory-runtime
ecosystem product ecosystem product (ADR-2119; was ontorata/ontory)
Infrastructure (ships from ontorata/ratary β server plus client packages):
| Component | Repository | Role |
|---|---|---|
| Ratary Server | ontorata/ratary | Memory engine β REST, persistence, Ratary MCP stdio. You run this. |
| Ratary SDK | npm @ratary/sdk Β· packages/sdk | Typed REST client for Ratary Server. |
| Ratary CLI | npm @ratary/cli Β· packages/cli | Operator commands; delegates to Ratary SDK. |
| Ratary MCP | npm @ratary/mcp-server Β· stdio in repo | Memory MCP β full stdio in clone Β· npm proxy for hosted REST. |
Ecosystem products (separate repositories β connect to Ratary Server; not bundled here):
| Product | Repository | Role |
|---|---|---|
| Ontorata MCP | ontorata/ontorata-mcp | Ecosystem MCP gateway β Ratary MCP plus additional Ontorata tools. |
| Ontorata Studio | ontorata/Ontorata-Studio | Operator UI β uses @ratary/sdk only. |
| Ontory | ontorata/ontory-runtime | Ontory Runtime β AI orchestration (ADR-2119). Legacy URL ontorata/ontory redirects. |
Ratary Server does not depend on ecosystem product repositories.
Ratary MCP vs Ontorata MCP
Which MCP should I install?
| Ratary MCP | Ontorata MCP | |
|---|---|---|
| Layer | Ratary infrastructure | Ontorata ecosystem product |
| What it is | Official memory protocol for Ratary Server | Ecosystem gateway for Ontorata products |
| Scope | Memory β CRUD, search, context, graph | Ratary memory plus additional Ontorata tools |
| Repository | ontorata/ratary Β· npm @ratary/mcp-server | ontorata/ontorata-mcp |
Typical mcp.json key | ratary | ontorata |
Use Ratary MCP for direct memory access. Use Ontorata MCP for one MCP entry point across the Ontorata stack. Both use Ratary Server as source of truth.
What Ratary is not
How is Ratary different from alternatives?
| Vector DB | Memory API | RAG | Agent framework | Ratary | |
|---|---|---|---|---|---|
| Primary job | Similarity search | Key-value recall | Document Q&A | Tool orchestration | Durable AI memory |
| Structured knowledge & graph | β | β οΈ | β | β οΈ | β |
| MCP-native IDE integration | β | β οΈ | β | β οΈ | β |
| Token-efficient context assembly | β | β οΈ | β | β οΈ | β |
| Self-host & data sovereignty | β | β οΈ | β οΈ | β οΈ | β |
| Clear agent boundary | N/A | β οΈ | N/A | β bundled | β substrate only |
Ratary complements your stack β it does not replace pgvector, LangGraph, or your agent of choice. See the Capability matrix for a feature-level comparison.
Why not just pgvector, Mem0, Letta, LangGraph, or RAG?
| If you only use⦠| You get⦠| What you miss |
|---|---|---|
| pgvector | Embedding similarity | Structured memory, graph, MCP, context packing |
| Mem0 | Fast hosted memory API | Full self-host, hybrid retrieval, enterprise adapters |
| Letta | Agent + memory bundled | Your agent stays yours β Ratary is substrate, not runtime |
| LangGraph | Workflow & tool routing | Shared durable memory across sessions and clients |
| RAG | Document chunks | Evolving memory β decisions, handoffs, relations |
Visual architecture
How is Ratary Server structured internally?
This diagram shows the logical internal architecture of Ratary β how memory, knowledge, retrieval, and storage layers compose inside the platform. It is not a repository or product map.
βββββββββββββββββββββββββββββββββββββββββββ
β Your AI applications β
β Cursor Β· Claude Β· Agents Β· REST Β· MCP β
ββββββββββββββββββββββ¬βββββββββββββββββββββ
β
MCP Β· REST Β· gRPC
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β Ratary Server (logical layers) β
β βββββββββββ ββββββββββββ βββββββββββββ β
β β Memory β βKnowledge β β Retrieval β β
β ββββββ¬βββββ ββββββ¬ββββββ βββββββ¬ββββββ β
β βββββββββββββ΄ββββββββββββββ β
β Context Β· Learning Β· Protocols β
ββββββββββββββββββββββ¬βββββββββββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β Pluggable storage (your choice) β
β Postgres Β· Supabase Β· MariaDB Β· D1 Β· pgvector Β· Neo4j Β· β
β R2/S3/MinIO Β· OpenSearch Β· ClickHouse Β· β¦ β
βββββββββββββββββββββββββββββββββββββββββββ
Search browses. Retrieval injects context. Embedding enriches asynchronously β never on the CRUD hot path.
Details: docs/ARCHITECTURE.md
For repository and product relationships (SDK, CLI, Ratary MCP, Ontorata ecosystem repos), see Ecosystem β a separate diagram, same platform, different perspective.
How Ratary works
What happens to a memory after you save it?
Write Enrich Retrieve Learn Reuse
β β β β β
βΌ βΌ βΌ βΌ βΌ
Save via Summarize, Rank & pack Signals, Same memory
Ratary MCP/REST embed, link context for consolidate, powers every
relations your prompt evolve client
- Write β Persist memory through Ratary MCP or REST.
- Enrich β Summarize, embed, and relate β asynchronously.
- Retrieve β Assemble the smallest useful context slice.
- Learn β Optional signals and consolidation improve recall over time.
- Reuse β One brain across IDEs, agents, and APIs.
Core capabilities
What can Ratary Server do today?
Memory intelligence
Durable memories with summaries, codenames, favorites, archives, and handoffs. Version history with restore and merge β built for long-running work, not chat logs.
Knowledge
Semantic enrichment, relation linking, and graph traversal. Memory becomes navigable knowledge β not a flat pile of notes.
Retrieval
Hybrid search across SQL, vectors, lexical index, and graph. Separate browse from inject. Optional precision modes (hybrid, semantic, fulltext, title) when you need more control.
Reasoning support
Progressive retrieval, token budgets, and summary-first context assembly β typically ~85% fewer tokens than dumping full memory bodies into prompts.
Learning
Quality signals, consolidation, and compression β optional pipelines that improve the brain over time without retraining your model.
External agent support
Capability manifests, workspace scoping, and 28 Ratary MCP tools. External agents discover what the brain can do; Ratary never embeds agent reasoning β see What Ratary is not.
Platform
Pluggable adapters: choose SQL metadata (Postgres, Supabase, MariaDB/MySQL, D1, TiDB/Cockroach) plus optional pgvector, R2/S3/MinIO, Azure Blob, GCS, Meilisearch, OpenSearch, Neo4j, Redis, DuckDB, ClickHouse. Same application code for every backend.
Self-host stacks: docs/DOCKER.md β postgres or enterprise (MariaDB + MinIO + Redis) profiles.
Cloud & enterprise
Self-host, deploy to Vercel, or run a control plane with metering and federation. RBAC workspaces, audit trails, SSO, and policy hooks β opt-in when you need them.
Observability
OpenTelemetry, Prometheus metrics, SLO dashboards, and cost visibility for production brains.
Developer experience
OpenAPI, npm @ratary/sdk@1.1.0 Β· @ratary/cli@1.1.0 Β· @ratary/mcp-server@1.1.3 β and one-command IDE setup (npm run setup).
Knowledge fabric (opt-in)
Ingest from external systems of record β Notion (live on hosted prod), Confluence, Google Drive, SharePoint, and Teams connectors (code complete Β· enable per connector via env). Webhook HMAC, incremental sync, provenance on memories. Flags: KNOWLEDGE_FABRIC_ENABLED + CONNECTOR_SYNC_ENABLED. Guides: Knowledge fabric Β· Production enable Β· Phases 32β34.
Use cases
Who is Ratary for?
| What you build | What Ratary provides | |
|---|---|---|
| Developer AI | Coding assistants across IDEs and sessions | Persistent project memory, MCP tools, handoffs |
| Enterprise search | Internal knowledge discovery | Hybrid retrieval over structured memory, not just files |
| Customer support | AI that handles tickets | Durable customer context without re-prompting every thread |
| Knowledge management | Team second brain | Graph-linked memories, codenames, relations, summaries |
| Autonomous agents | Multi-agent systems | Shared memory layer with workspace and agent scoping |
| Personal AI | Private assistant you own | Self-hosted, exportable, sovereign data |
Capability matrix
How does Ratary compare feature-by-feature?
For category positioning, see What Ratary is not.
| Capability | Ratary | Vector DB | Memory API | RAG | Agent framework |
|---|---|---|---|---|---|
| Persistent structured memory | β | β | β οΈ | β | β οΈ |
| MCP-native | β | β | β οΈ | β | β οΈ |
| Hybrid SQL + vector + graph | β | β οΈ | β οΈ | β οΈ | β οΈ |
| Token-efficient context assembly | β | β | β οΈ | β | β οΈ |
| Knowledge graph & relations | β | β | β οΈ | β | β οΈ |
| Self-host sovereignty | β | β | β οΈ | β οΈ | β οΈ |
| Agent boundary (bring your agent) | β | N/A | β οΈ | N/A | β |
| Enterprise storage adapters | β | β | β οΈ | β οΈ | β οΈ |
Documentation
Where do I read next?
Ratary Server (ontorata/ratary β this repository):
| docs/GUIDE.md | Setup, daily usage, Ratary MCP configuration |
| docs/install/README.md | Per-harness MCP / plugin installation |
| docs/DOCKER.md | Container & Compose self-host |
| docs/CONFIGURATION.md | Environment variables β what each flag does |
| docs/examples/ | MCP and IDE config templates |
| docs/ARCHITECTURE.md | System design and boundaries |
| MCP/README.md | Ratary MCP β stdio and @ratary/mcp-server |
| packages/README.md | npm packages β install, env, publish |
| .env.example | Env template β meanings in docs/CONFIGURATION.md |
| docs/PRODUCTION-ENABLE.md | Hosted deploy β knowledge fabric on Vercel |
| docs/OPS-PRODUCTION-VERIFY.md | Production ops checklist β npm run ops:verify-production |
| docs/MCP-CHATGPT-OAUTH.md | ChatGPT MCP OAuth + Keycloak IdP runbook |
| docs/PHASES-32-34.md | Universal fabric Β· Neptune Β· enterprise connectors |
| MCP/submission/directory-status.md | MCP directory listing status |
| docs/ENTERPRISE-MODULES.md | Enterprise flags (opt-in) |
| CHANGELOG.md | Release notes and version map |
| docs/RATARY-VALIDATION-RUNBOOK.md | Maintainer validation β npm run ci:ratary-validation |
| SECURITY.md | Vulnerability reporting |
Canonical hosted API: https://ratary.ontorata.com (self-host uses your own base URL).
Ontorata ecosystem (separate repositories β not in this tree):
| ontorata/ontorata-mcp | Ontorata MCP β ecosystem gateway |
| ontorata/Ontorata-Studio | Ontorata Studio β operator UI (setup) |
Roadmap
What is shipping when?
Organized by direction β not sprints. Phases 1β31 are implemented in code (gates PASS); platform modules stay opt-in via env unless noted.
| Themes | Code | Ops (prod) | Primary repository | |
|---|---|---|---|---|
| Today (v1.0) | Ratary MCP + REST, hybrid/graph retrieval, peer SQL, Docker, npm @ratary/sdk@1.1.0 Β· @ratary/mcp-server@1.1.3, remote MCP, Ontorata Studio. Platform (opt-in): knowledge fabric (Notion/Confluence/Drive/SharePoint/Teams live), universal memory fabric (Phase 32), Neptune traversal (Phase 33), federation, global intelligence | β | Partial | ontorata/ratary |
| Ops (now) | Prod connector creds Β· MCP directory follow-ups Β· ChatGPT OAuth IdP (Keycloak) | β | β³ | ontorata/ratary |
Ops status (2026-07-19): Notion + fabric/federation flags on Vercel β
Β· D1 db:migrate β
Β· SDK codegen CI β
(workflow) Β· Confluence/Drive/SharePoint/Teams creds β³ (owner secrets) Β· Keycloak IdP β³ (auth.ontorata.com β deploy Render; prod uses Smithery API-key mode until OAuth enabled) Β· MCP listings mostly Listed (directory-status.md). Verify: npm run ops:verify-production Β· OPS-PRODUCTION-VERIFY.md
Enterprise modules ship opt-in via environment flags on Ratary Server β defaults stay lean. See ENTERPRISE-MODULES.md and CONFIGURATION.md.
Vision
What is Ratary building toward?
Today every application has a database.
Tomorrow every AI will have a brain.
Ratary is building that layer β open, portable, self-hostable, and protocol-native. Not another chat wrapper. Not another vector dump. Infrastructure for persistent intelligence.
Knowledge should accumulate. Boundaries should be respected. Agents should stay coherent across time.
If you're building AI that lasts longer than a single prompt β build on Ratary.
Bring your model. Bring your agent. Ratary brings the brain.
Ratary Β· where AI remembers Β· Ontorata Β· MIT License
Contributing
How do I contribute?
Ratary Server (this repo): fork ontorata/ratary β branch β npm run lint && npm run build && npm test β PR to ontorata/ratary.
Standard PR gate:
npm run lint && npm run build && npm test
Org-memory / recall changes (maintainers with .ai/ workspace): run the full gate before merge β see docs/RATARY-VALIDATION-RUNBOOK.md:
npm run ci:ratary-validation
Production ops changes (Vercel env, connectors, OAuth): see docs/OPS-PRODUCTION-VERIFY.md:
npm run ops:verify-production
Extended governance (.ai/ phases, ADRs) lives in the development mirror β optional for contributors; docs-only and standard PRs to ontorata/ratary are welcome without the mirror.
Ontorata MCP and Ontorata Studio accept contributions in their own repositories β not via this repo.
Questions: hello@ontorata.com