AI Diary MCP Server
A private, local-first MCP server that gives any AI long-term memory — its own diary. Zero models, zero network, zero subscription; smarter search than Notion, running entirely on your machine.
README
<div align="center">
<img src="docs/banner.png" alt="AI Diary — local-first memory for AI" width="100%" />
<p> <b>A private, local-first MCP server that gives any AI long-term memory — its own diary.</b><br/> Zero models · zero network · zero subscription. Smarter search than Notion, running entirely on your machine. </p>
<p> <img src="https://img.shields.io/badge/TypeScript-5.8-3178c6?logo=typescript&logoColor=white" alt="TypeScript" /> <img src="https://img.shields.io/badge/Node-%E2%89%A520-339933?logo=node.js&logoColor=white" alt="Node" /> <img src="https://img.shields.io/badge/MCP-stdio-7c5cff" alt="MCP" /> <img src="https://img.shields.io/badge/SQLite-FTS5%20trigram-003b57?logo=sqlite&logoColor=white" alt="SQLite FTS5" /> <img src="https://img.shields.io/badge/local--first-100%25%20offline-36d399" alt="Local-first" /> <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT" /> </p>
<p> <a href="#-quick-start">Quick start</a> · <a href="#-the-dashboard">Dashboard</a> · <a href="#-connect-it-to-your-ai">Connect</a> · <a href="#-tools">Tools</a> · <a href="#-why-its-better-than-notion">Why</a> </p>
</div>
✨ Highlights
- 🔒 Truly private. Every memory lives in one SQLite file on your disk. Nothing is ever uploaded.
- 🧠 No embeddings, still smart. Retrieval uses SQLite FTS5 + BM25 with a trigram tokenizer, so search is instant and works great for English and 中文 / CJK.
- 🤝 Borrows your platform's brain. When the host supports MCP sampling,
recallexpands & re-ranks andreflectauto-summarizes — with graceful fallback when it doesn't. The server itself never ships a model. - 🕸️ A real knowledge graph. Link memories and traverse the web of context.
- 🗂️ Collections, tags, importance, reflection, dedup. Organize like Notion — locally and programmatically.
- 🎨 A beautiful local dashboard. Browse, search, and add memories in your browser (dark & light).
- 🧩 Works everywhere MCP does. Claude Desktop, Cursor, Windsurf, Cline, VS Code, Zed…
🖥️ The dashboard
A polished local web UI over the same database — npm run dashboard, then open http://localhost:4178.
<div align="center"> <img src="docs/dashboard-home.png" alt="AI Diary dashboard — all memories" width="80%" /> <br/><br/> <table> <tr> <td width="50%"><img src="docs/dashboard-tags.png" alt="Tag view" width="100%" /></td> <td width="50%"><img src="docs/dashboard-new.png" alt="New memory" width="100%" /></td> </tr> <tr> <td align="center"><sub>Tags, including 中文</sub></td> <td align="center"><sub>Add a memory in a click</sub></td> </tr> </table> </div>
Browse · full-text search (English + 中文) · filter by tag/collection · spot near-duplicates · add memories · dark/light theme · one-click git snapshot.
🏆 Why it's better than Notion
| AI Diary | Notion | |
|---|---|---|
| Privacy | 100% local, single file you own | Cloud-hosted |
| Built for AI | Native MCP tools an agent calls directly | Manual / limited API |
| Chinese search | FTS5 trigram — precise CJK substring search | Weak |
| Knowledge graph | First-class links + graph traversal | No |
| Offline | Always | No |
| Cost | Free, no subscription | Paid tiers |
| Versioning | Optional git history of your memory | Limited |
🚀 Quick start
git clone https://github.com/pangxianggang/ai-diary-mcp.git
cd ai-diary-mcp
npm install
npm run build # produces dist/index.js — the stdio MCP server
npm run smoke # self-test (26 assertions)
Try the dashboard with some sample data:
AI_DIARY_DB_PATH=./demo.db node scripts/seed-demo.mjs
AI_DIARY_DB_PATH=./demo.db npm run dashboard # http://localhost:4178
Override the port with
AI_DIARY_PORT.
🎨 The design philosophy
The server is the hippocampus — fast storage, structure, and retrieval. Your platform's model is the cortex — it reasons, summarizes, and decides what to remember.
The server never calls an LLM and never goes online. That keeps it private, free, and trivially portable.
💾 Where memories are stored
A single SQLite file:
| OS | Default path |
|---|---|
| Windows | %APPDATA%\ai-diary\memory.db |
| macOS | ~/Library/Application Support/ai-diary/memory.db |
| Linux | $XDG_DATA_HOME/ai-diary/memory.db (or ~/.local/share/...) |
Override with AI_DIARY_DB_PATH. Back up by copying the file. Keep it inside a git repo and call snapshot for versioned memory history.
🔌 Connect it to your AI
Use the absolute path to the built dist/index.js.
Claude Desktop
claude_desktop_config.json (Settings → Developer → Edit Config):
{
"mcpServers": {
"ai-diary": {
"command": "node",
"args": ["/absolute/path/to/ai-diary-mcp/dist/index.js"]
}
}
}
Cursor / Windsurf / Cline / Zed / VS Code
All use the same shape — command: "node" with args pointing at dist/index.js. Add an env block to relocate the database:
{
"mcpServers": {
"ai-diary": {
"command": "node",
"args": ["/absolute/path/to/ai-diary-mcp/dist/index.js"],
"env": { "AI_DIARY_DB_PATH": "/absolute/path/to/my-memory.db" }
}
}
}
Restart the client after editing its config.
🧰 Tools
| Tool | What it does |
|---|---|
remember |
Save a memory (content, optional tags, category, importance 1–5, occurred_at). Identical content is de-duplicated. |
recall |
Search by text (FTS5 BM25, CJK-aware) with optional tags / category / collection_id / time filters. smart=true adds host-model query expansion + re-ranking (with fallback). |
recent |
List the most recently created memories. |
timeline |
Browse chronologically by when things occurred. |
get |
Fetch one memory by id, including its links. |
update |
Edit an existing memory. |
forget |
Archive (default) or hard-delete a memory. |
link |
Connect two memories into a knowledge graph (e.g. caused, related). |
graph |
Traverse the knowledge graph around a memory (BFS to a depth) and return connected memories + links. |
find_duplicates |
Surface near-duplicate memories via trigram similarity. |
create_collection / add_to_collection / list_collections |
Group memories into Notion-like collections. |
list_tags |
All tags with usage counts. |
stats |
Totals, categories, time range, db location. |
export |
Export memories as Markdown. |
reflect |
Consolidate related memories. auto=true (with host sampling) summarizes and stores the reflection, linked to its sources. |
snapshot |
Commit the SQLite file to git for versioned memory history. |
Resource memory://recent (recent entries as Markdown) · Prompt recall-about (recall + summarize a topic).
🧱 Capabilities by phase
- MVP — SQLite + FTS5 (CJK trigram) + full CRUD over stdio, one-line client config.
- Smart retrieval — optional MCP-sampling query expansion + re-ranking in
recall, automatic fallback to plain FTS5. - Structure — tags, collections, links / knowledge graph traversal, importance, soft-forget.
- Reflection —
reflect auto=trueconsolidates memories via the host model;find_duplicatesfor de-duplication. - Experience — a polished local web dashboard + Markdown export + optional git-versioned history.
🔍 How search works (without embeddings)
- FTS5 + BM25 ranks entries by relevance. The trigram tokenizer indexes 3-character sequences, which is what makes substring and CJK search work.
- Metadata filters (tags, category, collection, time range, importance) narrow results.
- Queries shorter than 3 characters fall back to a
LIKEsubstring scan. - With
smart=true, a sampling-capable host expands the query and re-ranks candidates — but the core works fully without it.
🛠️ Development
npm run dev # tsc --watch
npm run typecheck # type-check only
npm run smoke # in-memory end-to-end check (26 assertions)
npm run dashboard # local web UI
📄 License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。