Skip to main content
Glama

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

npm run build

TypeScript를 dist/로 컴파일

npm start

dist/index.js에서 MCP 서버(stdio) 실행

npm run distill

규칙 기반 distill: 상호작용 → 프로필 섹션 + 오래된 데이터 정리 (env RETENTION_DAYS 기본 30)

npm test

JSON-RPC를 통한 엔드투엔드 스모크 테스트 (node test/smoke.mjs)

node test/capture.test.mjs

capture-core 테스트 (비밀 정보 필터링, 중복 제거, 잘라내기, SQL 삽입)

node test/distill.test.mjs

distill-core 테스트 (태국어 토큰화, 통계, 프로필 섹션, 정리)

Tools (9)

Tool

Description

remember

기본 설정 upsert (카테고리+키) — 같은 키를 다시 저장하면 신뢰도가 0.1 증가 (최대 1.0)

recall

기본 설정 + 교훈 (FTS5) + 최근 일치 상호작용 검색. 새 작업을 시작하기 전에 사용하세요.

get_profile

사용자 프로필 개요: 프로필 섹션 + 상위 기본 설정 + 최근 교훈 5개

save_lesson

수정에서 배운 교훈 기록 (상황 / 실수 / 수정)

search_history

키워드로 과거 사용자 프롬프트 검색 (행당 200자 스니펫)

forget

ID로 메모리 행 하나 삭제 (기본 설정/교훈/상호작용) (+type은 테이블 간 ID 충돌 방지)

memory_stats

메모리 통계: 종류별 개수, DB 크기, 가장 오래된/최신 상호작용, 프로필 섹션

get_recent_interactions

최근 원시 상호작용 나열 (종류로 필터링) — Smart Distill의 원료

export_memory

메모리를 data/exports/ 아래에 JSON으로 내보내기 (파일명 자동 정리)

Install with OpenCode

  1. opencode.example.jsonmcp 섹션을 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와 같은 프로세스에서 실행되기 때문입니다.

  2. 전역 메모리 규칙을 첨부 — opencode.json에 추가:

    "instructions": ["C:/Users/<user>/.config/opencode/memory-protocol.md"]

    (예제 규칙 내용은 AGENTS.memory.example.md에 있습니다 — 대신 프로젝트 수준에서 첨부할 수 있습니다)

  3. (선택 사항) 자동 캡처 플러그인 배포: src/plugin/learning-capture.ts~/.config/opencode/plugins/learning-capture.ts로 복사하세요.

  4. OpenCode를 다시 시작하세요 (구성은 시작 시에만 로드됩니다).

  5. 테스트: "내가 pnpm을 선호한다는 것을 기억해" → 새 세션을 열고 다시 물어보세요.

Daily usage

AI는 태국어와 영어를 모두 상호 교환적으로 받아들입니다 — 언제든지 경고 없이 언어를 전환할 수 있습니다.

Thai

English

Effect

"จำไว้ว่า..."

"기억해..."

remember — 기본 설정 저장

"สรุปความจำ" / "distill memory"

"메모리 요약" / "메모리 디스틸"

Smart Distill — AI가 get_recent_interactions를 읽고 패턴을 찾아 통찰을 직접 저장합니다.

"ระบบความจำเป็นไงบ้าง"

"내 메모리는 어때?" / "메모리 상태"

memory_stats

"สำรองความจำ"

"메모리 내보내기" / "메모리 백업"

export_memory

"ค้นประวัติ..."

"기록 검색..."

search_history

"ลืม..."

"잊어..."

forget

장기 관리: 가끔 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에서 무시됩니다.

A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
13Releases (12mo)
Commit activity

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Provides 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
  • A
    license
    Not graded
    quality
    Not graded
    maintenance
    Provides 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.
  • A
    license
    A
    quality
    B
    maintenance
    Provides 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.
    8
    1
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Provides 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.
    17
    4
    MIT

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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