keep mcp

MCP (Model Context Protocol) server for AI agent integration.

Provides MCP access to keep's reflective memory, using a local interface (stdio).

Quick Start

export KEEP_STORE_PATH=~/.keep
keep --store "$KEEP_STORE_PATH" mcp

Many MCP hosts launch stdio servers with a scrubbed environment. If you use a non-default store, prefer an explicit --store command or a host-specific KEEP_STORE_PATH setting instead of assuming your shell environment will be inherited.

Claude Desktop

keep config mcpb              # Generate and open .mcpb bundle

Generates a .mcpb bundle and opens it with Claude Desktop. You will be prompted to install the keep connector, which gives Claude Desktop full access to the memory system and help pages.

Claude Code

/plugin marketplace add https://github.com/generalbusiness-ai/keep.git
/plugin install keep@generalbusiness-ai

The first command registers the marketplace, the second installs the plugin (MCP tools, skill instructions, and session hooks).

Alternatively, add just the MCP server manually:

claude mcp add --scope user keep -- keep --store "$KEEP_STORE_PATH" mcp

Kiro

kiro-cli mcp add --name keep --scope global -- keep --store "$KEEP_STORE_PATH" mcp

Codex

keep config --setup auto-installs [mcp_servers.keep] into ~/.codex/config.toml with the resolved store path baked into --store. Codex.app launched from Finder does not inherit your shell environment, so the baked-in path is more reliable than KEEP_STORE_PATH.

To add the entry manually instead:

codex mcp add keep -- keep --store "$KEEP_STORE_PATH" mcp

Prefer the explicit --store form above. Use --env KEEP_STORE_PATH=... only if you specifically need Codex to launch keep mcp without embedded command arguments.

VS Code

code --add-mcp "{\"name\":\"keep\",\"command\":\"keep\",\"args\":[\"--store\",\"$KEEP_STORE_PATH\",\"mcp\"]}"

The server respects the KEEP_STORE_PATH environment variable for store location, but explicit --store is more reliable when the MCP host sanitizes child-process environments.

Maintainer Checks

For host integrations, keep mcp itself should stay boring: one stdio server, same tools everywhere. What varies is the host-native attachment point.

Current native MCP attachment targets:

Regular tests should cover only:

Occasional real-host checks should stay explicit and opt-in because they depend on external CLIs, real auth, and host-side behavior. Use:

uv run python scripts/check_host_mcp.py --host codex --host claude --run
uv run python scripts/check_host_mcp.py --host kiro --run
uv run python scripts/check_host_mcp.py --host github_copilot

The script does not join the normal pytest run. It validates host-native config locations and, when --run is supplied, runs the best available host-side smoke command for each selected tool.

Tools

Three tools:

ToolDescriptionAnnotations
keep_flowRun any operation as a state-doc flowidempotent
keep_promptRender an agent prompt with context injectedread-only
keep_helpBrowse keep documentationread-only

All operations (search, put, get, tag, delete, move, stats) go through keep_flow with named state docs. See FLOW-ACTIONS.md for the full action reference.

Resources

The MCP server also exposes read-only note resources.

Concrete resource:

Resource template:

Examples:

Resource contents use the same JSON shape returned by GET /v1/notes/{id}.

keep_flow

state:          "query-resolve"                    # state doc name
params:         {query: "auth", bias: {now: 0}}    # flow parameters
budget:         3                                   # max ticks
token_budget:   2000                                # token-budgeted rendering
cursor:         "abc123"                            # resume a stopped flow
state_doc_yaml: "..."                               # inline YAML (custom flows)

Common state docs:

StatePurposeKey params
query-resolveSearch with multi-step refinementquery, tags, bias, since, until
getRetrieve note-first output with tags plus similar/meta/versions/edges contextitem_id
find-deepSearch with edge traversalquery
putStore content or index a URIcontent or uri, tags, id
tagApply tags to one or more itemsid or items, tags
deleteRemove an itemid
moveMove versions between itemsname, source, tags
statsStore profiling for query planningtop_k

keep_prompt

name:   "reflect"                  # prompt name (omit to list available)
text:   "auth flow"                # optional search context
id:     "now"                      # item for context injection
tags:   {"project": "myapp"}       # filter search results
since:  "P7D"
scope:  "file:///path/to/dir*"     # constrain results to ID glob

Returns the rendered prompt with placeholders expanded. Supports {get}, {find}, {text}, and {binding_name} placeholders (when the prompt doc has a state tag referencing a state doc flow). See KEEP-PROMPT.md for prompt details.

MCP Prompts

The MCP server also exposes selected .prompt/agent/* notes as MCP Prompts. Exposure is store-driven: a prompt doc appears in MCP prompt listings only when it has an mcp_prompt tag.

Example prompt-doc tag:

tags:
  context: prompt
  state: get
  mcp_prompt: text,id,since,token_budget

Supported MCP Prompt arguments are intentionally narrow and all optional:

These MCP Prompts are thin wrappers over the same backend render path used by the keep_prompt tool. The tool remains the broader surface when you need until, tags, deep, or scope.

keep_help

topic:  "index"                    # documentation topic (default: index)

Agent Workflow

A typical session: orient, search, capture, reflect, update working context. Each step is one tool call:

  1. keep_prompt(name="session-start")
  2. keep_flow(state="query-resolve", params={"query": "topic"}, token_budget=2000)
  3. keep_flow(state="put", params={"content": "insight", "tags": {"kind": "learning"}})
  4. keep_prompt(name="reflect")
  5. keep_flow(state="put", params={"id": "now", "content": "next steps"})

Concurrency

The MCP stdio server is a thin HTTP client to the daemon. The daemon uses a ThreadingHTTPServer (one thread per request) and the underlying SQLite + ChromaDB stores handle their own locking. Cross-process safety (multiple agents sharing a store) is handled at the store layer.

See Also