mdmem

mdmem

Provides a hierarchical memory management system using Markdown files. Enables creating, reading, linking, splitting, and archiving memory files with bidirectional wikilinks, keyword+graph search, and optimistic concurrency control.

Category
Visit Server

README

markdown-hierarchical-memory

markdown-hierarchical-memory-spec.md v1 の実装。

  • MCPサーバー (src/mdmem/): ファイル読み書き、frontmatter管理、wikilinkグラフ、 キーワード+グラフ展開検索、楽観的並行制御(§16)、双方向リンク整合性チェック(§12)、 変更ログ(§10/§17) を提供する機械的実行層。意味的判断(凝集度・重要度など §9)は 実装していない。
  • Claude Code subagent (.claude/agents/memory-manager.md): 仕様書§10のManager Agent。MCPツールを呼び出して意味的判断を行う側。

スコープ

  • 検索は §15 のうちリンクグラフ+キーワード検索のみ(埋め込みベクトル検索は未実装。 src/mdmem/search.py_score を差し替えれば追加できる)。
  • Manager Agentの判断ロジックはサーバー内部にLLM呼び出しを持たない。呼び出し元 (Claude Code)が判断し、判断結果をツール呼び出しのパラメータとして渡す想定。

セットアップ

pip install -e .
python -m pytest tests/

Claude Codeへの登録

.mcp.json.example.mcp.json にコピーし、<ABSOLUTE_PATH_TO_THIS_REPO> をこのリポジトリの 絶対パスに書き換える(.mcp.json は個人のローカルパスを含むため .gitignore 対象):

cp .mcp.json.example .mcp.json
# .mcp.json を編集してパスを埋める

Claude Codeを再起動(またはMCP設定を再読込)するとmdmem サーバーが有効になり、 .claude/agents/memory-manager.mdmemory-manager subagentから mcp__mdmem__* ツール群を呼び出せる。

claude mcp list

mdmem が認識されているか確認できる。

Cursorへの登録

Cursorを再起動(または Settings → Tools & MCP で mdmem を再読込)すると、 同じ memory/ を Claude Code と共有して使える。

ディレクトリ

memory/
 ├── index.md          # 純粋なレジストリ(§14)
 ├── projects/
 ├── concepts/
 └── archive/
      └── _manager_log.md   # 変更ログ(§10/§17)

memory/ の実体パスは環境変数 MDMEM_ROOT で変更できる(デフォルト: カレントディレクトリの memory/)。

主なMCPツール

ツール 対応する仕様
get_index / list_memory_files / read_memory_file / search_memory / get_links §14, §15, §11(access_count)
create_memory_file §3, §14
append_to_memory_file §4 Step1, §16
link_memory_files §12(双方向リンクを1操作として実行、自己チェック付き)
split_memory_file §9/§10 分割
summarize_and_archive_memory_file §5/§9/§13 要約してarchive
move_to_archive §13 忘却モデル(内容そのまま)
check_archive_candidates §13(提案のみ、実行はしない。§11)
get_change_log §10/§17

すべての書き込み系ツールは expected_updated を受け取り、読み取り時の値と不一致なら ConflictError を返す(§16)。

既知の制限

  • 並行書き込みの狭いレース条件: expected_updatedの楽観ロックは「読んだ後に検証してから書く」 までを1プロセス内でしか保証していない。CursorとClaude Codeが同じMDMEM_ROOTを共有する運用 (実際にこのリポジトリの開発中に両者が同時に書き込んでいる場面を確認済み)では、2プロセスが ほぼ同時に同じファイルを読んで両方チェックを通過し、片方の更新が消える理論上の余地がある。 致命的ではないが、単一プロセスからのみ書き込む運用であれば問題にならない。
  • 埋め込みベクトル検索は未実装(スコープの節を参照)。
  • id^[A-Za-z0-9_-]+$のみ許可(ファイルパスに直接使われるため)。

ライセンス

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured