opencode-memory
Integrates with Git to automatically version memory content, providing history, rollback, and synchronization capabilities.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opencode-memoryRecall what I know about the project's architecture"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenCode Memory System
基于 MCP 协议的 AI 记忆系统,支持语义向量检索、双记忆引擎、Git 版本管理。可接入任何支持 MCP 的 AI 客户端(OpenCode、HERMES、Claude Desktop、Cursor 等)。
功能特性
功能 | 说明 |
语义向量检索 | 基于 sentence-transformers + FAISS,支持中英文语义搜索 |
双记忆引擎 | 短期记忆(JSON 文件)+ 长期记忆(Markdown) |
Git 版本管理 | 记忆自动 commit,支持回滚 |
自动编码识别 | UTF-8 优先,自动回退系统编码,兼容 Windows 中文环境 |
代理字符防护 | 递归清洗 UTF-16 代理字符,防止编码崩溃 |
MCP 标准协议 | JSON-RPC over stdio,任何 MCP 客户端可直接调用 |
Related MCP server: knowledgeplane
提供的 MCP 工具
工具名 | 说明 |
| 保存记忆(自动存储 + Git commit) |
| 语义搜索记忆(合并 FAISS 索引 + 实时文件搜索) |
| 按关键词删除记忆 |
| 查看系统状态(索引、模型、记忆数量) |
| 重建向量索引(支持后台运行) |
| 查看 Git 变更历史 |
| 回滚到指定版本 |
| 初始化/同步 Git 仓库 |
快速安装
1. 安装依赖
pip install -r requirements.txt2. 下载模型(首次运行自动下载)
python scripts/semantic_search.py --download3. 配置 MCP 客户端
OpenCode (~/.config/opencode/opencode.jsonc)
{
"mcp": {
"memory": {
"type": "local",
"command": ["python", "-u", "scripts/mcp_server.py"],
"enabled": true
}
}
}HERMES (~/.hermes/config.yaml)
mcp_servers:
memory:
type: stdio
command: ["python", "-u", "/path/to/scripts/mcp_server.py"]Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"memory": {
"command": "python",
"args": ["-u", "/path/to/scripts/mcp_server.py"]
}
}
}目录结构
opencode-memory/
├── scripts/ # MCP Server 核心脚本
│ ├── mcp_server.py # MCP Server 主入口(JSON-RPC over stdio)
│ ├── semantic_search.py # 语义向量检索(sentence-transformers + FAISS)
│ ├── dual_memory_engine.py # 双记忆协同引擎
│ ├── build_full_index.py # 向量索引构建工具
│ ├── memory_config.py # 路径配置(自动适配系统)
│ ├── memory_git.py # Git 自动版本管理
│ ├── storage_tiers.py # 三层存储(热/温/冷)
│ ├── memory_maintain.py # 记忆维护工具
│ ├── memory_dedup.py # 记忆去重
│ ├── auto_index_updater.py # 自动索引更新
│ ├── plugin_bridge.py # 插件桥接(BM25 混合检索)
│ └── init_dual_memory.py # 双记忆引擎初始化
├── plugins/
│ └── memory-plugin/
│ └── index.ts # OpenCode 插件(可选)
├── skills/
│ └── memory-system/
│ └── SKILL.md # AI 技能文档
├── requirements.txt # Python 依赖
├── .gitignore
└── README.md工作原理
编码处理流程
客户端发送 UTF-8 字节
↓
┌─────────────────────────────────────┐
│ _detect_decode() 自动识别编码 │
│ ① 先试 UTF-8(MCP 标准协议) │
│ ② 失败→试系统编码(cp936/cp1252) │
│ ③ 再失败→UTF-8 + 替换非法字符 │
└─────────────────────────────────────┘
↓
┌─────────────────────────────────────┐
│ _clean_surrogates() 移除代理字符 │
│ _clean_obj() 递归清洗整个响应 │
└─────────────────────────────────────┘
↓
存储为 UTF-8 JSON 文件记忆检索流程
memory_recall("查询")
↓
┌────┴────┐
↓ ↓
FAISS 索引 STM 文件实时编码
(预构建) (即时搜索)
↓ ↓
└────┬────┘
↓
合并去重 + 按相似度排序
↓
返回 Top-K 结果依赖
Python 3.10+
sentence-transformers(语义编码)
faiss-cpu(向量索引)
numpy
许可证
MIT License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceAn MCP server that provides persistent, cross-session memory and team knowledge sharing for AI development workflows. It enables project DNA scanning, semantic search, context budgeting, and git-aware indexing to prevent AI context loss between sessions.Last updated30MIT
- Flicense-qualityBmaintenanceMCP server that gives AI agents and teams persistent, shared memory using a knowledge graph with vector embeddings, automatic consolidation of related facts, and hybrid search.Last updated3
- Alicense-qualityBmaintenanceA self-hosted MCP server that provides a personal semantic memory layer for AI tools. It enables storing, searching, and managing memories using hybrid vector and keyword search, allowing AI assistants to recall information by meaning.Last updatedMIT
Related MCP Connectors
Cloud-hosted MCP server for durable AI memory
Person-owned, portable AI memory as a remote MCP server, readable and writable by any MCP client.
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Shine8592/opencode-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server