ContextKeepのロゴ

ContextKeep

コミュニティ
mordang7

Infinite Long-Term Memory for AI Agents (MCP Server)

公開者mordang7
リポジトリContextKeep
言語Python
フォーク
38
スター
158
利用可能なツール
0
通信方式stdio, streamable-http
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    ContextKeepは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには158件のスターと38件のフォークがあります。

ContextKeep Banner

ContextKeep

Long-Term Memory for AI Agents

Version: 2.1 Status: Stable Platform: Linux | Windows | macOS License: MIT Python 3.10+ MCP Ready Docker Ready

ContextKeep gives AI agents a persistent, searchable memory they can use across sessions. V2.1 adds SQLite, full-text search, user-editable categories, safer Docker defaults, and verified backup-first upgrades.

What's New | Safe Upgrade | Install | MCP Tools | Configuration | Docs


Features

  • Persistent local memory for MCP-compatible agents.
  • SQLite storage with FTS5 full-text search.
  • User-editable categories instead of fixed tags.
  • Multiple categories per memory.
  • WebUI for browsing, editing, searching, exporting, and category management.
  • Streamable HTTP MCP endpoint at /mcp, with SSE fallback for older clients.
  • Docker Compose support with one default service for WebUI and MCP.
  • Verified backup and restore helpers for bare-metal and Docker upgrades.
  • Server identity checks through get_contextkeep_info.

ContextKeep Showcase

What's New In V2.1 Atlas

V2.1 is the first category-first ContextKeep release.

  • list_all_memories has been removed.
  • Agents now use list_categories and list_memories before retrieve_memory.
  • tags are replaced by user-editable categories.
  • Memories can belong to more than one category.
  • V1 tags are preserved as legacy_tags migration metadata.
  • Docker now runs WebUI and MCP together by default so both use the same SQLite database.
  • get_contextkeep_info reports version, storage path, database ID, tool list, and migration status.
  • Upgrade scripts create verified backups before continuing.

Older releases remain available through GitHub releases and tags. V2.1 is the recommended version for new installs and upgrades.

Safe Upgrade First

Before replacing an existing install, use the safe upgrade wrapper. It creates a backup, verifies the archive, checks SQLite/JSON integrity, and stops if anything looks wrong.

Bare-metal:

bash
python scripts/upgrade_to_v2_1.py baremetal

Docker:

bash
python scripts/upgrade_to_v2_1.py docker

V1 JSON migration:

bash
python scripts/upgrade_to_v2_1.py baremetal --v1-source /path/to/old/data/memories

See docs/SAFE_UPGRADE.md for backup, restore, Docker volume, and rollback details.

Install

Fresh Bare-Metal Install

bash
git clone https://github.com/mordang7/ContextKeep.git
cd ContextKeep
python -m venv .venv

Linux/macOS:

bash
source .venv/bin/activate
pip install -r requirements.txt

Windows PowerShell:

powershell
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

You can also run the installer:

bash
python install.py

Fresh Docker Install

bash
git clone https://github.com/mordang7/ContextKeep.git
cd ContextKeep
docker compose up -d --build

Default ports:

ServiceURL
WebUIhttp://localhost:5000
MCP HTTPhttp://localhost:5100/mcp

Run

Local MCP over stdio:

bash
python server.py

Remote MCP over HTTP:

bash
python server.py --transport http --host 0.0.0.0 --port 5100

WebUI:

bash
python webui.py --host 0.0.0.0 --port 5000

Then open:

text
http://localhost:5000

MCP Tools

ContextKeep V2.1 exposes 16 tools:

ToolPurpose
get_contextkeep_infoConfirm version, storage path, database ID, schema, tools, and migration status
list_categoriesList live user-editable categories
create_categoryCreate a category when no existing category fits
update_categoryRename or edit category metadata
delete_categoryDelete an empty category or reassign memories
merge_categoriesMerge one category into another
list_memoriesList memory keys/titles, optionally filtered by category
retrieve_memoryRetrieve a memory by exact key
search_memoriesFull-text search memory content
list_recent_memoriesList recently updated memories
store_memoryStore or update a memory with categories
update_categoriesReassign one memory to one or more categories
get_edit_historyView edit history for a memory
delete_memoryDelete a memory permanently
get_memory_statsShow memory/category counts and storage path
export_memoriesExport all memories as JSON

Recommended retrieval flow:

text
list_categories -> list_memories -> retrieve_memory

Use search_memories for topic discovery, then retrieve the exact matching memory before relying on it.

MCP Client Configuration

Most clients that support streamable HTTP:

json
{
  "mcpServers": {
    "context-keep": {
      "url": "http://localhost:5100/mcp"
    }
  }
}

Antigravity IDE uses serverURL:

json
{
  "mcpServers": {
    "context-keep": {
      "serverURL": "http://localhost:5100/mcp"
    }
  }
}

SSE fallback:

json
{
  "mcpServers": {
    "context-keep": {
      "url": "http://localhost:5100/sse"
    }
  }
}

For a remote machine, replace localhost with the hostname or address of the machine running ContextKeep.

Do not keep an old SSH/stdin config active for the same context-keep server name. It may launch an older server that writes to a different database than the WebUI.

Verify The Right Server

After connecting a client, call get_contextkeep_info.

Expected V2.1 values:

  • version: 2.1.0
  • schema_version: 2
  • storage_backend: sqlite
  • storage_path: /app/data/contextkeep.db in Docker, or your configured local path
  • V2.1 tool list including list_memories, list_categories, update_categories, and get_edit_history

If an agent stores a memory but the WebUI cannot see it, compare WebUI /api/info with MCP get_contextkeep_info. The database_id, storage_path, and memory count should match.

Backup And Restore

Create a verified bare-metal backup:

bash
python scripts/backup_contextkeep.py baremetal --install-dir /path/to/contextkeep

Create a verified Docker backup:

bash
python scripts/backup_contextkeep.py docker --volume <docker-volume-name>

Restore commands are written into every backup folder. The full guide is in docs/SAFE_UPGRADE.md.

If you use container auto-update software, keep an external backup routine. The safe upgrade scripts can verify backups before an upgrade, but unattended image replacement cannot ask you to confirm backup health.

Docs

Changelog

V2.1 Atlas

  • SQLite database with FTS5 search.
  • User-editable categories with multi-category memory assignment.
  • WebUI category management.
  • V1 JSON migration with legacy tag preservation.
  • One-container Docker default for shared WebUI/MCP database access.
  • get_contextkeep_info identity checks.
  • Verified backup and restore tooling.
  • Updated MCP client examples for HTTP, Antigravity, and SSE fallback.

V1.3 Harbor

  • Docker support.
  • Modern Python packaging.
  • New tools: delete_memory, get_memory_stats, export_memories.
  • WebUI export.
  • Packaging and code quality fixes.

V1.2 Obsidian Lab

  • Memory directory tool.
  • Obsidian Lab UI redesign.
  • Calendar and memory count improvements.

V1.1

  • Web dashboard.
  • SSE transport support.
  • Linux systemd service installer.
  • Memory titles and timestamps.

V1.0

  • Core MCP server with persistent JSON-backed memory.
  • Local stdio and remote access patterns.

Contributing

Issues, feature ideas, and pull requests are welcome. If you build a client guide, migration recipe, or workflow pattern around ContextKeep, please share it.

V1.3 Community Contributors

Thank you to everyone who contributed to the Harbor release:

  • @shuft opened the Docker support request.
  • @Cyberdogs7 contributed the initial Docker and Docker Compose implementation.
  • @frehov contributed Dockerfile, pyproject.toml, uv support, and packaging fixes.
  • @thinkstylestudio supported the project through community advocacy.

Support

If ContextKeep saves you time, tokens, or context-window pain, support is appreciated.

Ko-Fi


インストール

TypingMind
{
  "mcpServers": {
    "contextkeep": {
      "command": "/absolute/path/to/ContextKeep/venv/bin/python",
      "args": [
        "/absolute/path/to/ContextKeep/server.py"
      ]
    }
  }
}

ContextKeepのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度ContextKeepに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 お使いのデバイス上でMCPをローカル実行することも、リモートMCPサーバーのURLに接続することもできます。

方法1:ローカルコネクタを使用

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

ContextKeepをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. ContextKeepのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "contextkeep": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてContextKeepのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. ContextKeepのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
ContextKeepを使ってこのタスクを手伝ってもらえますか?
ContextKeep
はい、読みました。
ContextKeepで調べた結果をお伝えします。

方法2:MCPサーバーのURLを追加

ContextKeepがすでにリモートでホストされている場合や、チームの複数のユーザーで1つのコネクタを共有したい場合は、この方法を使います。

1

MCPコネクタを開く

TypingMindで「プラグイン」に移動し、「MCPコネクタ」を開いて「URLを追加」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 「プラグイン」に移動してください。
  3. 「MCPコネクタ」を開いてください。
  4. 「URLを追加」をクリックします。
TypingMindの「カスタムMCPサーバーURLを追加」フォーム
2

サーバーURLを貼り付け

「サーバーURL」欄にプロバイダーから提供されたMCPサーバーのURLを入力してください。サーバーで必要とされる場合は、接続名、説明、アイコン、カスタムHTTPヘッダー、OAuthクライアント設定を追加してください。

  1. 「サーバーURL」欄にプロバイダーから提供されたMCPサーバーのURLを貼り付けてください。
  2. ContextKeepの接続名を入力してください。
  3. 接続を識別しやすくするには、説明とアイコンを追加してください。
  4. サーバーで認証が必要な場合は、カスタムHTTPヘッダーまたはOAuthクライアントの詳細情報を追加してください。
3

接続を作成

「接続を作成」をクリックし、プラグイン一覧に戻って、新しいMCP接続が有効になっていることを確認してください。

  1. 「接続を作成」をクリックします。
  2. MCPコネクタの一覧に戻ってください。
  3. ContextKeepの接続が「有効」と表示されていることを確認してください。
  4. 接続がすぐに表示されない場合は、プラグイン一覧を更新してください。
4

再接続せずにモデルを切り替え

お好みのモデルでチャットを開始し、「プラグイン」でContextKeepのツールを有効にしてください。必要に応じて別のモデルに切り替えられます。MCP接続は、TypingMindのワークスペースで引き続き利用できます。

  1. TypingMindで新しいチャットを開始してください。
  2. 使用するAIモデルを選択してください。
  3. 「プラグイン」でContextKeepのツールを有効にしてください。
  4. 必要に応じて、ツールを使うようモデルに依頼してください。
  5. 別のAIモデルに切り替えて、同じMCP接続を再利用してください。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
ContextKeepを使ってこのタスクを手伝ってもらえますか?
ContextKeep
はい、読みました。
ContextKeepで調べた結果をお伝えします。

よくある質問

ContextKeep MCPサーバーは何に使いますか?

ContextKeepは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでContextKeep MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでContextKeepを利用できます。

TypingMindでContextKeep MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。ContextKeepを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

ContextKeep MCPをTypingMindに接続するにはどうすればよいですか?

ContextKeepは、ローカルMCPコネクタを使うか、リモートMCPサーバーのURLを追加することでTypingMindに接続できます。サーバーがデバイス上のファイル、アプリ、プライベートリソースにアクセスする必要がある場合はローカルコネクタを、MCPサーバーがリモートでホストされている場合はサーバーURLを使用してください。

TypingMindでContextKeep MCPのどのようなツールを利用できますか?

ContextKeepはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

ContextKeep MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。ContextKeepで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇