ContextKeep logo

ContextKeep

Community
mordang7

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

Publishermordang7
RepositoryContextKeep
LanguagePython
Forks
38
Stars
158
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    ContextKeep exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    158 stars and 38 forks from the linked repository.

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


Installation

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

Use ContextKeep MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once ContextKeep is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add ContextKeep as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the ContextKeep MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "contextkeep": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the ContextKeep MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the ContextKeep MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use ContextKeep to help me with this task?
ContextKeep
Sure. I read it.
Here is what I found using ContextKeep.

Option 2: Add an MCP server URL

Use this when ContextKeep is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter the MCP server URL from the provider in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste the MCP server URL from the provider into the Server URL field.
  2. Enter a connection name for ContextKeep.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the ContextKeep connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the ContextKeep tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the ContextKeep tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use ContextKeep to help me with this task?
ContextKeep
Sure. I read it.
Here is what I found using ContextKeep.

Frequently asked questions

What is the ContextKeep MCP server used for?

ContextKeep is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use ContextKeep MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use ContextKeep with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use ContextKeep MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With ContextKeep connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect ContextKeep MCP to TypingMind?

ContextKeep can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does ContextKeep MCP provide in TypingMind?

ContextKeep exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use ContextKeep MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If ContextKeep requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇