Foundation
MCP server for a self-hostable typed knowledge graph, giving AI agents durable structured memory with typed nodes, links, and flexible payloads. Enables agents to bootstrap, manage, and evolve their ontology via MCP tools.
README
Foundation
A personal ontology your agents can grow.
Foundation is a small, self-hostable typed knowledge graph + MCP server for AI agents (Cursor, Claude, and other MCP clients). It gives them durable structure — not just chat memory — and lets that structure evolve as your life does.
The name is a nod to Asimov: carry structured knowledge forward so you (and your agents) are not starting from zero every time.
Glossary (locked): Foundation = the product. A vault = one instance (FOUNDATION_DATA + Postgres). The graph = the knowledge in that vault. A blob = a file on a node. An agent = anything that can reach the vault MCP. The operator = the human who runs Compose. Do not call the graph “the Vault.” Short analog: app / folder / links → Foundation / vault / graph.
Do not commit personal life data, documents, or secrets to this repository. Those belong in the operator’s vault, not in git.
Docs
docs/SPEC.md— product contractdocs/ARCHITECTURE.md— living vault and graphdocs/MCP_TOOLS.md— 12-tool MCP surfacedocs/AGENTS.md— optional named-agent stand-updocs/VAULT_HEALTH.md— weekday instance checkupdocs/GRAPH_HYGIENE.md— weekly graph report
What it is
- Nodes with types (e.g. area → project → goal → habit/task, plus whatever emerges)
- Typed links between them
- Flexible payloads (markdown, HTML, JSON, files as blobs) so a trip itinerary can live in the graph as HTML and a PDF can live as
$FOUNDATION_DATA/blobs/<uuid> - MCP-first API so agents read and write the graph directly
- Agents may create and update types and relations as needed (activity log for undo); no approve/reject inbox required
What it is not
- Not a mobile app, billing system, or hosted SaaS you must buy
- Not a second brain you have to maintain by hand (agents are the primary users)
- Run Compose on a machine your agents can reach at localhost MCP
Install
Requires Docker Compose and a copy of this repo. Node 22 is only needed if you run the app on the host instead of in Compose.
-
Copy the env file and set an API key (do not commit
.env):cp .env.example .env # set FOUNDATION_API_KEY to a long random string -
Start Postgres and the Foundation server. Durable files go under
FOUNDATION_DATA(default./data):docker compose up --buildOptional stand-up. After Compose is up, see
docs/AGENTS.mdfor an optional named-agent recipe and three routines. What “healthy” means:docs/VAULT_HEALTH.md. Graph report:docs/GRAPH_HYGIENE.md. No new MCP tools. -
Point an MCP client at
http://127.0.0.1:8787/mcpwith:Authorization: ApiKey <FOUNDATION_API_KEY>Authorization: Bearer <FOUNDATION_API_KEY>is accepted as an equivalent.Cursor / Claude-style MCP config:
{ "mcpServers": { "foundation": { "url": "http://127.0.0.1:8787/mcp", "headers": { "Authorization": "ApiKey YOUR_KEY" } } } } -
Call
bootstrapfirst. It returns the starter spine (area → project → goal → habit | task), seeded types/relations, and how to extend the ontology.After bootstrap, an agent can
upsertanareaandproject,linkthem withchild_of, store an HTML itinerary on atripnode (payload.media_type = "text/html"),searchthat itinerary back, list open tasks withsearch{ type: "task", status: "active" }(no query), attach a PDF blob on anote(payload.storage = "blob"),manage_typea custom type,list_activityfor receipts, andundoa reversible mutation. Destructive tools (delete,unlink,undo) requireconfirm: true. If you already have a UUID, callget. An empty lexicalsearchis not a reason to upsert a duplicate.With Node 22 + pnpm (and Compose already up):
pnpm bootstrapOr with curl (SSE JSON-RPC; look for the
data:line):set -a && source .env && set +aHealth (no auth):
GET http://127.0.0.1:8787/health—{ ok, service, db }.Blobs: large files are
$FOUNDATION_DATA/blobs/<uuid>(not git, not agent-data). Ingest withupsert(payload.storage = "blob"plusbytes_base64, or drop a file in$FOUNDATION_DATA/uploadsand passsource_path). Cap 20MB. Fetch bytes:GET /blobs/:idwith the API key.getreturns blob metadata, not the file body.Bootstrap:
curl -sS http://127.0.0.1:8787/mcp \ -H "Authorization: ApiKey ${FOUNDATION_API_KEY}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"bootstrap","arguments":{}}}'Mutate → list_activity → search → undo (replace UUIDs from the upsert/
list_activityresponses):# upsert an HTML itinerary curl -sS http://127.0.0.1:8787/mcp \ -H "Authorization: ApiKey ${FOUNDATION_API_KEY}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"upsert","arguments":{"type":"trip","title":"Sample itinerary","payload":{"media_type":"text/html","storage":"inline","body":"<html><body><h1>Itinerary</h1><p>Day 1: arrive NRT</p></body></html>"}}}}' # search the itinerary back curl -sS http://127.0.0.1:8787/mcp \ -H "Authorization: ApiKey ${FOUNDATION_API_KEY}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search","arguments":{"query":"arrive NRT","type":"trip"}}}' # list receipts for that node curl -sS http://127.0.0.1:8787/mcp \ -H "Authorization: ApiKey ${FOUNDATION_API_KEY}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"list_activity","arguments":{"action":"create","target":"<NODE_UUID>"}}}' # undo that create (soft-deletes; requires confirm) curl -sS http://127.0.0.1:8787/mcp \ -H "Authorization: ApiKey ${FOUNDATION_API_KEY}" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"undo","arguments":{"id":"<ACTIVITY_UUID>","confirm":true}}}'Store a small PDF as a blob (synthetic example;
getreturnsblob_id+ sha256, not the bytes). Fetch bytes withGET /blobs/<BLOB_ID>:PDF_B64="$(printf '%s' '%PDF-1.1
trailer<</Root 1 0 R>>
%%EOF' | base64 -w0)"
curl -sS http://127.0.0.1:8787/mcp
-H "Authorization: ApiKey ${FOUNDATION_API_KEY}"
-H "Content-Type: application/json"
-H "Accept: application/json, text/event-stream"
-d "{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"upsert","arguments":{"type":"note","title":"Sample PDF","payload":{"media_type":"application/pdf","storage":"blob","bytes_base64":"${PDF_B64}"}}}}"
curl -sS "http://127.0.0.1:8787/blobs/<BLOB_ID>"
-H "Authorization: ApiKey ${FOUNDATION_API_KEY}"
-o /tmp/sample.pdf
Operator drop-box (no base64): copy a file into `$FOUNDATION_DATA/uploads/` then `upsert` with `payload.source_path` set to the filename. The server moves it to `blobs/<uuid>`. Compose `db-init` creates `uploads/` mode 1777 (sticky) so the host user can write on a bind mount; `blobs/` stays 0700.
If Postgres fails to start on a bind-mounted data dir, Compose already runs a `db-init` step that `chown`s `$FOUNDATION_DATA/postgres` to uid 999. Never `docker compose down -v` as a casual step; that is how you destroy a vault. Never delete `FOUNDATION_DATA`.
Never point `FOUNDATION_DATA` at an agent profile or memory directory.
## Intended use
1. Run Compose on a machine your agents can reach at localhost MCP
2. Point agents at the local MCP endpoint
3. Optionally stand up named agents and the three routines ([`docs/AGENTS.md`](docs/AGENTS.md))
## License
[MIT](LICENSE) © 2026 Danny Graziosi
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。