mcp-light-memory
これは何ですか?
MCP Light Memory は、コーディングエージェントと MCP クライアント(Warp、OpenCode、JetBrains AI Assistant / PyCharm、Claude Code、Cursor)向けの、軽量でローカルファーストな永続メモリシステムです。これはチェックポイント + 検索レイヤーとして機能し、モデルのコンテキストウィンドウに会話全体を保持することなく、複数セッションにわたる複雑な作業を再開するために必要な最小限の永続状態を保存します。
エージェントがタスクを開始すると、context を呼び出して、関連する過去の決定、落とし穴、制約、仮説を取得します — ランク付けされ、重複排除され、信頼境界で制限されています。タスクが完了すると、作業状態をチェックポイントします。次のセッションでは、再起動後でもメモリはそこにあります。
Related MCP server: M3 Memory
なぜ使うのか?
問題 | MCP Light Memory が解決する方法 |
エージェントがセッション間ですべてを忘れる | Markdown ファイルがディスクに永続化されます。エージェントは BM25 + オプションの埋め込みでそれらを取得します |
セッション履歴全体はコンテキストに収まりきらない | 関連するメモリのみが取得されます(トークン予算内、MMR で多様化) |
クラウド依存 / プライバシー懸念 | 100% ローカル、オフライン、ネットワーク呼び出しゼロ、デーモンなし |
重いセットアップ / 依存関係 | 実行時依存ゼロ(純 Python 3.8+ stdlib)。オプションで |
保存されたメモリによるプロンプトインジェクション | 取得されたメモリはすべて明示的に |
マルチプロジェクト分離 | レジストリ許可リスト、 |
MCP プロトコルのドリフト | 新旧両方の時代に対応:現行の |
仕組み(メカニズム)
Markdown がソース・オブ・トゥルースです。 各メモリは YAML frontmatter(
id,type,status,tags,sources,links,valid_from,valid_to,supersedes)を持つ.mdファイルです。人間が読め、diff 可能で、永続的です。SQLite は再構築可能なキャッシュです。 BM25/FTS5 インデックス + オプションの埋め込みベクトル + 使用状況トラッキング。これを削除すると、すべて Markdown から再構築されます。
取得: 純 Python BM25 + オプションの dense 埋め込み → RRF 融合 → MMR 多様化 → ポリシーブースト(タイプ/ステータス/時間)→ トークン予算でカット。アダプティブモード:まずスパース、弱い場合のみ dense。
ライフサイクル:
remember→update→supersede(双方向にリンク、履歴は削除しない)→forget(アーカイブ、削除しない)→timeline(時系列ビュー)。過去のクエリはsearch --at YYYY-MM-DD。信頼境界: 取得されたコンテンツは
=== BEGIN/END INTERNAL_RAG MEMORY ===で囲まれ、SECURITY NOTICEヘッダーが付きます。構造化 JSON/MCP はtrust: untrusted+ オプションのsecurity_flags: ["instruction_like_content"]を保持します。エビデンスの鮮度: 各結果には、ローカルパス状エビデンスの
evidence_state(present/missing/unverifiable)が含まれます — 取得時に導出され、永続化されません。マルチプロジェクトルーター: JSON レジストリにより、多数のプロジェクトの前に単一の MCP stdio サーバーを配置します。
write:falseは子プロセスの起動前に変更系ツールをブロックします。呼び出しごとのサブプロセス分離(共有状態なし)。
セットアップ
前提条件
Python 3.8+(
pyランチャー、python、またはpython3を使用 — インストーラは実際のインタプリタを自動検出し、WindowsApps スタブを拒否します)Git(対象プロジェクトは git リポジトリである必要があります)
オプション: より良いセマンティック検索のために
pip install sentence-transformers numpy
現在のバージョンは VERSION ファイルで定義されています — 期待値をハードコードせず、それを確認してください(または mlm.py --version を実行)。
クイックスタート
このリポジトリを一度クローンしたら、あとは任意のプロジェクトへインストールします:
# Windows (PowerShell)
git clone https://github.com/PeterPirog/mcp-light-memory.git ~/mcp-light-memory
python ~/mcp-light-memory/install.py . --client warp# Linux/macOS
git clone https://github.com/PeterPirog/mcp-light-memory.git ~/mcp-light-memory
python3 ~/mcp-light-memory/install.py . --client warpインストーラは以下を行います:
スキルファイルをコピーし、
INTERNAL_RAG/+AGENTS.mdを作成しますinit+checkpoint+validateを実行します(guardが即座にOKになります)安全にできる場合は MCP サーバーをクライアント設定に自動登録します(または
MANUAL_REQUIREDを報告 / JetBrains の手順を表示します)検証済み Python インタプリタへの絶対パスを書き込みます(Windows の PATH 問題を回避)
python .agents\skills\internal-rag\mlm.py --version # reports the installed version
python .agents\skills\internal-rag\mlm.py status # expect: INTERNAL_RAG ready
python .agents\skills\internal-rag\mlm.py guard # expect: GUARD OKインストールマトリックス
1つのインストーラ、4つのクライアント、2つの設定スコープ。完全ガイド: docs/INSTALLATION.md。
クライアント | プロジェクトスコープ | グローバルスコープ |
Warp(設定書き込みは自動;プロジェクトの有効化は承認が必要な場合があります) |
|
|
OpenCode stable (V1)(安全な JSON 設定書き込みでは自動) |
|
|
OpenCode 2 (V2, beta)(安全な JSON 設定書き込みでは自動) |
|
|
JetBrains AI / PyCharm(IDE UI で手動) |
|
|
--globalはクライアント設定のスコープを変更します(~/.warp/.mcp.jsonと{repo}/.warp/.mcp.json、~/.config/opencode/opencode.jsonとプロジェクトのopencode.json)。サーバーは依然としてインストール先の対象プロジェクトを指します。多数のリポジトリに対して1つのグローバル MCP エンドポイントが必要ですか? マルチプロジェクトルーターを使用してください — docs/MCP-MULTI-PROJECT.md。
JetBrains/PyCharm は支援のみで、完全自動ではありません: インストーラが JSON + Working Directory を準備します。Settings → Tools → AI Assistant → MCP でサーバーを追加し、Server level = Project または Global を選択します。
クライアントごとの手動セットアップ(インストーラなし): docs/INSTALLATION.md + クライアントページ(Warp ・ OpenCode)。
ゼロショット: Warp と OpenCode 向けのコピーペーストプロンプト
これらのいずれかをクライアントエージェントに直接貼り付けることができます。C:\Projects\App を実際の対象リポジトリパスに置き換えてください。
Warp — 1つのプロジェクトへのインストール:
Install and configure MCP Light Memory (mcp-light-memory) as an MCP server for project C:\Projects\App in Warp, using project scope. Use the repository https://github.com/PeterPirog/mcp-light-memory. If the tool is not cloned yet, clone it to a stable location outside the project; if it already exists, update it with git pull --ff-only. Apply the canonical installation contract from the repository and run install.py with TARGET_PROJECT=C:\Projects\App and --client warp without --global. Do not force-overwrite an existing configuration. After installation, verify from cwd=C:\Projects\App: mlm.py --version, mlm.py status, and mlm.py guard, and confirm that the Warp configuration contains mcp-light-memory and the C:\Projects\App path. Report success only after MCP REGISTRATION: REGISTERED and successful verification. If Warp requires an additional project activation/toggle/approval, state the exact client-side step and do not claim the server is active before it is completed.Warp — 1つのプロジェクトのグローバルクライアント設定:
Install and configure MCP Light Memory (mcp-light-memory) in Warp globally for project C:\Projects\App. Use the repository https://github.com/PeterPirog/mcp-light-memory. If the tool is not cloned yet, clone it to a stable location outside the project; if it already exists, run git pull --ff-only. Apply the canonical installation contract and run install.py with TARGET_PROJECT=C:\Projects\App, --client warp, and --global. Remember: --global means the global Warp client configuration, while the server must still be bound to C:\Projects\App; do not use the multi-project router. After installation, verify from cwd=C:\Projects\App: mlm.py --version, mlm.py status, and mlm.py guard, and confirm that the global Warp configuration contains mcp-light-memory and the C:\Projects\App path. Report success only after MCP REGISTRATION: REGISTERED and successful verification.OpenCode — 1つのプロジェクトへのインストール(stable/V1):
Install and configure MCP Light Memory (mcp-light-memory) as an MCP server for project C:\Projects\App in OpenCode. By "OpenCode" I mean stable/V1, so use --client opencode, not opencode2. Use the repository https://github.com/PeterPirog/mcp-light-memory. If the tool is not cloned yet, clone it to a stable location outside the project; if it already exists, run git pull --ff-only. Run install.py with TARGET_PROJECT=C:\Projects\App and --client opencode without --global. Do not force-overwrite an existing configuration. If the installer returns MCP REGISTRATION: MANUAL_REQUIRED (for example because opencode.jsonc exists), do not report success: safely edit the JSONC while preserving comments and unrelated settings if you have appropriate file-editing tools; otherwise report the exact manual action required. After real registration, verify from cwd=C:\Projects\App: mlm.py --version, mlm.py status, and mlm.py guard, and confirm that the OpenCode configuration contains mcp-light-memory and C:\Projects\App.OpenCode — 1つのプロジェクトのグローバルクライアント設定(stable/V1):
Install and configure MCP Light Memory (mcp-light-memory) globally in OpenCode for project C:\Projects\App. By "OpenCode" I mean stable/V1, so use --client opencode. Use the repository https://github.com/PeterPirog/mcp-light-memory. If the tool is not cloned yet, clone it to a stable location outside the project; if it already exists, run git pull --ff-only. Run install.py with TARGET_PROJECT=C:\Projects\App, --client opencode, and --global. --global means the global OpenCode client configuration, while the server must still be bound only to C:\Projects\App; do not use the multi-project router. If the installer returns MCP REGISTRATION: MANUAL_REQUIRED, do not report success and follow the safe JSONC instructions. After real registration, verify from cwd=C:\Projects\App: mlm.py --version, mlm.py status, and mlm.py guard, and confirm that the global OpenCode configuration contains mcp-light-memory and the C:\Projects\App path.OpenCode 2 / V2 の場合は、同じプロンプトを使用し、OpenCode 2 / V2 と明示的に指定して、--client opencode2 を要求してください。他のバリエーション: docs/ZERO-SHOT-SETUP-PROMPTS.md。
設定の詳細
Warp
Warp は MCP サーバー設定を ~/.warp/.mcp.json(グローバル、自動起動)または {repo}/.warp/.mcp.json(プロジェクト、Warp ドキュメントに従って手動トグルが必要)から読み取ります。形式: mcpServers.<name> に command、args、working_directory を指定します(常に設定してください — メモリストアはここから解決されます)。examples/warp.example.json と docs/WARP-SETUP.md を参照。
OpenCode stable (V1)
OpenCode はプロジェクトルートの opencode.json/.jsonc、またはグローバルの ~/.config/opencode/opencode.json を読み取ります。V1 サーバーは mcp.<name> の下にフラットに配置され(servers サブキーなし)、enabled: true と command を配列として持ちます — examples/opencode-legacy.example.json と docs/OPENCODE.md を参照。
OpenCode 2 (V2, beta)
設定ファイルは同じですが、形状が異なります: mcp.servers.<name>、command は配列、enabled フィールドはありません(V2 は disabled: true で無効化します)— examples/opencode-v2.example.jsonc と docs/OPENCODE.md を参照。
JetBrains AI Assistant / PyCharm
PyCharm は MCP 設定ファイルを自動読み取りしません。インストーラは貼り付け可能な JSON + Working Directory を表示します。Settings → Tools → AI Assistant → MCP (STDIO) でサーバーを追加し、Server level = Project または Global を選択します。examples/jetbrains.example.json を参照。
マルチプロジェクトルーター
多数のプロジェクトの前に1つの MCP 接続 — レジストリ許可リスト、write:false のハードバウンダリ、呼び出しごとのサブプロセス分離。
レジストリファイル(projects.json)
{
"projects": {
"backend": { "root": "/abs/path/backend", "write": true },
"shared-lib": { "root": "/abs/path/shared-lib", "write": false }
}
}ルーター用 Warp 設定
{
"mcpServers": {
"mcp-light-memory-router": {
"command": "python3",
"args": ["/abs/path/mcp-light-memory/.agents/skills/internal-rag/irag_mcp_router.py", "--registry", "/abs/path/projects.json"],
"working_directory": "/abs/path/mcp-light-memory"
}
}
}詳細は docs/MCP-MULTI-PROJECT.md を参照。
ワークフロー
context --task "current task"
↓
recovery, if required (RECOVERY REQUIRED)
↓
checkpoint before first change
↓
implementation
↓
checkpoint after each milestone
↓
guard before finishing主要コマンド(CLI エイリアス: mlm.py またはレガシーの irag.py):
mlm.py context --task "..."
mlm.py checkpoint --reason "..."
mlm.py search --query "..." --limit 8
mlm.py remember --type decision --title "..." --body "..."
mlm.py show <ref>
mlm.py update <ref> --status superseded
mlm.py status
mlm.py guard
mlm.py validate
mlm.py doctorパス対応(リブランド: internal-rag → MCP Light Memory)
新しい名前 | レガシーパス(互換性のため保持) |
|
|
|
|
|
|
|
|
| — |
| — |
ディスク上のフォルダ INTERNAL_RAG/ とスキルディレクトリ .agents/skills/internal-rag/ は、ゼロマイグレーションの後方互換性のために意図的にレガシー名のままにされています。docs/MIGRATION-TO-MCP-LIGHT-MEMORY.md を参照。
永続メモリ(CRUD)
remember --type decision --title "..." --body "..." --tags "a,b" --evidence "src/x.py:42" --links "decisions/other.md"
show <path-or-id>
show <ref> --section Knowledge
update <ref> --add-tags "new" --append "New evidence: ..."
supersede <ref> --by <new> --reason "..."
forget <ref> # archives, does not delete
link --from <ref> --to <ref>
timeline --limit 20
status
historyタイプ: decision, knowledge, constraint, gotcha, failure, hypothesis, session。
タスクスタック(割り込み)
mlm.py push --task "interrupted work" --reason "user-priority"
mlm.py tasks
mlm.py resume
mlm.py forget-task <id> # drop a specific task
mlm.py forget-task # clear the whole stack設定(.irag.yml、オプション)
retrieval:
limit: 10
mmr_lambda: 0.4
min_score: 0.3
embeddings: auto # auto | on | off
profile: english-fast # english-fast (default) | multilingual (PL/EN projects)
embeddings_model: null # explicit model overrides the profile
tokens:
context_budget: 5000
checkpoints:
auto_archive_sessions: true
max_task_stack: 24mlm.py config で有効な設定を表示します。mlm.py config --init でテンプレートを書き出します。
オプションの埋め込み(より良い取得)
pip install -r requirements-optional.txtパッケージが利用可能で、.irag.yml に embeddings: auto(デフォルト)が設定されている場合、取得は BM25 へのフォールバック付きで埋め込みを使用します。実行時に --embeddings on|off|auto で上書きできます。
2つの取得プロファイル(docs/EMBEDDINGS.md を参照):
english-fast(デフォルト、all-MiniLM-L6-v2)multilingual(intfloat/multilingual-e5-small)— ポーランド語と英語のプロジェクト向け
オフライン / エアギャップ
python pack.py --with-embeddings --profile english-fast
# -> internal-rag-offline-1.8.1.zip (name from pack.py; 1.8.1 = VERSION file)
# On the air-gapped machine:
unzip internal-rag-offline-*.zip -d internal-rag-offline
pip install --no-index --find-links wheels/ -r requirements-optional.txt
python install.py "/path/to/project" --client <warp|opencode|opencode2|jetbrains>詳細は docs/OFFLINE.md を参照。
プライバシーと Git
デフォルトのインストールモードはローカルのみです。インストーラはプロジェクトの .gitignore ではなく .git/info/exclude を使用するため、ローカルメモリと統合ファイルが誤ってコミットされることはありません。
プロジェクトを公開する前に:
python .\privacy_check.py "D:\path\to\project"期待される結果: RESULT: PASS
プロジェクトからの完全な削除
python .\uninstall.py "D:\path\to\project"アンインストーラはリポジトリ外にバックアップを作成し、その後 INTERNAL_RAG とその統合を削除します。メモリデータを保持するには --keep-memory を使用します。
ドキュメント
アーキテクチャ · メモリライフサイクル · リカバリ
対象プロジェクト内の構造
project/
├── AGENTS.md
├── .irag.yml # optional config
├── INTERNAL_RAG/
│ ├── WORKING_STATE.md
│ ├── INDEX.md
│ ├── .checkpoint.json
│ ├── decisions/ knowledge/ gotchas/ failures/ hypotheses/ sessions/ archive/
│ └── exports/
├── .agents/skills/internal-rag/
│ ├── SKILL.md
│ ├── mlm.py # primary CLI (forwards to irag.py)
│ ├── irag.py # core (legacy alias, still the canonical module)
│ ├── irag_embeddings.py # optional plugin
│ └── irag_hooks.py # optional git hooks
└── .opencode/ # OpenCode integration (optional)真実の源
現在のユーザー指示、2. 現在のコード/テスト/設定、3. 仕様/ADR、4. 検証済みメモリ、5. セッションノート、6. 仮説。
メモリは古くなっている可能性があります。コードが優先されます。
ライセンス
MIT.
変更履歴
1.8.0 — JetBrains 手動セットアップ
--client jetbrainsはダミーの設定ファイルを書き込まなくなりました (PyCharm は MCP 設定ファイルを無視します)。代わりに、貼り付け可能な JSON と IDE メニューの手順を出力します。--unregister --client jetbrainsは IDE UI での削除を促すリマインダーを出力します。
1.7.2 — JetBrains cwd + クライアント別メッセージ
JetBrains:
working_directoryをヒントとして書き込み、Settings → Tools → AI Assistant → MCPに設定する正確なパスとともにWARNINGを出力します。クライアント別の再起動メッセージ (Restart PyCharm / Restart Warp / Restart OpenCode)。
インストール出力に
Memory store: <path>を表示して、即座に検証できるようにします。
1.7.1 — Windows Python スタブ修正
detect_python()は WindowsApps の 0 バイトスタブを拒否し、py -0pを優先し、各候補を--versionで検証します。登録後の検証: 設定を書き込んだ直後に
--versionを実行し、PASS/FAILを報告します。--unregisterは空の設定ファイルと親ディレクトリを削除します (無効な.warp/.mcp.jsonスケルトン →GUARD STALEを修正)。
1.7.0 — MCP Light Memory へのリブランド
internal-ragから MCP Light Memory (mcp-light-memory) への全面リブランド。新しい CLI エイリアスmlm(mlm.py)。ロゴ/アイコンアセット。移行ドキュメント。GitHub リブランドチェックリスト。後方互換:
irag.py、INTERNAL_RAG/、旧 MCP サーバー名を非推奨エイリアスとして保持。リブランド一貫性テスト 18 件。
1.6.1 — v1.6 後の堅牢化
ミューテーション/ライフサイクルベンチマーク (11 シナリオ)。信頼境界 (ADR-015):
trust: untrusted+security_flags。エビデンスの鮮度 (ADR-016):evidence_state。スケールベンチマーク (100/1k/10k)。ルーターセキュリティリグレッション (+12 テスト)。ドキュメント一貫性テスト。249 テストが合格。
1.6.0 — 検索品質 + MCP 2026-07-28
メモリ品質ベンチマーク (37 ケース)。MCP
2026-07-28デュアル世代 (server/discover、_meta、structuredContent、outputSchema)。レジストリの厳格なwrite。チャンクプレフィックス内のソース。適応型検索。リンクを考慮したコンテキスト。consolidate --prepare。ルーター遅延ベンチマーク。ADR-010…016。
1.5.0 — 棄権ゲート + マルチプロジェクトルーター
関連性/棄権ゲート (
--meta)。FTS5 候補プリフィルター。マルチプロジェクト MCP ルーター。MCP プロトコルの堅牢化 (stdout のみ、SDK 検証済み)。168 テスト。
1.4.0 — チャンキング + 重複排除 + 時間的ライフサイクル
セクション認識チャンキング (スキーマ v3)。SimHash 重複排除。多言語 PL/EN プロファイル。時間的ライフサイクル (
valid_from/valid_to/supersedes/--at)。consolidate --dry-run。
1.3.0 — 永続エンベディングキャッシュ
SQLite 内のチャンク単位 float32 BLOB。複数モデルの共存。
index --vacuum/--embed-missing。
1.0.2 — トークン予算 + プライバシー
トークン予算の強制。古いメモリの検出。重複検出。書き込み時のプライバシースキャン。自動チェックポイントタイマー。オフライン/エアギャップパック。
1.0.0 — 初回リリース
BM25 + MMR 検索。メモリの完全な CRUD。タスクスタック。MCP サーバー (JSON-RPC stdio)。Git フック。診断。エクスポート/インポート。トークン予算。
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseAqualityAmaintenanceMCP-native, local-first memory for coding agents that turns real sessions into reusable decisions, gotchas, and domain knowledge.176MIT
- AlicenseBqualityCmaintenanceLocal-first persistent memory layer for MCP agents with hybrid search, file ingestion, and GDPR compliance.2022Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides a persistent, local-first memory for coding agents over MCP, enabling automatic recall and recording of past work, failures, and decisions to reduce repetition and token usage.MIT
- AlicenseNot gradedqualityAmaintenanceProvides persistent memory for AI coding agents via MCP, enabling agents to store and semantically recall facts, events, and lessons across sessions, all running locally without cloud dependencies.Apache 2.0
Related MCP Connectors
Universal memory for AI agents and tools. Save, organize and search context anywhere.
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/PeterPirog/mcp-light-memory'
If you have feedback or need assistance with the MCP directory API, please join our Discord server