open-memory
Gives AI tools (Copilot, Claude, etc.) access to a personal knowledge base stored as plain markdown files, indexed and searched via QMD (BM25 + vector embeddings).
README
open-memory
One brain, every AI. An MCP server that gives any AI tool (Copilot, Claude, Codex, Cursor, ChatGPT) access to your personal knowledge base through a single open protocol.
Your memory lives as plain markdown files. QMD indexes and searches them (BM25 + vector embeddings). open-memory wraps it all in an MCP server that any client can connect to. No database. No SaaS. Files are the source of truth.
graph LR
Copilot -->|MCP| OM[open-memory<br/>stdio or SSE]
Claude_Code[Claude Code] -->|MCP| OM
Cursor -->|MCP| OM
Codex -->|MCP| OM
ChatGPT -->|MCP| OM
OM -->|QMD| FS[memory/*.md<br/>MEMORY.md<br/>notes/*.md]
style OM fill:#2d333b,stroke:#539bf5,color:#adbac7
style FS fill:#2d333b,stroke:#57ab5a,color:#adbac7
Transport: local (stdio) or remote (SSE over Tailscale/tunnel)
Why
Every AI tool has its own memory silo. Copilot doesn't know what you told Claude. Cursor doesn't remember what Codex learned. You re-explain context every time you switch tools.
open-memory fixes this: one directory of markdown files, one search index, one MCP server. Any tool that speaks MCP gets your full context.
Cost: $0. Self-hosted, no external services.
Quick Start
Prerequisites
- Node.js 20+
- QMD (the search/indexing engine)
Install QMD
# Using bun (fastest)
bun install -g qmd
# Or npm
npm install -g qmd
Set Up Your Memory
If you're starting fresh:
mkdir -p ~/memory/memory
echo "# My Knowledge Base" > ~/memory/MEMORY.md
echo "# $(date +%Y-%m-%d)" > ~/memory/memory/$(date +%Y-%m-%d).md
If you already use OpenClaw, your memory is at ~/.openclaw/ (MEMORY.md + memory/*.md). Point open-memory there.
Index Your Files with QMD
# Create a collection pointing to your memory directory
qmd collection add ~/memory --name my-memory --mask "**/*.md"
# Generate vector embeddings (needed for semantic search)
# Requires OPENAI_API_KEY or a local embedding model
qmd embed
QMD supports multiple embedding providers. See QMD docs for configuration.
Install & Run open-memory
# Clone
git clone https://github.com/DanWahlin/open-memory.git
cd open-memory
# Install & build
npm install
npm run build
# Configure (optional)
cp .env.example .env
# Edit .env to set QMD_BIN path, MEMORY_DIR, auth token, etc.
# Run (HTTP/SSE mode for remote clients)
npm start
# Or run in stdio mode (for local clients)
npm run start:stdio
Connecting AI Tools
GitHub Copilot CLI
The fastest way to connect. Run copilot in your terminal, then:
/mcp add
Fill in the interactive form:
| Field | Value |
|---|---|
| Server Name | open-memory |
| Server Type | STDIO (press the corresponding number) |
| Command | node /path/to/open-memory/dist/stdio.js |
| Environment Variables | {"QMD_BIN": "/path/to/qmd", "MEMORY_DIR": "/path/to/your/memory"} |
| Tools | * |
Press Ctrl+S to save. The server is available immediately, no restart needed.
You can also edit the config file directly at ~/.copilot/mcp-config.json:
{
"mcpServers": {
"open-memory": {
"type": "local",
"command": "node",
"args": ["/path/to/open-memory/dist/stdio.js"],
"env": {
"QMD_BIN": "/path/to/qmd",
"MEMORY_DIR": "/path/to/your/memory"
},
"tools": ["*"]
}
}
}
Manage your server with /mcp show, /mcp edit open-memory, or /mcp delete open-memory.
For remote access (SSE), use type "http" or "sse" with your server URL instead.
Claude Code
claude mcp add open-memory -- node /path/to/open-memory/dist/stdio.js
Or add to your MCP config:
{
"mcpServers": {
"open-memory": {
"command": "node",
"args": ["/path/to/open-memory/dist/stdio.js"],
"env": {
"QMD_BIN": "/path/to/qmd",
"MEMORY_DIR": "/path/to/your/memory"
}
}
}
}
Cursor
Add to your Cursor MCP settings (Settings > MCP Servers):
{
"mcpServers": {
"open-memory": {
"command": "node",
"args": ["/path/to/open-memory/dist/stdio.js"],
"env": {
"QMD_BIN": "/path/to/qmd",
"MEMORY_DIR": "/path/to/your/memory"
}
}
}
}
Codex CLI
Add to ~/.codex/config.toml:
[mcp_servers.open-memory]
command = 'node'
args = ['/path/to/open-memory/dist/stdio.js']
[mcp_servers.open-memory.env]
QMD_BIN = '/path/to/qmd'
MEMORY_DIR = '/path/to/your/memory'
VS Code (Copilot Chat)
Add to .vscode/mcp.json in your workspace (or ~/.vscode/mcp.json globally):
{
"servers": {
"open-memory": {
"command": "node",
"args": ["/path/to/open-memory/dist/stdio.js"],
"env": {
"QMD_BIN": "/path/to/qmd",
"MEMORY_DIR": "/path/to/your/memory"
}
}
}
}
Remote Access (SSE mode)
Run the HTTP server on a machine with your memory files:
OPEN_MEMORY_TOKEN=your-secret-token npm start
Connect from any MCP client that supports SSE or HTTP transport:
URL: http://<your-server>:3838/sse
Auth: Bearer your-secret-token
For GitHub Copilot CLI remote access, use /mcp add with type HTTP or SSE and paste the URL.
Over Tailscale, use your Tailscale IP. Over the internet, put it behind a reverse proxy with HTTPS.
Tools
open-memory exposes 7 MCP tools:
| Tool | Description |
|---|---|
search_memory |
Semantic, keyword, or hybrid search across your knowledge base |
read_memory |
Read a specific memory file by path |
write_memory |
Append to today's daily note (or a specific file) |
list_memories |
List memory files in a directory |
browse_recent |
Preview recent daily notes |
get_document |
Get any indexed document by path or QMD docid |
memory_status |
Show index health, collections, and document counts |
Configuration
All configuration via environment variables (or .env file):
| Variable | Default | Description |
|---|---|---|
QMD_BIN |
qmd |
Path to QMD binary |
MEMORY_DIR |
~/.openclaw |
Root directory for memory files |
DAILY_NOTES_DIR |
memory |
Subdirectory for daily notes (within MEMORY_DIR) |
MAIN_MEMORY_FILE |
MEMORY.md |
Main memory file name |
QMD_COLLECTION |
(empty) | QMD collection to search (empty = all) |
PORT |
3838 |
HTTP server port (SSE mode) |
OPEN_MEMORY_TOKEN |
(empty) | Bearer token for auth (empty = no auth) |
QMD Setup Guide
QMD is the search engine behind open-memory. It indexes markdown files and provides BM25 (keyword), vector (semantic), and hybrid search.
Collections
QMD organizes files into collections. Create one for your memory:
# Index a directory of markdown files
qmd collection add ~/my-notes --name notes --mask "**/*.md"
# List your collections
qmd collection list
# Re-index after adding files
qmd update
Embeddings
For semantic search, QMD needs vector embeddings:
# Set your API key (OpenAI, or compatible provider)
export OPENAI_API_KEY=sk-...
# Generate embeddings
qmd embed
# Check status
qmd status
Search Modes
# Keyword search (fast, exact matching)
qmd search "project decisions"
# Semantic search (finds conceptually related content)
qmd vsearch "what did we decide about the architecture"
# Hybrid (best quality, combines both + reranking via local LLM)
qmd query "why did we choose Postgres over MongoDB"
Architecture
graph TB
Client[MCP Client<br/>Copilot · Claude · Cursor · Codex]
Client -->|MCP Protocol<br/>stdio or SSE| Server
subgraph Server[open-memory server]
search_memory -->|vsearch / search / query| QMD
read_memory --> FS_read[fs.readFileSync]
write_memory --> FS_append[fs.appendFileSync]
get_document -->|get| QMD
list_memories --> FS_readdir[fs.readdirSync]
browse_recent --> FS_readdir
memory_status -->|status| QMD
end
Server --> FileSystem
subgraph FileSystem[File System]
MEMORY[MEMORY.md<br/>curated long-term knowledge]
Daily[memory/YYYY-MM-DD.md<br/>daily notes]
Other[*.md<br/>any indexed markdown]
end
style Client fill:#2d333b,stroke:#539bf5,color:#adbac7
style Server fill:#1c2128,stroke:#539bf5,color:#adbac7
style FileSystem fill:#1c2128,stroke:#57ab5a,color:#adbac7
Key design decisions:
- Files are the source of truth, not a database
- QMD handles all indexing and search (BM25 + vector)
- Zero external services required
- Two transport modes: stdio (local) and SSE (remote)
- Auth via bearer token for remote access
Docker
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY dist/ dist/
RUN npm install -g qmd
ENV QMD_BIN=qmd
EXPOSE 3838
CMD ["node", "dist/server.js"]
Mount your memory directory:
docker run -v ~/memory:/memory -e MEMORY_DIR=/memory -p 3838:3838 open-memory
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 模型以安全和受控的方式获取实时的网络信息。