opencode-personal-knowledge
A personal knowledge MCP server with vector database for the Opencode ecosystem. It enables semantic search, tag organization, and session memory logging, all running locally without external API keys.
README
<p align="center"> <h1 align="center">🧠 opencode-personal-knowledge</h1> <p align="center"> <strong>A personal knowledge MCP server with vector database for the Opencode ecosystem</strong> </p> <p align="center"> <a href="https://www.npmjs.com/package/opencode-personal-knowledge"><img src="https://img.shields.io/npm/v/opencode-personal-knowledge.svg" alt="npm version"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> <a href="https://opencode.ai"><img src="https://img.shields.io/badge/Opencode-Compatible-blue.svg" alt="Opencode Compatible"></a> </p> </p>
Store and retrieve knowledge using semantic search, powered by local embeddings. No external API keys required.
✨ Features
- 🔍 Semantic Search — Find knowledge using vector embeddings (BGE-small-en-v1.5)
- 📝 Text Search — Keyword-based search fallback
- 🏷️ Tag Organization — Categorize entries with tags
- 🔌 Plug-and-Play — No external services required (embeddings run 100% locally)
- 💾 Persistent Storage — Data stored in
~/.local/share/opencode-personal-knowledge/ - 🔄 Automatic Indexing — Entries are vectorized on creation
🚀 Quick Start
Opencode Integration (Recommended)
Add to ~/.config/opencode/opencode.jsonc:
{
"mcp": {
"personal-knowledge": {
"type": "local",
"command": ["bunx", "opencode-personal-knowledge"],
"enabled": true
}
}
}
Restart Opencode — the MCP tools will be available immediately.
Source Installation (Development)
git clone https://github.com/NocturnLabs/opencode-personal-knowledge.git
cd opencode-personal-knowledge
bun install
bun run mcp # Start MCP server
🛠️ MCP Tools
Knowledge Tools
| Tool | Description |
|---|---|
store_knowledge |
Store a new knowledge entry with optional tags |
search_knowledge |
Semantic similarity search |
search_knowledge_text |
Keyword-based text search |
get_knowledge |
Retrieve entry by ID |
update_knowledge |
Update an existing entry |
delete_knowledge |
Delete an entry |
list_knowledge |
List entries with filters |
get_knowledge_stats |
Database statistics |
Session Memory Tools
Log and search across entire OpenCode sessions.
| Tool | Description |
|---|---|
start_logging_session |
Begin logging a session |
log_message |
Log a user/agent message to the session |
search_session |
Semantic search within a session |
search_all_sessions |
Search across ALL logged sessions |
list_sessions |
List all sessions |
get_session |
Get session details and messages |
end_session |
End session with optional summary |
📖 Example Usage
Storing Knowledge
User: "store a knowledge entry about Opencode Features"
Agent: Researches and stores entry:
✅ Stored knowledge entry #2: "Opencode Features"
📊 Indexed for semantic search
Searching Knowledge
User: "@search_knowledge for opencode"
Agent: Returns semantic matches:
Found 1 similar entry:
### 1. Opencode Features (85% similar)
Opencode is an open source AI coding agent...
Session Memory
User: "Start logging this session, call it 'auth debugging'"
Agent: Starts session and logs all exchanges:
✅ Started session #1: "auth debugging"
User: "Search this session for JWT"
Agent: Returns semantic matches from the session:
Found 2 matches in session #1:
### 1. [user] (92% match)
The JWT token expires too fast...
### 2. [agent] (88% match)
The TTL is set to 60 instead of 3600...
⚙️ Configuration
Data Location
By default, data is stored in:
~/.local/share/opencode-personal-knowledge/
├── knowledge.db # SQLite database
└── vectors/ # LanceDB vector store
Override with environment variable:
export OPENCODE_PK_DATA_DIR=/custom/path
Embedding Model
Uses BGE-small-en-v1.5 via FastEmbed (auto-downloads on first use).
🏗️ Technology Stack
- Runtime: Bun / Node.js
- Vector DB: LanceDB (embedded)
- Embeddings: FastEmbed (ONNX Runtime)
- MCP SDK: @modelcontextprotocol/sdk
- Database: SQLite (via Bun)
📄 License
MIT © NocturnLabs
<p align="center"> Made with 🖤 for the <a href="https://opencode.ai">Opencode</a> ecosystem </p>
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。