MCP Integration

Connect AI assistants to your KeepNotes memory via the Model Context Protocol.

The MCP endpoint exposes 3 reflective-memory tools — the same tools available in the local MCP server, running over streamable-http with your API key for authentication.

Client configuration

Add this to your MCP client config (Claude Desktop, Cursor, Windsurf, etc.):

{
  "mcpServers": {
    "keepnotes": {
      "url": "https://api.keepnotes.ai/mcp/",
      "headers": {
        "Authorization": "Bearer knk_your_api_key_here"
      }
    }
  }
}

For Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

Tools

Three tools, all prefixed keep_ to avoid collision with other MCP servers:

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. All tools return human-readable strings. Errors are returned as strings (never raised to the protocol layer).

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
get-contextRetrieve item with similar/meta/versions/edgesitem_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"
until:          "2026-02-01"
deep:           true                       # follow tags to discover related items
scope:          "file:///path/to/dir*"     # constrain results to ID glob
token_budget:   3000                       # token budget for search context

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.

keep_help

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

Browse keep documentation. Call with topic="index" to see all available topics.

Agent workflow

An MCP agent's session looks like this:

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

Authentication

The MCP endpoint uses the same API keys as the REST API. Pass your key in the Authorization header as shown above.

Rate limits, usage tracking, and project scoping all work identically to the REST API.

Example usage

Once configured, your AI assistant can use keepnotes tools directly:

"Search my notes for anything about the Q3 budget review"

The assistant calls keep_flow with {state: "query-resolve", params: {query: "Q3 budget review"}} and gets back semantically matched notes.

"Remember that Kate prefers aisle seats"

The assistant calls keep_flow with {state: "put", params: {content: "Kate prefers aisle seats"}}.

Local MCP server

For local-only usage without an API key, see keep mcp (local) — the same 3 tools running as an stdio server. Use one or the other, not both — the tools share the same names, so installing both would give the agent duplicate tools and unpredictable routing.

See also