Kybase
A self-hosted knowledge base that provides persistent memory for AI agents via MCP, enabling note management, semantic search, and graph-based knowledge exploration.
README
<p align="center"> <img src="public/banner.png" alt="Kybase Banner" width="100%"> </p>
<h1 align="center">Kybase</h1>
<p align="center"> <strong>A personal, self-hosted knowledge base that your AI agent uses as native, persistent memory.</strong> </p>
Kybase is a complete, self-contained Markdown notes application and MCP (Model Context Protocol) server.
- For You: A sleek web-based notes editor with wikilinks
[[Title]], an interactive visual knowledge graph, backlinks, and bilingual hybrid search. - For Claude (Claude Code / Desktop): A persistent memory vault that survives across chats, automatically growing and linking notes as you work.
Everything runs locally on your machine via Docker: PostgreSQL for notes, pgvector + Ollama for embeddings. No SaaS, no accounts, 100% private.
Why Kybase?
Giving an agent persistent memory usually means assembling it yourself:
a notes app, an MCP bridge, an embedding pipeline, and sync between them.
Kybase is that whole stack as one docker compose up:
- MCP-native — 13 tools (
search_notes,get_note_with_links,get_graph,get_backlinks, CRUD for notes/folders) over Streamable HTTP, with instructions that teach the agent to interlink notes properly - Local semantic search — pgvector + Ollama embeddings, private by default; hybrid RRF fusion with bilingual full-text search
- Agent-friendly graph — explicit wikilink edges plus semantic edges computed from embedding similarity, so the agent discovers related notes that were never linked
- Zero external services — app, Postgres+pgvector, and Ollama in one compose file; single-secret auth
Features
- Markdown notes with wikilinks —
[[Title]]links between notes, backlinks panel; renaming a note rewrites its wikilinks everywhere - Graph view — link edges plus semantic edges with a similarity slider
- Hybrid search — RRF fusion of pgvector cosine similarity and bilingual FTS, chunked embeddings, excerpt-based results
- Workspace focus mode — filter tree, graph, and search down to one top-level folder
- Pluggable embeddings — Ollama (local, default), Google, or OpenAI, all 768-dim, switchable without schema changes
Stack
| Layer | Tech |
|---|---|
| Frontend | Next.js App Router, React 19 |
| Database | PostgreSQL 16 + pgvector (direct pg connection) |
| Embeddings | Ollama nomic-embed-text (default) / Google / OpenAI |
| Search | RRF hybrid: pgvector HNSW cosine + bilingual FTS |
| MCP | @modelcontextprotocol/sdk Streamable HTTP |
| Auth | Single KYBASE_SECRET env var |
Quick Start (Docker)
git clone https://github.com/Kyrzin/kybase.git
cd kybase
cp .env.example .env
# edit .env: set KYBASE_SECRET (openssl rand -hex 32)
docker compose up -d --build
Open http://localhost:3000 and log in with your KYBASE_SECRET.
That's it. On first start Postgres applies db/migrations/*.sql
automatically and Ollama downloads the embedding model (~270 MB, one time).
Change the host port with KYBASE_PORT in .env.
Note on embeddings: notes and text search work immediately. Semantic search and semantic graph edges activate once Ollama finishes pulling the model and notes get indexed (automatic, in the background).
Connect Claude (MCP)
The app exposes a Streamable HTTP MCP endpoint at /api/mcp.
Claude Code — add to .mcp.json (or claude mcp add):
{
"mcpServers": {
"kybase": {
"type": "http",
"url": "https://your-domain/api/mcp",
"headers": {
"Authorization": "Bearer <KYBASE_SECRET>"
}
}
}
}
claude.ai — Settings → Connectors → Add custom connector, same URL (requires the instance to be reachable over HTTPS).
Available tools: list_notes, get_note, get_note_with_links,
create_note, update_note, delete_note, search_notes, list_folders,
create_folder, update_folder, delete_folder, get_backlinks, get_graph.
The server ships with MCP instructions that teach the agent to search before
writing and to add [[wikilinks]] to related notes — so the knowledge graph
grows as the agent uses it, instead of accumulating orphan notes.
Local development
# Postgres only (app runs on the host)
docker compose up -d db
cp .env.example .env.local
# in .env.local: set KYBASE_SECRET and uncomment DATABASE_URL
npm install
npm run dev # http://localhost:3000
Switching Embedding Providers
You can switch the embedding provider (between local Ollama, Google, or OpenAI) and trigger re-indexing directly in the browser:
- Open the settings modal in the web UI.
- Select your provider, add the API key if needed, and click Save & Apply (switching the provider automatically triggers background re-indexing).
- Alternatively, click Reindex to force-reindex all your notes.
All supported providers use 768-dimensional embeddings, so switching does not require any database schema changes.
CLI Alternative: If you prefer using the terminal, you can trigger re-indexing by calling the admin endpoint:
docker compose exec kybase node -e " fetch('http://localhost:3000/api/admin/reindex', { method: 'POST', headers: { Authorization: 'Bearer <KYBASE_SECRET>' } }).then(r => r.json()).then(console.log) "
Upgrading
docker-entrypoint-initdb.d migrations only run on a fresh database volume.
When an upgrade ships a new db/migrations/NNN_*.sql, apply it manually:
docker compose exec -T db psql -U kybase kybase < db/migrations/NNN_name.sql
Development
npm test # Vitest unit tests (wikilinks, embeddings, search/RRF)
npm run build # Production build check
npx tsc --noEmit # Type check
License
PolyForm Noncommercial 1.0.0 — free to use, modify, and share for any noncommercial purpose. Commercial use requires a separate license from the author.
Required Notice: Copyright © Denis Kurzin (https://github.com/Kyrzin)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
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 模型以安全和受控的方式获取实时的网络信息。