copal
Copal is a self-hosted memory layer for LLMs, providing a persistent knowledge hub via MCP. It allows AI assistants to store and retrieve memory across sessions.
README
<p align="center"> <img src="brand/copal-lockup-horizontal.png" alt="Copal" width="380"> </p>
<p align="center"><strong>A self-hosted, headless personal knowledge hub — a persistent memory layer for your LLM assistants.</strong></p>
Copal is an open-source second brain that sits between your AI assistants (Claude, ChatGPT, agents like Hermes, n8n) and stores everything they capture, so nothing is ever lost and any assistant can pick up where another left off. It exposes one tool surface — an MCP server (Model Context Protocol) plus a REST mirror — that N conversational clients read and write through. Copal itself doesn't chat; it remembers.
Named after copal — tree resin that hasn't yet fossilized into amber. Like amber, it preserves what falls into it.
Keywords: personal knowledge management (PKM), second brain, self-hosted note-taking, LLM memory, AI agent memory, Hermes agent harness, MCP server, Model Context Protocol, knowledge graph, semantic search, vector search, embeddings, RAG, headless CMS for thoughts, Postgres, pgvector, TypeScript.
The idea
Two regimes joined by one link graph:
- A rigid spine — boards of work items with declared statuses (a monday.com-style tracker). Work has state.
- A fluid material — ideas, conversation sessions, and captured content. Thoughts flow; they have no status column, just a trail.
And one promise: nothing is ever deleted. Entities can sink out of the foreground but stay in the corpus forever — searchable, embeddable, and resurfaceable. Declared state is dangerous for thoughts and correct for work; Copal makes that literal.
Features
- 🧠 One memory, many clients. A single MCP + REST surface. Point Claude, ChatGPT, an agent framework, or a script at it — none of them owns your memory.
- 🔗 Everything is a linkable object. Ideas, items, sessions, and content connect to anything; explore your knowledge as a graph.
- 🔎 Semantic search + resonance. Every capture self-embeds (pgvector, HNSW cosine); a nightly Librarian surfaces discovered connections between related material as advisory suggestions.
- 🪶 A calm background worker. The Housekeeper distills conversation transcripts into resumable handoff summaries and catalogues content — on a configurable model chain with automatic failover and a hard daily spend cap.
- 📝 Markdown-native reader, board drag-and-drop, inline-editable cells, file attachments, and a clean Linear-style console.
- 🧾 Append-only audit log — every mutation records who / what / when (metadata-only, so secrets in free text never land in the log).
- 🩺 Operable by default — a
/statusdeep health-check (WAL archiving, worker liveness, spend, queues), CI, and a documented backup/restore runbook. - 🔒 Yours. Self-hosted; per-client hashed bearer tokens with
read/write/adminscopes; corpus-derived text is treated as inert data, never as instructions.
How it works
LLM clients (Claude · ChatGPT · Hermes · n8n)
│ MCP (Streamable HTTP) + REST
▼
┌──────────────────────────────┐
│ Copal core (Node + Fastify) │ ← the one tool surface; never converses
│ · boards/items (the spine) │
│ · ideas/sessions/contents │
│ · polymorphic link graph │
│ · Housekeeper (summaries) │
│ · Librarian (resonance) │
└──────────────┬───────────────┘
▼
PostgreSQL 16 + pgvector (+ WAL archiving for backups)
- Backend: Node 22 + TypeScript, Fastify, Drizzle ORM, the official MCP SDK.
- Store: PostgreSQL 16 with
pgvector(full-text now, semantic vectors always). - Console: Vite + React 19 + Tailwind — a fast SPA served by the same process.
- AI: a configurable, provider-agnostic model chain (Google Gemini / Anthropic / add your own) for summaries; OpenAI embeddings for search. All optional — capture works with no keys at all.
Quick start
See SETUP.md for the full walkthrough. In short:
cp .env.example .env # set DATABASE_URL (+ optional AI keys)
psql "$DATABASE_URL" -c "CREATE EXTENSION IF NOT EXISTS vector;"
npm ci
npm run db:migrate
npm run db:seed # optional: a starter workspace + example board
npm run mint-token -- me read,write,admin
npm run build && npm start # serves the API + console on :8787
Open the console, paste your token, and you're in. Connect any MCP client to /mcp (or the REST API at /api/v1) with a token.
Give it a voice — Hermes is the recommended harness
Copal is deliberately headless: it remembers, but it doesn't converse. To give it a conversational front-end, pair it with an agent harness — and Hermes is the one Copal is designed around and recommends. The pattern:
- during a conversation, the agent writes facts live through Copal's MCP tools (ideas, items, links, sessions);
- when the conversation ends, a small Hermes capture plugin (included) posts the full transcript to Copal as a safety net — so nothing is lost even if the model forgot to save.
Any MCP-capable client works (Claude, ChatGPT, your own agents), but Hermes + Copal is the intended pairing: a capable, tool-using agent up front, a durable memory behind it.
Design & docs
DESIGN.md— the principles (intelligence at the edge, one tool surface, nothing is deleted, corpus inertness).SETUP.md— install & first run.docs/DATA-FLOWS.md— exactly what data leaves for which AI provider, and why.ops/— backup / restore runbook.
Status
Early but daily-driven and hardened: migrations, tests, CI, an audit log, and a /status monitor endpoint are in place. APIs may still shift before a tagged release. Contributions and issues welcome.
License
Code is MIT. The Copal name and logo are not covered by the MIT license — copyright and trademark in the identity belong to the project owner; see brand/ and brand/LICENSE-ASSETS.md.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。