th-memory-mcp
memory-mcp
OpenCode용 장기 기억 MCP 서버 — 기본 설정, 교훈, 사용 기록을 단일 로컬 SQLite 파일에 저장합니다(100% 로컬, 외부 API 없음). 이를 통해 AI는 컨텍스트 기반 학습을 통해 사용자를 "기억하고 적응"할 수 있습니다.
상태: v1.1.0 — 4단계 모두 구현, 테스트 70/70 어서션 통과 (smoke 53 + capture 8 + distill 9)
ไทย / Thai: README.th.md
Architecture
OpenCode ──┬─ Plugin learning-capture (Bun) ── auto-captures prompts/tool/error into DB
│ └─ injects profile back into context on compaction
└─ MCP memory-mcp (Node.js stdio) ── 9 tools read/write the same SQLite DB
▲
Global instructions (memory-protocol.md) teach the AI to use the tools전체 세부 사항은 design.md를 참조하세요.
Related MCP server: MCP Vector Memory
Scripts
Command | Description |
| TypeScript를 |
|
|
| 규칙 기반 distill: 상호작용 → 프로필 섹션 + 오래된 데이터 정리 (env |
| JSON-RPC를 통한 엔드투엔드 스모크 테스트 ( |
| capture-core 테스트 (비밀 정보 필터링, 중복 제거, 잘라내기, SQL 삽입) |
| distill-core 테스트 (태국어 토큰화, 통계, 프로필 섹션, 정리) |
Tools (9)
Tool | Description |
| 기본 설정 upsert (카테고리+키) — 같은 키를 다시 저장하면 신뢰도가 0.1 증가 (최대 1.0) |
| 기본 설정 + 교훈 (FTS5) + 최근 일치 상호작용 검색. 새 작업을 시작하기 전에 사용하세요. |
| 사용자 프로필 개요: 프로필 섹션 + 상위 기본 설정 + 최근 교훈 5개 |
| 수정에서 배운 교훈 기록 (상황 / 실수 / 수정) |
| 키워드로 과거 사용자 프롬프트 검색 (행당 200자 스니펫) |
| ID로 메모리 행 하나 삭제 (기본 설정/교훈/상호작용) (+type은 테이블 간 ID 충돌 방지) |
| 메모리 통계: 종류별 개수, DB 크기, 가장 오래된/최신 상호작용, 프로필 섹션 |
| 최근 원시 상호작용 나열 (종류로 필터링) — Smart Distill의 원료 |
| 메모리를 |
Install with OpenCode
opencode.example.json의mcp섹션을opencode.json(전역 또는 프로젝트 수준)에 병합하세요.중요: 서버와 플러그인 모두에 대해
MEMORY_DB_PATH를 동일한 데이터베이스 파일로 설정하세요 (예제는<ABSOLUTE_PATH>/memory-mcp/data/memory.db를 사용합니다). 그렇지 않으면 자동 캡처 플러그인이 AI가 읽는 DB와 다른 DB에 씁니다.설정 방법 (하나 선택):
mcp
environment에 정의 (예제 참조) — MCP 서버에만 적용됩니다.또는 시스템/사용자 수준 환경 변수로 설정 (예: Windows에서
setx MEMORY_DB_PATH "D:/path/to/memory.db") — 서버와 플러그인 모두에 적용됩니다. 플러그인은 OpenCode와 같은 프로세스에서 실행되기 때문입니다.
전역 메모리 규칙을 첨부 —
opencode.json에 추가:"instructions": ["C:/Users/<user>/.config/opencode/memory-protocol.md"](예제 규칙 내용은
AGENTS.memory.example.md에 있습니다 — 대신 프로젝트 수준에서 첨부할 수 있습니다)(선택 사항) 자동 캡처 플러그인 배포:
src/plugin/learning-capture.ts를~/.config/opencode/plugins/learning-capture.ts로 복사하세요.OpenCode를 다시 시작하세요 (구성은 시작 시에만 로드됩니다).
테스트: "내가 pnpm을 선호한다는 것을 기억해" → 새 세션을 열고 다시 물어보세요.
Daily usage
AI는 태국어와 영어를 모두 상호 교환적으로 받아들입니다 — 언제든지 경고 없이 언어를 전환할 수 있습니다.
Thai | English | Effect |
"จำไว้ว่า..." | "기억해..." |
|
"สรุปความจำ" / "distill memory" | "메모리 요약" / "메모리 디스틸" | Smart Distill — AI가 |
"ระบบความจำเป็นไงบ้าง" | "내 메모리는 어때?" / "메모리 상태" |
|
"สำรองความจำ" | "메모리 내보내기" / "메모리 백업" |
|
"ค้นประวัติ..." | "기록 검색..." |
|
"ลืม..." | "잊어..." |
|
장기 관리: 가끔 npm run distill을 실행하여 통계를 요약하고 30일보다 오래된 상호작용을 정리하세요.
data/ structure
data/
├── memory.db # SQLite (WAL mode) — main DB (+ .db-wal, .db-shm)
└── exports/ # JSON files from export_memory (writeable only in this dir)DB 경로는
MEMORY_DB_PATH환경 변수로 재정의할 수 있습니다.data/의 모든 것은 git에서 무시됩니다.
Maintenance
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceProvides persistent local memory functionality for AI assistants, enabling them to store, retrieve, and search contextual information across conversations with SQLite-based full-text search. All data stays private on your machine while dramatically improving context retention and personalized assistance.3
- AlicenseNot gradedqualityNot gradedmaintenanceProvides AI coding agents with persistent, long-term memory through local semantic search and SQLite storage. It enables agents to save and retrieve architectural decisions or project context across different conversation sessions without requiring cloud services.
- AlicenseAqualityBmaintenanceProvides persistent cross-session memory and full-text search for AI coding assistants, storing project context, decisions, and preferences while enabling searchable access to conversation history via local SQLite.81MIT
- AlicenseAqualityBmaintenanceProvides AI coding assistants with persistent memory storage using a local SQLite database. Enables tools to remember project details, notes, and relationships across sessions to maintain context and reduce repetitive explanations.174MIT
Related MCP Connectors
Persistent memory and cross-session learning for AI coding assistants (hosted remote MCP).
Persistent memory for AI agents. Search, store, and recall across sessions.
Persistent memory for AI agents — verbatim conversations, searchable by meaning.
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/worakorn-prince/th-memory-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server