Engraphy
Enables AI agents to maintain a self-hosted typed knowledge graph on Postgres and pgvector over MCP, with deduplicating writes, hybrid retrieval, and database-enforced isolation.
README
Engraphy
Associative memory for AI agents, modelled on the human mind.
The name comes from engraphy, an old term from memory science for the process of laying down an engram, the trace a memory leaves in the brain. Engraphy does that for agents: it checks each new memory against what it already knows before the write lands, merging restatements, linking genuinely new facts, and never silently overwriting. Nothing is deleted, so history stays walkable.
Engraphy is self-hosted. It stores what an agent learns as a typed knowledge graph on Postgres + pgvector: writes deduplicate themselves against existing memory, retrieval fuses semantic and lexical search, isolation between users is enforced by the database, and the whole shape of memory is declared per application as a pack.
It exists to replace the reference MCP memory server's flat-JSON, single-user, stdio model with something that survives concurrency, paraphrase, duplicates, and years of accumulated memory. It speaks the Model Context Protocol, so any MCP client (a VS Code extension, a desktop app, another agent) can use it over HTTP.
Source-available. Licensed under the Business Source License 1.1: read it, run it, build on it, and use it in production for your own product. Offering Engraphy itself as a hosted or managed service to third parties is reserved to the Licensor until the Change Date, when it converts to Apache-2.0. See License.
What it does
- A typed memory graph. Memories are typed nodes (
fact,decision,person,event, …) joined by typed edges (involves,references,supersedes, …). The types, their attribute schemas, and the rules for which edges may connect which types are declared per space in a pack and enforced in Postgres. - Writes that deduplicate themselves. Every write is embedded and banded against existing memory. A near-verbatim restatement auto-merges; a genuinely new but related fact is kept as its own searchable node and joined by an edge (nothing is silently absorbed); a borderline case parks as a pending duplicate-check verdict for the caller to resolve. Every write returns a resonance report of what it touched.
- Hybrid retrieval.
searchfuses a vector leg (cosine over embeddings) and a lexical leg (Postgres full-text) with Reciprocal Rank Fusion, andtraversewalks the edges. Attribute values are folded into the searchable surface, so a fact stored only in a typed attribute is still findable. - Isolation the database enforces. Multiple spaces, and multiple principals
within a space, are separated by Postgres Row-Level Security running under a
non-superuser role, not by application checks that can be forgotten. The server
connects as a
NOBYPASSRLSrole. - Scope routing built for LLMs. Every scope carries a description of what it
governs; the read-only
scope_guidetool returns that routing manifest so an agent can decide where a new memory belongs before it writes. - An operator CLI and an MCP tool surface for everything from bootstrapping a space to minting tokens, importing data, applying packs, and verifying restores.
How it works
flowchart LR
C[MCP client<br/>VS Code · desktop · agent] -->|HTTP + bearer token| S[Engraphy server<br/>FastMCP]
S --> E[Embedding<br/>nomic-embed-text-v1.5]
S --> DB[(Postgres 16 + pgvector<br/>nodes · edges · scopes<br/>RLS · schema enforcement)]
P[Pack<br/>types · edges · briefing] -.declares.-> DB
A write is embedded, banded by similarity into merge / merge-link / pending /
new, and committed under the caller's identity. A read (search, get,
traverse, briefing) runs under RLS so a caller only ever sees the scopes they
were granted. A pack declares the node types, edge types, attribute schemas,
and session-start briefing for a space, so one engine serves many differently
shaped memory applications. The architecture overview
walks the full write and read paths.
Quickstart
Requirements: Docker (with Compose). The cloud profile brings up Postgres, runs migrations, provisions the app role, and starts the server in one command.
# 1. Configure secrets (never committed)
cp deploy/.env.example .env # then edit, or:
printf 'POSTGRES_PASSWORD=%s\nENGRAPHY_APP_ROLE_PASSWORD=%s\n' \
"$(openssl rand -hex 16)" "$(openssl rand -hex 16)" > .env
# 2. Bring up Postgres + migrate + provision + serve
docker compose up -d # first boot downloads the ~523 MB embedding model
# 3. Create a space, apply the starter pack, mint a client token
docker compose --profile admin run --rm admin \
engraphy-admin space create --id personal --display-name "My Memory" --principal me
docker compose --profile admin run --rm admin \
engraphy-admin pack apply packs/starter/pack.yaml --space personal
docker compose --profile admin run --rm admin \
engraphy-admin token create --space personal --principal me \
--client-name my-editor --role readwrite
The server is now on 127.0.0.1:8000 (put a TLS-terminating reverse proxy in
front to expose it). Point any MCP client at it with the bearer token. The
setup guide covers the local, no-Docker path as well.
Or let the scripts do it
up.sh and provision.sh (with up.ps1 / provision.ps1 as Windows
equivalents) wrap exactly the sequence above, and add the waiting that a
copy-paste quickstart cannot:
./up.sh # writes .env with random passwords, starts the stack,
# then blocks until /healthz returns 200
./provision.sh # creates the space, applies the starter pack, mints a token,
# and prints the client settings to paste in
up.sh polls /healthz rather than compose's health status, because on first
boot compose reports starting for as long as the model cache takes to seed,
which looks identical to a crash-loop from the outside. A 200 is the real signal.
Both scripts are safe to re-run: an existing .env is never overwritten, and an
existing space or an already-applied pack is skipped rather than treated as an
error, so a re-run still mints a fresh token.
Everything is parameterised, with defaults that work unchanged:
| default | override | |
|---|---|---|
| space id | default |
./provision.sh myspace or -Space myspace |
| principal | me |
./provision.sh myspace alice or -Principal alice |
| client name | my-client |
third positional arg, or -ClientName |
| pack | /app/packs/starter/pack.yaml |
ENGRAPHY_PACK or -Pack |
| host port | 8000 |
ENGRAPHY_HOST_PORT in .env, or -Port |
| health timeout | 1800s up, 600s provision | ENGRAPHY_WAIT_SECS or -WaitSeconds |
The token is printed once and never written to disk by the scripts; the server
stores only its SHA-256. If you lose it, re-run provision.sh for a new one.
Using it from a client
Engraphy is an MCP server, so a client connects and calls tools:
| Tool | What it does |
|---|---|
write |
Dedup-banded write; returns the node or a duplicate-check verdict plus a resonance report. |
search |
Hybrid semantic + lexical retrieval across one scope or all. |
traverse |
Recursive graph walk from a starting node. |
get |
Full nodes plus edge summaries, by id. |
briefing |
Pack-declared session-start sections (due commitments, relevant notes, …). |
scope_guide |
The routing manifest: every writable scope and what it governs. |
scope_list / scope_create |
List readable scopes / create a private one. |
link · update · supersede · resolve_duplicate |
Edit the graph and settle pending verdicts. |
pending_list · stats · inbox_review |
Inspect pending writes, usage metrics, and the capture inbox. |
admin_* |
Space administration (members, tokens, grants, visibility). |
See the tool reference for parameters, returns, and
an example per tool. A first-party VS Code extension lives in
vscode-extension/.
Documentation
- docs/: developer documentation, architecture, setup, packs, tool reference, deployment, and an end-to-end tutorial.
- design/: the design set, the data model, retrieval and dedup, auth and tenancy, operations, the pack/ontology system, and the benchmark harness. This is where the engineering reasoning lives.
- skills/: concise guidance an LLM agent can load to use Engraphy well (writing and dedup, retrieval, scopes and visibility, answer discipline).
Requirements
- Postgres 16 with pgvector (the
pgvector/pgvector:pg16image ships both). - Python ≥ 3.12.
- dbmate for migrations (bundled in the
admin container; only needed on
PATHfor the no-Docker path). - The embedding model
nomic-ai/nomic-embed-text-v1.5(384-dim, ~523 MB, downloaded and cached on first boot).
Project status
v0.1.0. The schema and enforcement kernel, engine behaviors (dedup, hybrid
retrieval, graph traversal, briefings), the MCP server with auth and admin, and
the operator CLI are implemented and covered by a live-Postgres test suite plus a
CI job that exercises the shipped deploy artifacts end to end. A benchmark harness
(bench/, design/09) runs the engine against public long-term-memory datasets;
it is a tool for measuring changes, not a source of marketing numbers.
License
Engraphy is licensed under the Business Source License 1.1 (see
LICENSE).
- You may read, modify, redistribute, self-host, and use Engraphy in production as the memory layer for your own applications and agents.
- You may not offer Engraphy itself to third parties as a hosted or managed service before the Change Date.
- Change Date: 2026-08-22 + 4 years (2030-08-22), on which the license converts to the Apache License, Version 2.0.
Copyright (c) 2026 Devon Clark.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。