Logo ContextKeep

ContextKeep

Cộng đồng
mordang7

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

Nhà phát hànhmordang7
Kho mãContextKeep
Ngôn ngữPython
Bản fork
38
Sao
158
Công cụ có sẵn
0
Phương thức truyền tảistdio, streamable-http
Danh mục
Giấy phépMIT
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    ContextKeep cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    158 sao và 38 bản fork từ kho mã được liên kết.

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


Cài đặt

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

Dùng MCP ContextKeep với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối ContextKeep, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. Bạn có thể chạy MCP ngay trên thiết bị của mình hoặc kết nối qua URL của máy chủ MCP từ xa.

Cách 1: Dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm ContextKeep làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của ContextKeep.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "contextkeep": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của ContextKeep, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của ContextKeep.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng ContextKeep giúp tôi làm việc này không?
ContextKeep
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng ContextKeep.

Cách 2: Thêm URL máy chủ MCP

Dùng cách này khi ContextKeep đã được lưu trữ từ xa hoặc nhóm của bạn muốn có một trình kết nối dùng chung cho nhiều người dùng.

1

Mở mục Trình kết nối MCP

Trong TypingMind, vào Plugin, mở mục Trình kết nối MCP, rồi chọn Thêm URL.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Vào mục Plugin.
  3. Mở mục Trình kết nối MCP.
  4. Nhấp vào Thêm URL.
Biểu mẫu Thêm URL máy chủ MCP tùy chỉnh của TypingMind
2

Dán URL máy chủ

Nhập URL máy chủ MCP do nhà cung cấp cung cấp vào trường URL máy chủ. Thêm tên kết nối, mô tả, biểu tượng, header HTTP tùy chỉnh hoặc cài đặt ứng dụng khách OAuth nếu máy chủ yêu cầu.

  1. Dán URL máy chủ MCP do nhà cung cấp cung cấp vào trường URL máy chủ.
  2. Nhập tên kết nối cho ContextKeep.
  3. Thêm mô tả và biểu tượng nếu bạn muốn dễ nhận biết kết nối hơn.
  4. Thêm header HTTP tùy chỉnh hoặc thông tin ứng dụng khách OAuth nếu máy chủ yêu cầu xác thực.
3

Tạo kết nối

Nhấp vào Tạo kết nối, sau đó quay lại danh sách Plugin và xác nhận kết nối MCP mới đang hoạt động.

  1. Nhấp vào Tạo kết nối.
  2. Quay lại danh sách trình kết nối MCP.
  3. Xác nhận kết nối ContextKeep hiển thị trạng thái đang hoạt động.
  4. Làm mới danh sách plugin nếu kết nối chưa xuất hiện ngay.
4

Đổi mô hình mà không cần kết nối lại

Bắt đầu cuộc trò chuyện với mô hình bạn thích, bật các công cụ của ContextKeep trong mục Plugin và chuyển sang mô hình khác khi cần. Kết nối MCP vẫn sẵn dùng trong không gian làm việc TypingMind.

  1. Bắt đầu cuộc trò chuyện mới trong TypingMind.
  2. Chọn mô hình AI bạn muốn dùng.
  3. Bật các công cụ của ContextKeep trong mục Plugin.
  4. Yêu cầu mô hình dùng công cụ khi cần.
  5. Chuyển sang mô hình AI khác và dùng lại cùng kết nối MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng ContextKeep giúp tôi làm việc này không?
ContextKeep
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng ContextKeep.

Câu hỏi thường gặp

Máy chủ MCP ContextKeep dùng để làm gì?

ContextKeep là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP ContextKeep với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng ContextKeep với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP ContextKeep với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối ContextKeep, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP ContextKeep với TypingMind?

Bạn có thể kết nối ContextKeep trong TypingMind bằng trình kết nối MCP cục bộ hoặc bằng cách thêm URL máy chủ MCP từ xa. Dùng trình kết nối cục bộ khi máy chủ cần truy cập tệp, ứng dụng hoặc tài nguyên riêng trên thiết bị của bạn; dùng URL máy chủ khi máy chủ MCP được lưu trữ từ xa.

MCP ContextKeep cung cấp những công cụ nào trong TypingMind?

ContextKeep cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP ContextKeep không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu ContextKeep yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇