Engraphy

io.github.devon-clarkk由 GitHub 账号 devon-clarkk 发布v0.3.0更新于 Oct 25, 2026

Self-hosted MCP memory server: a typed knowledge graph on Postgres 16 and pgvector.

已验证STDIO仅桌面数据库知识与记忆

概览

AI 生成的概览

自托管的 MCP 记忆服务器,在 Postgres 与 pgvector 上为助手提供带类型的知识图谱,写入自动去重,检索融合语义与关键词。

可以做什么
写入记忆时与已有记忆比对,自动合并、建立关联或挂起为待判定的重复项,并返回共振报告。在单个或多个范围内进行语义与关键词融合检索,并从起始节点遍历图谱。按 id 读取完整节点及边摘要,获取由 pack 声明的会话起始简报。列出和创建范围,并取得说明各范围管辖内容的 routing manifest。通过 link、update、supersede 和重复项处理来编辑图谱,查看待处理写入、统计与捕获收件箱。管理空间、成员、令牌、授权与可见性。
适用场景
当助手需要持久、可共享、能承受并发、改写和重复的记忆,且你愿意自行运行一个基于 Postgres 的服务时适用。适合多用户或多空间场景,此时数据库层面的隔离比简单的本地 JSON 文件更重要。
运行要求
需要本地自托管部署:Docker 与 Compose,或无 Docker 路径下的 Postgres 16 加 pgvector、Python 3.12 与 dbmate。必需密钥 ENGRAPHY_DATABASE_URL 是连接带 pgvector 的 Postgres 16 数据库的 libpq 连接串,以非超级用户 engraphy_app 角色访问。客户端需携带由运维 CLI 签发的 Authorization bearer 令牌。可选 ENGRAPHY_BIND_HOST 与 ENGRAPHY_BIND_PORT 设置绑定接口和端口。嵌入模型首次启动时下载并缓存。
安装前请注意
缺少 ENGRAPHY_DATABASE_URL 时服务器拒绝启动,且每个发往 /mcp/ 的请求都需 Authorization bearer 令牌;令牌只显示一次,服务器仅保存其哈希,丢失后需重新签发。写入会改动已存记忆,管理工具可管理成员、令牌、授权与可见性。若要在本机回环之外暴露服务,需前置终止 TLS 的反向代理。许可证为源码可见的 Business Source License 1.1,在变更日期前向第三方提供托管或管理服务受到限制。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Engraphy,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Engraphy

An MCP server giving AI agents associative memory, modelled on the human mind.

[CI] [Latest release] [License: BSL 1.1] [Python 3.12+] [Postgres 16 + pgvector]

Quickstart · Documentation · Tool reference · Design set · Contributing

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. search fuses a vector leg (cosine over embeddings) and a lexical leg (Postgres full-text) with Reciprocal Rank Fusion, and traverse walks 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 NOBYPASSRLS role.
  • Scope routing built for LLMs. Every scope carries a description of what it governs; the read-only scope_guide tool 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

mermaid
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.

bash
# 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 + servedocker compose up -d          # the embedding model ships baked into the image
# 3. Create a space, apply the starter pack, mint a client tokendocker compose --profile admin run --rm admin \  engraphy-admin space create --id personal --display-name "My Memory" --principal medocker compose --profile admin run --rm admin \  engraphy-admin pack apply packs/starter/pack.yaml --space personaldocker 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:

bash
./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:

defaultoverride
space iddefault./provision.sh myspace or -Space myspace
principalme./provision.sh myspace alice or -Principal alice
client namemy-clientthird positional arg, or -ClientName
pack/app/packs/starter/pack.yamlENGRAPHY_PACK or -Pack
host port8000ENGRAPHY_HOST_PORT in .env, or -Port
health timeout1800s up, 600s provisionENGRAPHY_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:

ToolWhat it does
writeDedup-banded write; returns the node or a duplicate-check verdict plus a resonance report.
searchHybrid semantic + lexical retrieval across one scope or all.
traverseRecursive graph walk from a starting node.
getFull nodes plus edge summaries, by id.
briefingPack-declared session-start sections (due commitments, relevant notes, …).
scope_guideThe routing manifest: every writable scope and what it governs.
scope_list / scope_createList readable scopes / create a private one.
link · update · supersede · resolve_duplicateEdit the graph and settle pending verdicts.
pending_list · stats · inbox_reviewInspect 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:pg16 image ships both).
  • Python ≥ 3.12.
  • dbmate for migrations (bundled in the admin container; only needed on PATH for the no-Docker path).
  • The embedding model nomic-ai/nomic-embed-text-v1.5 (384-dim, on ONNX Runtime, 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. bench/RUN-LOCOMO.md is the walkthrough for running LoCoMo yourself: it needs an OpenAI-compatible base URL and key, and it pins the dataset, the arm, the models and the judge.

Contributing

Issues and pull requests are welcome. CONTRIBUTING.md covers getting a development database up, running the suite, what the three CI jobs check, and the house style. Security problems go through a private advisory rather than a public issue.

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.

来源:README.md,提交 dcb9f3b

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.3.0最新Sep 18, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。