Skip to main content
Glama
miguelvictor

personal-memory-mcp

by miguelvictor

Personal Memory MCP Server

あなたの人生に関する事実を、損失なく構造化して検索可能な形で保存するストアです。Claudeはあらゆる会話の中でこのストアを読み書きします。1つのデプロイメントは1人専用です。Cloudflareの無料プラン(Workers + D1 + KV)だけで完全に動作します。完全な仕様は requirements.md を参照してください。

  • ドキュメントではなく、事実。 すべての事実は、出典情報を伴った1つの日付付きステートメントです。

  • 追記のみ。 修正は新しい事実を挿入し、ポインタを付けて古い事実を無効化します。何も削除されません。

  • 認証: OAuth 2.1 + Dynamic Client Registration。GitHubによる本人確認で、単一のGitHubアカウントに固定されます。

  • トランスポート: /mcp でのストリーミング可能なHTTP(ステートレスな createMcpHandler、Durable Objectsは使用しません)。

セットアップ

1. Cloudflareリソースの作成

npm install
npx wrangler d1 create memory
npx wrangler kv namespace create OAUTH_KV

返されたD1 database_id とKV名前空間 id を wrangler.jsonc に記入し、マイグレーションを適用します:

npx wrangler d1 migrations apply memory --remote

2. GitHub OAuthアプリの作成

https://github.com/settings/developers → New OAuth App で:

  • ホームページURL: https://personal-memory-mcp.<your-subdomain>.workers.dev

  • 認証コールバックURL: https://personal-memory-mcp.<your-subdomain>.workers.dev/callback

数値のGitHub IDは <https://api.github.com/users/> で確認できます(id フィールド)。

3. シークレットの設定

npx wrangler secret put GITHUB_CLIENT_ID
npx wrangler secret put GITHUB_CLIENT_SECRET
npx wrangler secret put COOKIE_ENCRYPTION_KEY   # e.g. openssl rand -hex 32
npx wrangler secret put OWNER_GITHUB_ID         # numeric id, not login

(Workers BuildsのCI/CDでデプロイする場合は、CloudflareダッシュボードのWorkerのSettings → Variables and Secretsで一度だけ設定してください。デプロイ後も保持されます。)

4. デプロイ

npm run deploy

または、Cloudflareダッシュボード(Workers Builds)でGitHubリポジトリを接続し、プッシュのたびにデプロイされるようにします。マイグレーションはデプロイ時に自動では実行されません。手動で適用し続けるか、Workers Buildsのデプロイコマンドを次のように設定してください:

npx wrangler d1 migrations apply memory --remote && npx wrangler deploy

5. Claude.aiからの接続

Settings → Connectors → Add custom connector → URL https://personal-memory-mcp.<your-subdomain>.workers.dev/mcp。Client ID/Secretは空白のままにします(Dynamic Client Registration)。GitHubログインにリダイレクトされます。OWNER_GITHUB_ID 以外のアカウントは403になります。コネクタはClaude web、Desktop、iOSで動作します。

Claude.aiのプロフィール設定に追加:

私は「memory」という名前の個人用メモリーMCPサーバーを運用しています。これは私の人生に関する真実の源泉であり、あなたの組み込みメモリーよりも優先されます。個人的な話題については、ツールの説明に従ってこのサーバーを使用してください。サーバーに到達できない場合は、その旨を伝え、回答が古くなっている可能性があることを注記してください。

6. シード(任意)

  1. Claudeに組み込みメモリーから seed.json の下書きを依頼します: [{topic, content, fact_date?, tags?}]、1エントリにつき1つの事実。

  2. 内容を確認してから:

npm run seed              # validates seed.json, writes seed-import.sql
npx wrangler d1 execute memory --remote --file=seed-import.sql
  1. 最初の会話で、Claudeに初期トピックの要約(update_summary)を書いてもらいます。

Related MCP server: chronomem

開発

cp .dev.vars.example .dev.vars   # separate GitHub OAuth app with callback http://localhost:8788/callback
npx wrangler d1 migrations apply memory --local
npm run dev                      # http://localhost:8788/mcp
npm test                         # vitest (workers runtime, real D1 + FTS5)
npm run typecheck

MCPインスペクタでテスト: npx @modelcontextprotocol/inspector@latest → http://localhost:8788/mcp に接続します。インスペクタのlocalhost OAuthリダイレクトは ALLOW_LOCALHOST_REDIRECTS=1 の場合のみ機能します(.dev.vars に設定します。本番環境では決して設定しないでください。本番環境ではClaudeコネクタのコールバックのみを受け付けます)。

注意事項

  • バックアップ: export ツール(markdownまたはjson)を使用します。FTS5仮想テーブルが存在する間は、D1のネイティブエクスポートは機能しません。D1 Time Travelで特定時点への復元が可能です(有料プランでは30日、無料プランではそれより短い期間です。現在の保持期間を確認してください)。

  • 意図的に延期(見落としではなく所有者の判断):§11の週次バックアップcron(プライベートGitHubリポジトリへの)と、§12の /view 読み取り専用ビューア。cronが実装されるまでは、定期的に export を実行し、出力を安全な場所に保管してください。

  • OAuth承認フローは、リダイレクトURIとして claude.ai/claude.com のコネクタコールバックのみを受け付けます(localhostの場合は上記の開発専用フラグが必要です)。

  • 通常の運用では行が削除されることはありません。所有者はClaudeに伝えることで事実を修正します。

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Enables AI agents and MCP clients to store, retrieve, and manage bi-temporal, graph-aware facts in an embedded SQLite memory engine with token-budgeted recall and contradiction tracking.
    6
    1
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Enables personal AI memory management through MCP tools for adding, searching, exporting, and deleting memories, with knowledge-graph retrieval and multi-hop association for clients like Claude Desktop and Cursor.
    6
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables MCP clients such as Cursor, Claude, and Windsurf to store and recall user preferences, behaviors, and other text-based information across conversations, using vector similarity search so conceptually related items are found even when exact keywords differ.
    15 npm
    MIT